home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / windowsxp / ftgateoffice / ftgateoffice.exe / Main / composemain.fts < prev    next >
Encoding:
Text File  |  2001-11-29  |  8.3 KB  |  387 lines

  1. <%
  2. #include </utility/global.fts>
  3. #include </utility/ftgate.fts>
  4. #include </utility/theme.fts>
  5. #include </utility/wmsecurity.fts>
  6. %>
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  8. <HTML>
  9. <HEAD>
  10. <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
  11. <META NAME="GENERATOR" Content="Microsoft Developer Studio">
  12. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  13. <TITLE>FTGatePro WebMail</TITLE>
  14. </HEAD>
  15.  
  16. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  17. <!--
  18. var addressbook=null;
  19. var dir="<%=buttons%>"
  20.  
  21. if (!document.images) {}
  22. else {
  23.     send0 = new Image();
  24.     send0.src  = dir+"send.gif";
  25.     send1 = new Image();
  26.     send1.src = dir+"sendon.gif";
  27.     cancel0 = new Image();
  28.     cancel0.src  = dir+"cancel.gif";
  29.     cancel1 = new Image();
  30.     cancel1.src = dir+"cancelon.gif";
  31. }
  32.  
  33. function change(Name,Image,No)
  34. {
  35.     if (!document.images) {}
  36.     else document [Name].src = eval(Image + No + ".src");
  37. }
  38.  
  39. <%
  40. if (netscape)
  41. {
  42.     %>
  43.     var enter=false;
  44.     document.captureEvents(Event.KEYPRESS|Event.FOCUS);
  45.     document.onkeypress = keypress;
  46.     document.onfocus = focus;
  47.  
  48.     function focus(event)
  49.     {
  50.         if (event.target==document.ftgate.body)
  51.         {
  52.             enter=true;
  53.         }
  54.         else
  55.             enter=false;
  56.     }
  57.  
  58.     function keypress(event)
  59.     {
  60.         if (enter)
  61.             return true;
  62.  
  63.         if (event.which==13)
  64.         {
  65.             onSend();
  66.             return false;
  67.         }
  68.  
  69.         return true;
  70.     }
  71.     <%
  72. }
  73. else
  74. {
  75.     %>
  76.     function keypress()
  77.     {
  78.         if (document.activeElement==document.ftgate.body)
  79.             return;
  80.  
  81.         if (event.keyCode==13)
  82.         {
  83.             event.returnValue=null;
  84.             onSend();
  85.         }
  86.     }
  87.     <%
  88. }
  89. %>
  90.  
  91. function onLoad()
  92. {
  93.     <%
  94.     if ((request.command=="1")||(request.command=="4"))
  95.         output.writeln("document.ftgate.to.focus();")
  96.     else if (request.command=="2")
  97.         output.writeln("document.ftgate.subject.focus();")
  98.     else
  99.         output.writeln("document.ftgate.body.focus();")
  100.     %>
  101. }
  102.  
  103. function isOK(form)
  104. {
  105.     if (!isEmailList(form.to.value))
  106.     {
  107.         window.alert("You must specfy at least one recipient in the form user@domain.com.");
  108.         form.to.focus();
  109.         return false;
  110.     }
  111.  
  112.     return true;
  113. }
  114.  
  115. function onSend()
  116. {
  117.     if (!isOK(document.ftgate))
  118.         return;
  119.  
  120.     document.ftgate.param1.value=document.ftgate.to.value;
  121.     document.ftgate.submit();
  122. }
  123.  
  124. function onLaunch(href)
  125. {
  126.     window.location.href=href
  127. }
  128.  
  129. function onAddress(to)
  130. {
  131.     var url="";
  132.  
  133.     document.ftgate.tocc.value=to;
  134.     if (to)
  135.         url = "address.fts?to="+document.ftgate.to.value;
  136.     else
  137.         url = "address.fts?to="+document.ftgate.cc.value;
  138.     addressbook = window.open(url,"AddrWindow","width=600,height=325,resizable=yes,scrollbars=yes");
  139.     addressbook.opener = window;
  140.     addressbook.focus();
  141. }
  142.  
  143. function onUnload()
  144. {
  145.     if (addressbook != null && addressbook.closed == false)
  146.     {
  147.         addressbook.close();
  148.         addressbook = null;
  149.     }
  150. }
  151.  
  152. function onCancel()
  153. {
  154.     parent.close();
  155. }
  156. //-->
  157. </SCRIPT>
  158. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js" TYPE="text/javascript"></SCRIPT>
  159. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js" TYPE="text/javascript"></SCRIPT>
  160.  
  161. <BODY BGCOLOR="white" onLoad="onLoad()" onUnload="onUnload()" MARGINHEIGHT="0" MARGINWIDTH="0" onKeypress="keypress()">
  162. <!--
  163. <%
  164. scripttimeout=300
  165.  
  166. var to=""
  167. var cc=""
  168. var text=""
  169. var subject=""
  170.  
  171. var folder=new m.folder
  172. var ldap=new server.ldap
  173. var wm=new server.webmail
  174.  
  175. function isDigit(char)
  176. {
  177.     var i=number(char)
  178.  
  179.     if ((i>0)||(char=="0"))
  180.         return true
  181.     else
  182.         return false
  183. }
  184.  
  185. folder.message.selectid(request.id)
  186.  
  187. if (session.webmail.addsignature==1)
  188.     text="\n\r"+session.webmail.signature
  189.  
  190. if (request.command=="1")
  191. {
  192.     // new email
  193. }
  194. else if (request.command=="2")
  195. {
  196.     // email address book entry
  197.     to=session.addressbook.email[request.id]
  198. }
  199. else if ((request.command=="3")||(request.command=="4"))
  200. {
  201.     // reply to email
  202.     if (request.command=="3")
  203.         to=request.email
  204.  
  205.     if (request.command=="3")
  206.         subject="Re: "+wm.headerdecode(folder.message.subject)
  207.     else
  208.         subject="Fw: "+wm.headerdecode(folder.message.subject)
  209.  
  210.     text=text+"\n\r-----Original Message-----\n\r"
  211.  
  212.     extractNameAndAddress(folder.message.fromline)
  213.     text=text+"From: \""+wm.headerdecode(extractedName)+"\" <"+extractedAddress+">\n"
  214.  
  215.     extractNameAndAddress(folder.message.toline)
  216.     text=text+"To: \""+wm.headerdecode(extractedName)+"\" <"+extractedAddress+">\n"
  217.     text=text+"Date: "+folder.message.sentdate+"\n"
  218.     text=text+"\n"
  219.  
  220.     var msg = folder.message.open()
  221.  
  222.     var loop=msg.mime.first()
  223.     while (loop)
  224.     {
  225.         if (msg.mime.contenttype=="text/plain")
  226.             break
  227.  
  228.         loop=msg.mime.next()
  229.     }
  230.  
  231.     var base64 = (msg.mime.contenttransferencoding=="base64")
  232.     loop=msg.mime.next()
  233.     msg.mime.seekto()
  234.  
  235.     var str=""
  236.     
  237.     for (loop=0; loop<msg.mime.linecount; loop++)
  238.     {
  239.         msg.nexttext()
  240.  
  241.         var line=msg.text
  242.  
  243.         if (base64)
  244.             line = line.base64decode()
  245.  
  246.         if (line.length)
  247.             str=str+line.slice(0, line.length-1)
  248.  
  249.         if (str.length>=2)
  250.         {
  251.             // is last character '='
  252.             if (str.slice(str.length-1, str.length)!="=")
  253.             {
  254.                 var index=str.length-1
  255.  
  256.                 var char=str.slice(index, index+1)
  257.                 while ((index>=0)&&(isDigit(char))&&(char!="="))
  258.                 {
  259.                     index=index-1
  260.                     if (index>=0)
  261.                         char=str.slice(index, index+1)
  262.                 }
  263.  
  264.                 if (char=="=")
  265.                     str=str.slice(0, index)
  266.  
  267.                 if (session.webmail.indent)
  268.                     text=text+session.webmail.indentchar+" "
  269.  
  270.                 text=text+wm.escape(str)
  271.                 if (!base64)
  272.                     text=text+"\n"
  273.  
  274.                 str=""
  275.             }
  276.             else
  277.             {
  278.                 str=str.slice(0, str.length-1)
  279.             }
  280.         }
  281.         else
  282.         {
  283.             if (session.webmail.indent)
  284.                 text=text+session.webmail.indentchar+" "
  285.  
  286.             text=text+wm.escape(str)
  287.             if (!base64)
  288.                 text=text+"\n"
  289.  
  290.             str=""
  291.         }
  292.  
  293.         output.write(".")
  294.     }
  295.  
  296.     if (str)
  297.     {
  298.         text=text+wm.escape(str)
  299.         if (!base64)
  300.             text=text+"\n"
  301.     }
  302. }
  303. else if (request.command=="4")
  304. {
  305.     // forward email
  306.     subject="Fw: "+folder.message.subject
  307. }
  308. %>
  309. -->
  310. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
  311.  
  312. <FORM NAME="ftgate" METHOD="POST" onSubmit="return isOK(this)" ACTION="deliver.fts">
  313. <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
  314. <INPUT TYPE="HIDDEN" NAME="tocc" VALUE="">
  315. <INPUT TYPE="HIDDEN" NAME="command" VALUE="1">
  316. <INPUT TYPE="HIDDEN" NAME="param1" VALUE="">
  317.  
  318. <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
  319.     <TR>
  320.         <TD>
  321.             <TABLE BORDER="0" WIDTH="100%">
  322.                 <TR>
  323.                     <TH>
  324.                         <%
  325.                         if (ldap.typeof()=="object")
  326.                             output.writeln("<A HREF=\"javascript:onAddress(1)\">To</A>")
  327.                         else
  328.                             output.writeln("To")
  329.                         %>
  330.                     </TH><TD><INPUT TYPE="EDIT" NAME="to" SIZE="<%=size40%>" VALUE="<%=to%>"></TD>
  331.                     <TH ROWSPAN="3" VALIGN="TOP">Priority</TH>
  332.                     <TD ROWSPAN="3" VALIGN="TOP">
  333.                         <SELECT NAME="PRIORITY">
  334.                             <OPTION VALUE="1">High</OPTION>
  335.                             <OPTION VALUE="3" SELECTED>Normal</OPTION>
  336.                             <OPTION VALUE="5">Low</OPTION>
  337.                         </SELECT>
  338.                     </TD>
  339.                 </TR>
  340.                 <TR>
  341.                     <TH>
  342.                         <%
  343.                         if (ldap.typeof()=="object")
  344.                             output.writeln("<A HREF=\"javascript:onAddress(0)\">CC</A>")
  345.                         else
  346.                             output.writeln("CC")
  347.                         %>
  348.                     </TH><TD><INPUT TYPE="EDIT" NAME="cc" SIZE="<%=size40%>" VALUE="<%=cc%>"></TD>
  349.                 </TR>
  350.                 <TR>
  351.                     <TH>Subject</TH><TD><INPUT TYPE="EDIT" NAME="subject" SIZE="<%=size40%>" VALUE="<%=subject%>"></TD>
  352.                 </TR>
  353.                 <TR>
  354.                     <TD COLSPAN="4"><TEXTAREA NAME="body" ROWS="15" COLS="<%=size60%>" CLASS="TEXT100">
  355. <%=text%></TEXTAREA></TD>
  356.                 </TR>
  357.             </TABLE>
  358.         </TD>
  359.     </TR>
  360.     <TR>
  361.         <TD>
  362.             <TABLE CLASS="box" WIDTH="100%">
  363.                 <TR>
  364.                     <TD>
  365.                         <TABLE BORDER="0" WIDTH="100%">
  366.                             <TR>
  367.                                 <TD ALIGN="RIGHT">
  368.                                     <A HREF="javascript:onSend()"
  369.                                     onMouseDown="change('sendA', 'send', 1)"
  370.                                     onMouseOut="change('sendA', 'send', 0)"><IMG SRC="<%=buttons%>send.gif" NAME="sendA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Send message"></A>
  371.                                     <A HREF="javascript:onCancel()"
  372.                                     onMouseDown="change('cancelA', 'cancel', 1)"
  373.                                     onMouseOut="change('cancelA', 'cancel', 0)"><IMG SRC="<%=buttons%>cancel.gif" NAME="cancelA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Cancel message"></A>
  374.                                 </TD>
  375.                             </TR>
  376.                         </TABLE>
  377.                     </TD>
  378.                 </TR>
  379.             </TABLE>
  380.         </TD>
  381.     </TR>
  382. </TABLE>
  383. </FORM>
  384. </TD><TD WIDTH="10"> </TD></TD></TR></TABLE>
  385. </BODY>
  386. </HTML>
  387.