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

  1. <%
  2. #include </utility/security.fts>
  3. #include </utility/global.fts>
  4. #include </utility/theme.fts>
  5. #include </utility/ftgate.fts>
  6. #include </utility/asperrors.fts>
  7.  
  8. var s
  9. var id
  10.  
  11. var type
  12. var ok
  13.  
  14. session.system.error=0
  15.  
  16. if (form.config=="1")
  17. {
  18.     type=form.type
  19.  
  20.   if (type=="smtp")
  21.     s = new server.smtp
  22.   else
  23.     s = new server.pop
  24.  
  25.     id = form.id
  26.     s.id=id
  27.  
  28.     type=form.type
  29.  
  30.     if (form.command=="1")
  31.     {
  32.         var names=string(form.names)
  33.         var start=0
  34.         var pos=names.indexof(",",0)
  35.         while (pos!=-1)
  36.         {
  37.         s.domain.add(names.slice(start, pos))
  38.             start=pos+1
  39.             pos=names.indexof(",",start)
  40.         }
  41.     }
  42.     else if (form.command=="2")
  43.     {
  44.         var names=string(form.names)
  45.         var start=0
  46.         var pos=names.indexof(",",0)
  47.         while (pos!=-1)
  48.         {
  49.         s.domain.remove(names.slice(start, pos))
  50.             start=pos+1
  51.             pos=names.indexof(",",start)
  52.         }
  53.     }
  54.  
  55.     if (form.redirect!="")
  56.         output.redirect(form.redirect+"?id="+id+"&type="+type)
  57. }
  58. else if (form.config=="2")
  59. {
  60.   if (form.redirect!="")
  61.         output.redirect(form.redirect+"?id="+form.id+"&type="+form.type)
  62. }
  63. else
  64. {
  65.     type = request.type
  66.  
  67.   if (type=="smtp")
  68.     s = new server.smtp
  69.   else
  70.     s = new server.pop
  71.  
  72.     s.id = request.id
  73.     id = request.id
  74. }
  75.  
  76. var pagetitle
  77.  
  78. if (type=="smtp")
  79.     pagetitle = "SMTP Service"
  80. else
  81.     pagetitle = "POP3 Service"
  82. %>
  83. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  84. <HTML>
  85. <HEAD>
  86. <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
  87. <META name="GENERATOR" content="Microsoft Developer Studio">
  88. <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  89. <TITLE>Services -- <%
  90. if (type=="smtp")
  91.     output.write("SMTP")
  92. if (type=="pop3")
  93.     output.write("POP3")
  94. %> Attached Domains</TITLE>
  95.  
  96. <SCRIPT LANGUAGE="JavaScript1.2">
  97. <!--
  98. var dir="<%=buttons%>";
  99. var pro=<%=build()==FTGATE_PRO%>;
  100.  
  101. if (!document.images) {}
  102. else {
  103.   create0 = new Image();
  104.   create0.src  = dir+"next.gif";
  105.   create1 = new Image();
  106.   create1.src = dir+"nexton.gif";
  107.   delete0 = new Image();
  108.   delete0.src  = dir+"prev.gif";
  109.   delete1 = new Image();
  110.   delete1.src = dir+"prevon.gif";
  111.   clear0 = new Image();
  112.   clear0.src  = dir+"deleteall.gif";
  113.   clear1 = new Image();
  114.   clear1.src = dir+"deleteallon.gif";
  115. }
  116. <%
  117. if (netscape)
  118. {
  119.   %>
  120.   document.captureEvents(Event.KEYPRESS);
  121.   document.onkeypress = keypress;
  122.  
  123.   function keypress(event)
  124.   {
  125.     if (event.which==13)
  126.     {
  127.       if (document.activeElement==document.ftgate.available)
  128.         onAttach();
  129.       else if (document.activeElement==document.ftgate.domains)
  130.         onDetach();
  131.  
  132.       return false;
  133.     }
  134.  
  135.     return true;
  136.   }
  137.   <%
  138. }
  139. else
  140. {
  141.   %>
  142.   function keypress()
  143.   {
  144.     if (event.keyCode==13)
  145.     {
  146.       if (document.activeElement==document.ftgate.available)
  147.         onAttach();
  148.       else if (document.activeElement==document.ftgate.domains)
  149.         onDetach();
  150.  
  151.       event.returnValue=null;
  152.         }
  153.   }
  154.   <%
  155. }
  156. %>
  157.  
  158. function onSubmit()
  159. {
  160.   onAttach();
  161.   return false;
  162. }
  163.  
  164. function onLoad()
  165. {
  166.     setPage(5, "<%=pagetitle%>");
  167.  
  168.     var list = document.ftgate.available
  169.     if (document.ftgate.available.length)
  170.         document.ftgate.available.focus();
  171.     else
  172.         document.ftgate.domains.focus();
  173.  
  174.     <%
  175.     if (session.system.error!=0)
  176.     {
  177.         %>
  178.         window.alert(aspError(<%=session.system.error%>));
  179.         <%
  180.     }
  181.     %>
  182. }
  183.  
  184. function onAttach()
  185. {
  186.   change('addA', 'create', 0);
  187.  
  188.     var list = document.ftgate.available;
  189.     var names = "";
  190.  
  191.     if (list.selectedIndex!=-1)
  192.     {
  193.         var i;
  194.  
  195.         for (i=0; i<list.length; i++)
  196.         {
  197.             if (list.options[i].selected)
  198.             {
  199.                 names+=list.options[i].text;
  200.                 names+=",";
  201.             }
  202.         }
  203.  
  204.         document.ftgate.names.value=names;
  205.         document.ftgate.command.value="1"
  206.         document.ftgate.submit();
  207.     }
  208. }
  209.  
  210. function onDetach()
  211. {
  212.   change('deleteA', 'delete', 0);
  213.  
  214.     var list = document.ftgate.domains;
  215.     var names = "";
  216.  
  217.     if (list.selectedIndex!=-1)
  218.     {
  219.         var i;
  220.  
  221.         for (i=0; i<list.length; i++)
  222.         {
  223.             if (list.options[i].selected)
  224.             {
  225.                 names+=list.options[i].text;
  226.                 names+=",";
  227.             }
  228.         }
  229.  
  230.         document.ftgate.names.value=names;
  231.         document.ftgate.command.value="2"
  232.         document.ftgate.submit();
  233.     }
  234. }
  235.  
  236. function isOK(form)
  237. {
  238.     return true;
  239. }
  240. //-->
  241. </SCRIPT>
  242. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js"></SCRIPT>
  243. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js"></SCRIPT>
  244. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/time.js"></SCRIPT>
  245. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/spin.js"></SCRIPT>
  246. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/dialog.js"></SCRIPT>
  247. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/asperrors.js" TYPE="text/javascript"></SCRIPT>
  248. </HEAD>
  249.  
  250. <BODY BGCOLOR="white" onLoad="onLoad()" MARGINHEIGHT="0" MARGINWIDTH="0" onkeypress="keypress()">
  251.  
  252. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="<%=bodywidth%>" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
  253.  
  254. <A HREF="index.fts"><SPAN ID="top">Services</SPAN></A><SPAN ID="top"> /</SPAN>
  255. <SPAN ID="topsel"><%=s.name%></SPAN>
  256.  
  257. <FORM NAME="ftgate" METHOD="POST" onSubmit="return onSubmit()" ACTION="attached.fts">
  258. <!-- hidden variables -->
  259. <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
  260. <INPUT TYPE="HIDDEN" NAME="command" VALUE="0">
  261. <INPUT TYPE="HIDDEN" NAME="id" VALUE="<%=id%>">
  262. <INPUT TYPE="HIDDEN" NAME="type" VALUE="<%=type%>">
  263. <INPUT TYPE="HIDDEN" NAME="names" VALUE="">
  264. <INPUT TYPE="HIDDEN" NAME="redirect" VALUE="">
  265.  
  266. <!--- start of the tabs ---->
  267. <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
  268.   <TR>
  269.     <%
  270.     if (type=="smtp")
  271.     {
  272.       %>
  273.             <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  274.             <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('smtp.fts')" CLASS="navoff">General</A></TD>
  275.             <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  276.             <TD CLASS="navon" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('attached.fts')" CLASS="navon">Domains</A></TD>
  277.             <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  278.             <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('securitysmtp.fts')" CLASS="navoff">Security</A></TD>
  279.             <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  280.             <TD CLASS="navoff" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('addresssmtp.fts')" CLASS="navoff">Addresses</A></TD>
  281.             <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  282.             <TD WIDTH="<%=bodywidth-223%>" HEIGHT="18"> </TD>
  283.       <%
  284.     }
  285.     else
  286.     {
  287.       %>
  288.             <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  289.             <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('pop3.fts')" CLASS="navoff">General</A></TD>
  290.             <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  291.             <TD CLASS="navon" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('attached.fts')" CLASS="navon">Domains</A></TD>
  292.             <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  293.             <TD CLASS="navoff" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('addresspop3.fts')" CLASS="navoff">Addresses</A></TD>
  294.             <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  295.             <TD WIDTH="<%=bodywidth-167%>" HEIGHT="18"> </TD>
  296.       <%
  297.     }
  298.     %>
  299.   </TR>
  300. </TABLE>
  301. <!--- end of the tabs ----->
  302.  
  303. <!--- start of the tab body --->
  304. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD>
  305. <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
  306. <!----- start of block --->
  307. <TR>
  308. <TD VALIGN="TOP">
  309.   <TABLE BORDER="0" WIDTH="100%">
  310.         <!----- sub table goes here --->
  311.          <TR>
  312.             <TD>
  313.                 <TABLE CLASS="box" WIDTH="100%">
  314.                     <TR>
  315.                         <TD>
  316.                             <TABLE BORDER="0" WIDTH="100%">
  317.                                 <TR>
  318.                                     <TH>Available domains</TH>
  319.                                     <TD> </TD>
  320.                                     <%
  321.                                     if (type=="smtp")
  322.                                         output.writeln("<TH>Only accept mail for the following domains</TH>")
  323.                                     else
  324.                                         output.writeln("<TH>Only handle mail for the following domains</TH>")
  325.                                     %>
  326.                                 </TR>
  327.                                 <TR>
  328.                                     <TD NOWRAP VALIGN="TOP">
  329.                                         <SELECT SIZE="10" NAME="available" MULTIPLE CLASS="SEL100">
  330.                                         <%
  331.                                         var avail = false
  332.                                         var d = new server.domain
  333.                                         var domOK = d.findfirst("*")
  334.                                         var first=true
  335.  
  336.                                         while (domOK)
  337.                                         {
  338.                                             if ((d.description=="Local")||(d.description=="Remote"))
  339.                                             {
  340.                                                 var found = false
  341.                                                 ok=s.domain.first()
  342.                                                 if (d.domainname!="internet")
  343.                                                 {
  344.                                                     while (ok)
  345.                                                     {
  346.                                                         if ((d.domainname==s.domain.name)||)
  347.                                                         {
  348.                                                             found = true
  349.                                                             break
  350.                                                         }
  351.  
  352.                                                         ok=s.domain.next()
  353.                                                     }
  354.  
  355.                                                     if (!found)
  356.                                                     {
  357.                                                         avail=true
  358.                                                         output.write("<OPTION VALUE=\""+d.domainname+"\"")
  359.                                                         if (first)
  360.                                                         {
  361.                                                             output.write(" SELECTED>")
  362.                                                             first=false
  363.                                                         }
  364.                                                         else
  365.                                                             output.write(">")
  366.  
  367.                                                         output.writeln(d.domainname+"</OPTION>")
  368.                                                     }
  369.                                                 }
  370.                                             }
  371.  
  372.                                             domOK=d.findnext()
  373.                                         }
  374.  
  375.                                         if (first)
  376.                                             output.writeln("<OPTION VALUE=\"\">Empty List</OPTION>")
  377.                                         %>
  378.                                         </SELECT>
  379.                                     </TD>
  380.                                     <TD VALIGN="TOP" ALIGN="CENTER">
  381.                                         <%
  382.                                         if (avail)
  383.                                         {
  384.                                             %>
  385.                                             <A onMouseDown="change('addA','create',1)" onMouseOut="change('addA','create',0)" HREF="javascript:onAttach()">
  386.                                             <IMG SRC="<%=buttons%>next.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="addA" ALT="Assign Domain"></A><P>
  387.                                             <%
  388.                                         }
  389.                                         else
  390.                                         {
  391.                                             %>
  392.                                             <IMG SRC="<%=buttons%>nextoff.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="addA" ALT="Assign Domain"><P>
  393.                                             <%
  394.                                         }
  395.                                         if (s.domain.first())
  396.                                         {
  397.                                             %>
  398.                                             <A onMouseDown="change('deleteA','delete',1)" onMouseOut="change('deleteA','delete',0)"
  399.                                             HREF="javascript:onDetach()"><IMG SRC="<%=buttons%>prev.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="deleteA" ALT="Remove Domain"></A>
  400.                                             <%
  401.                                         }
  402.                                         else
  403.                                         {
  404.                                             %>
  405.                                             <IMG SRC="<%=buttons%>prevoff.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="deleteA" ALT="Remove Domain"></A>
  406.                                             <%
  407.                                         }
  408.                                         %>
  409.                                     </TD>
  410.                                     <TD>
  411.                                         <SELECT NAME="domains" SIZE="10" MULTIPLE CLASS="SEL100">
  412.                                             <%
  413.                                             first=true
  414.                                             ok=s.domain.first()
  415.                                             while (ok)
  416.                                             {
  417.                                                 output.writeln("<OPTION VALUE=\""+s.domain.name+"\"")
  418.  
  419.                                                 if (first)
  420.                                                 {
  421.                                                     output.write(" SELECTED>")
  422.                                                     first=false
  423.                                                 }
  424.                                                 else
  425.                                                     output.write(">")
  426.  
  427.                                                 output.writeln(s.domain.name+"</OPTION>")
  428.  
  429.                                                 ok=s.domain.next()
  430.                                             }
  431.  
  432.                                             if (first)
  433.                                                 output.writeln("<OPTION VALUE=\"\">All Hosted Domains</OPTION>")
  434.                                             %>
  435.                                         </SELECT>
  436.                                     </TD>
  437.                                 </TR>
  438.                             </TABLE>
  439.                         </TD>
  440.                     </TR>
  441.                 </TABLE>
  442.             </TD>
  443.         </TR>
  444.         <!----- sub table ends here --->
  445.         <!----- table footer goes here --->
  446.         <TR>
  447.             <TD ALIGN="RIGHT">
  448.                 <A HREF="javascript:onClose()"
  449.                 onMouseDown="change('closeA', 'ok', 1)"
  450.                 onMouseOut="change('closeA', 'ok', 0)"><IMG SRC="<%=buttons%>ok.gif" NAME="closeA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Save and Close" HSPACE="5"></A>
  451.             </TD>
  452.         </TR>
  453.         <!----- table footer ends here --->
  454.   </TABLE>
  455. </TD>
  456. </TR>
  457. <!------ end of block ----->
  458. </TABLE>
  459. <!--- end of the tab body --->
  460. </TD></TR></TABLE>
  461.  
  462. <!--- footer starts here --->
  463. <SCRIPT LANGUAGE="JavaScript1.2">
  464. <!--
  465.     var href="/services/attached.fts?id=<%=id%>&type=<%=type%>";
  466.     var bodywidth=<%=bodywidth%>;
  467. //-->
  468. </SCRIPT>
  469. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/footer.js"></SCRIPT>
  470. <!--- footer ends here --->
  471. </FORM>
  472. </TD><TD WIDTH="10"> </TD></TD></TR></TABLE>
  473. </BODY>
  474. </HTML>
  475.