<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8"
   import="com.novell.webaccess.common.JSPConduit,
           com.novell.emframe.dev.eMFrameUtils,
           com.novell.emframe.dev.DirUtils,
           com.novell.emframe.fw.FwUtils" %>

<%
   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("FwResources");
%>

<%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>

<iman:stringtable bundle="FwResources"/>
<iman:stringtable bundle="DevResources"/>

<HTML>
<HEAD>
   <LINK rel="stylesheet" href="<c:out value="${ContextPath}" />/portal/modules/dev/css/hf_style.css">
   <iman:eMFrameScripts/>

      <SCRIPT>

   /*******************
    * FUNCTION HEADER *
    *******************/
   function onExit()
   {
      var form = document.SMTPServerForm;
      form.EmailAction.value="Cancel";
      form.submit();
   }

   function onApplyAndExit()
   {
      var form = document.SMTPServerForm;
      form.submit();
   }


   </SCRIPT>
   </HEAD>
   <BODY>
      <% String taskId = (String) request.getAttribute("taskId"); %>
      <FORM name="SMTPServerForm" method="POST" action="webacc">
        <input type="hidden" name="taskId" value="<%=taskId%>" />
        <input type="hidden" name="EmailAction" value="UpdateEvent" />
        <input type="hidden" name="eventID" value="<%=request.getAttribute("eventID")%>" />

<div class="smalltext" style="margin-bottom: 1em">
	     <a href="#" title="Link: Task Notification" onClick="onExit(); return false;" target="_self"><%= c.toHTML(c.string("Task.Event.ConfigHeader"))%></a>
            <img src="/nps/portal/modules/dev/images/breadspace.gif" width="17" height="9" border="0" align="absmiddle" alt=""><%=request.getAttribute("eventID")%></div>

         <% c.set("TaskHeader.title",  c.toHTML(c.string("Task.Event.ConfigHeader2")) + request.getAttribute("eventID"));
            c.set("TaskHeader.iconUrl", "dev/bullet_default_16.gif"); %>
         <jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" />

          <div class="formdescriptextml0"  style="width: 70%"><%= c.toHTML(c.string("Task.Event.ConfigInstructions2")) %></div>

		<div id="tab1" style="display: block" class="margintop3">
			<div class="margintop1">
				<table border="0" cellspacing="5" cellpadding="0">
					<tr>
						<td class="smalltext" valign="top"><%= c.toHTML(c.string("Task.Event.EventSubject")) %></td>
						<td class="smalltext"><textarea name="eventSubject" rows="4" cols="50"><%=request.getAttribute("eventSubject")%></textarea></td>
					</tr>
					<tr>
						<td class="smalltext" valign="top"><%= c.toHTML(c.string("Task.Event.EventMessage")) %></td>
						<td class="smalltext"><textarea name="eventMessage" rows="4" cols="50"><%=request.getAttribute("eventMessage")%></textarea></td>
					</tr>
					<tr>
						<td class="smalltext"><%= c.toHTML(c.string("Task.Event.EventAdditionalAddr")) %></td>
						<td class="smalltext"><input type="text" name="eventAddrs" size="60" value="<%=request.getAttribute("eventAddrs")%>"</td>
					</tr>
                    <tr>
                        <td class="smalltext" valign="middle"></td>
                        <td class="smalltext">
                            <div class="textblue1"><%= c.toHTML(c.string("Task.Event.ConfigAddrInstruction")) %></div>
                        </td>
                    </tr>
                    <tr>
						<td class="smalltext"></td>
                        <%
                              String sOverride = (String)request.getAttribute("eventAddrOverride");
                              if (sOverride != null && sOverride.equalsIgnoreCase("true"))
                              { %>
                                <td class="smalltext"><input type="checkbox" checked name="eventAddrOverride"><%= c.toHTML(c.string("Task.Event.EventOverrideCheckbox")) %></td>
                              <% } else { %>
                                <td class="smalltext"><input type="checkbox" name="eventAddrOverride"><%= c.toHTML(c.string("Task.Event.EventOverrideCheckbox")) %></td>
                              <% } %>
					</tr>
				</table>
			</div>
		</div>


         <iman:bar/>
         <div id="buttondiv" style="display: block">
            <iman:button key="OK" onClick="onApplyAndExit();" />
            <iman:button key="Cancel" onClick="onExit();" />
         </div>
         <br/>
         <br/>

         <table border="1">
            <tr>
                <td class="smalltext" colspan="2"><%= c.toHTML(c.string("Task.Event.HowTo"))%></td>
            </tr>
            <tr>
                <td class="smalltext"><%= c.toHTML(c.string("Task.Event.HowToAddElement"))%></td>
                <td class="smalltext">&lt;install&gt;<br/>
                                      &#160;&lt;module&gt;<br/>
                                      &#160;&lt;/module&gt;<br/>
                                      &#160;&lt;email-event&gt;<br/>
		                              &#160;&#160;&lt;id><font color="red">SampleEvent</font>&lt;/id&gt;<br/>
                                      &#160;&#160;&lt;resource-properties-file&gt;SampleTaskStrings&lt;/resource-properties-file&gt;<br/>
		                              &#160;&#160;&lt;display-name-key&gt;SampleEventKey&lt;/display-name-key&gt;<br/>
                                      &#160;&#160;&lt;description-key&gt;SampleEventDescriptionKey&lt;/description-key&gt;<br/>
	                                  &#160;&lt;/email-event&gt;<br/>
                                      &lt;/install&gt;<br/>
                </td>
            </tr>                                              
            <tr>
                <td class="smalltext"><%= c.toHTML(c.string("Task.Event.HowToSendEvent"))%></td>
                <td class="smalltext">// construct event<br/>
                                      String eventID = "<font color="red">SampleEvent</font>";<br/>
                                      EmailEvent event = new EmailEvent(context, eventID, null); <br/>
                                      <br/>
                                      // post this event   <br/>
                                      EmailEventService.postEventEmail(event); <br/>
                </td>
            </tr>
        </table>

         
    </FORM>
   </BODY>
</HTML>
