home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / windowsxp / ftgateoffice / ftgateoffice.exe / Main / schedules.fts < prev    next >
Encoding:
Text File  |  2001-11-29  |  10.4 KB  |  388 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 = new server.smartpop
  9. var sched = new server.schedule
  10.  
  11. session.system.error = 0
  12.  
  13. if (form.config=="1")
  14. {
  15.     s.id=form.id
  16.  
  17.     if (form.command==1)
  18.     {
  19.         var names=string(form.names)
  20.         var start=0
  21.         var pos=names.indexof(",",0)
  22.         while (pos!=-1)
  23.         {
  24.             s.schedule.add(names.slice(start, pos))
  25.             start=pos+1
  26.             pos=names.indexof(",",start)
  27.         }
  28.     }
  29.     else if (form.command==2)
  30.     {
  31.         var names=string(form.names)
  32.         var start=0
  33.         var pos=names.indexof(",",0)
  34.         while (pos!=-1)
  35.         {
  36.             s.schedule.remove(names.slice(start, pos))
  37.             start=pos+1
  38.             pos=names.indexof(",",start)
  39.         }
  40.     }
  41.  
  42.   if (form.redirect!="")
  43.     output.redirect(form.redirect+"?id="+s.id)
  44. }
  45. else if (form.config=="2")
  46. {
  47.   if (form.redirect!="")
  48.     output.redirect(form.redirect+"?id="+form.id)
  49. }
  50. else
  51. {
  52.     s.id=request.id
  53. }
  54. %>
  55. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  56. <HTML>
  57. <HEAD>
  58. <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
  59. <META name="GENERATOR" content="Microsoft Developer Studio">
  60. <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  61. <TITLE>SmartPops -- Assigned Schedules</TITLE>
  62.  
  63. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  64. <!--
  65. var dir="<%=buttons%>";
  66. var pro=<%=build()==FTGATE_PRO%>;
  67.  
  68. if (!document.images) {}
  69. else {
  70.   create0 = new Image();
  71.   create0.src  = dir+"next.gif";
  72.   create1 = new Image();
  73.   create1.src = dir+"nexton.gif";
  74.   delete0 = new Image();
  75.   delete0.src  = dir+"prev.gif";
  76.   delete1 = new Image();
  77.   delete1.src = dir+"prevon.gif";
  78.   clear0 = new Image();
  79.   clear0.src  = dir+"deleteall.gif";
  80.   clear1 = new Image();
  81.   clear1.src = dir+"deleteallon.gif";
  82. }
  83.  
  84. <%
  85. if (netscape)
  86. {
  87.   %>
  88.   document.captureEvents(Event.KEYPRESS);
  89.   document.onkeypress = keypress;
  90.  
  91.   function keypress(event)
  92.   {
  93.     if (event.which==13)
  94.     {
  95.       if (document.activeElement==document.ftgate.available)
  96.         onAddSchedule();
  97.       else if (document.activeElement==document.ftgate.schedules)
  98.         onDelete();
  99.  
  100.       return false;
  101.     }
  102.  
  103.     return true;
  104.   }
  105.   <%
  106. }
  107. else
  108. {
  109.   %>
  110.   function keypress()
  111.   {
  112.     if (event.keyCode==13)
  113.     {
  114.       if (document.activeElement==document.ftgate.available)
  115.         onAddSchedule();
  116.       else if (document.activeElement==document.ftgate.schedules)
  117.         onDelete();
  118.  
  119.       event.returnValue=null;
  120.     }
  121.   }
  122.   <%
  123. }
  124. %>
  125.  
  126. function onLoad()
  127. {
  128.     setPage(6, "SmartPops");
  129.     <%
  130.     if (session.system.error!=0)
  131.     {
  132.         %>
  133.         window.alert(aspError(<%=session.system.error%>)+" (<%=s.name%>)");
  134.         <%
  135.     }
  136.     %>
  137.  
  138.     var list = document.ftgate.available
  139.     if (document.ftgate.available.length)
  140.         document.ftgate.available.focus();
  141.     else
  142.         document.ftgate.schedules.focus();
  143. }
  144.  
  145. function onAddSchedule()
  146. {
  147.     change('addA', 'create', 0);
  148.  
  149.     var list = document.ftgate.available;
  150.     var names = "";
  151.  
  152.     if (list.selectedIndex!=-1)
  153.     {
  154.         var i;
  155.  
  156.         for (i=0; i<list.length; i++)
  157.         {
  158.             if (list.options[i].selected)
  159.             {
  160.                 names+=list.options[i].text;
  161.                 names+=",";
  162.             }
  163.         }
  164.  
  165.         document.ftgate.names.value=names;
  166.         document.ftgate.command.value="1"
  167.         document.ftgate.submit();
  168.     }
  169. }
  170.  
  171. function isOK()
  172. {
  173.     return true;
  174. }
  175.  
  176. function onDelete()
  177. {
  178.  
  179.     change("deleteA", "delete", 0);
  180.  
  181.     var list = document.ftgate.schedules
  182.     var names = "";
  183.     var count = 0;
  184.  
  185.     if (list.selectedIndex!=-1)
  186.     {
  187.         var i;
  188.  
  189.         for (i=0; i<list.length; i++)
  190.         {
  191.             if (list.options[i].selected)
  192.             {
  193.                 names+=list.options[i].text;
  194.                 names+=",";
  195.                 count++;
  196.             }
  197.         }
  198.  
  199.         if (count==list.length)
  200.         {
  201.             alert("You cannot remove all of the assigned schedules. At least one schedule must remain in the list.");
  202.             return;
  203.         }
  204.  
  205.         document.ftgate.names.value=names;
  206.         document.ftgate.command.value="2"
  207.         document.ftgate.submit();
  208.     }
  209.  
  210. }
  211.  
  212. //-->
  213. </SCRIPT>
  214. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js" TYPE="text/javascript"></SCRIPT>
  215. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js" TYPE="text/javascript"></SCRIPT>
  216. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/spin.js" TYPE="text/javascript"></SCRIPT>
  217. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/time.js" TYPE="text/javascript"></SCRIPT>
  218. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/dialog.js" TYPE="text/javascript"></SCRIPT>
  219. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/asperrors.js" TYPE="text/javascript"></SCRIPT>
  220. </HEAD>
  221.  
  222. <BODY BGCOLOR="white" onLoad="onLoad()" MARGINHEIGHT="0" MARGINWIDTH="0" onkeypress="keypress()">
  223.  
  224. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="<%=bodywidth%>" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
  225.  
  226. <A HREF="index.fts"><SPAN ID="top">SmartPops</SPAN></A><SPAN ID="top"> /</SPAN>
  227. <SPAN ID="topsel"><%=s.name%></SPAN>
  228.  
  229. <FORM NAME="ftgate" METHOD="POST" onSubmit="return isOK(this)" ACTION="schedules.fts">
  230. <!-- hidden variables -->
  231. <INPUT TYPE="HIDDEN" NAME="name" VALUE="<%=s.name%>">
  232. <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
  233. <INPUT TYPE="HIDDEN" NAME="command" VALUE="0">
  234. <INPUT TYPE="HIDDEN" NAME="id" VALUE="<%=s.id%>">
  235. <INPUT TYPE="HIDDEN" NAME="assigned" VALUE="">
  236. <INPUT TYPE="HIDDEN" NAME="names" VALUE="">
  237. <INPUT TYPE="HIDDEN" NAME="redirect" VALUE="">
  238.  
  239. <!-- start of the tabs -->
  240. <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
  241.   <TR>
  242.         <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  243.         <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('smartpop.fts')" CLASS="navoff">General</A></TD>
  244.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  245.         <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('settings.fts')" CLASS="navoff">Settings</A></TD>
  246.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  247.         <TD CLASS="navon" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('schedules.fts')" CLASS="navon">Schedules</A></TD>
  248.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  249.         <TD CLASS="navoff" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('rules.fts')" CLASS="navoff">Rules</A></TD>
  250.         <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  251.         <TD WIDTH="<%=bodywidth-223%>" HEIGHT="18"> </TD>
  252.   </TR>
  253. </TABLE>
  254. <!-- end of the tabs -->
  255.  
  256. <!-- start of the tab body -->
  257. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD>
  258. <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
  259. <!-- start of block -->
  260. <TR>
  261. <TD VALIGN="TOP">
  262.   <TABLE BORDER="0" WIDTH="100%">
  263.         <!-- sub table goes here -->
  264.     <TR>
  265.       <TD>
  266.               <TABLE CLASS="box" WIDTH="100%">
  267.                     <TR>
  268.                         <TD>
  269.                             <TABLE BORDER="0" WIDTH="100%">
  270.                                 <TR>
  271.                                     <TH>Available schedules</TH>
  272.                                     <TD> </TD>
  273.                                     <TH>Assigned schedules</TH>
  274.                                 </TR>
  275.                                 <TR>
  276.                                     <TD NOWRAP VALIGN="TOP">
  277.                                         <SELECT SIZE="10" NAME="available" MULTIPLE CLASS="SEL100">
  278.                                         <%
  279.                                         var avail = false
  280.  
  281.                                         var ok=sched.first()
  282.                                         while (ok)
  283.                                         {
  284.                                             var found = false
  285.                                             var ok2=s.schedule.first()
  286.                                             while (ok2)
  287.                                             {
  288.                                                 if (sched.name==s.schedule.name)
  289.                                                     found = true
  290.  
  291.                                                 ok2=s.schedule.next()
  292.                                             }
  293.  
  294.                                             if (!found)
  295.                                             {
  296.                                                 avail=true
  297.                                                 %>
  298.                                                 <OPTION VALUE="<%=sched.name%>"><%=sched.name%></OPTION>
  299.                                                 <%
  300.                                             }
  301.                                             ok=sched.next()
  302.                                         }
  303.                                         %>
  304.                                         </SELECT>
  305.                                     </TD>
  306.                                     <TD VALIGN="TOP" ALIGN="CENTER">
  307.                                         <%
  308.                                         if (avail)
  309.                                         {
  310.                                             %>
  311.                                             <A onMouseDown="change('addA','create',1)" onMouseOut="change('addA','create',0)" HREF="javascript:onAddSchedule()">
  312.                                             <IMG SRC="<%=buttons%>next.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="addA" ALT="Assign schedule"></A><P>
  313.                                             <%
  314.                                         }
  315.                                         else
  316.                                         {
  317.                                             %>
  318.                                             <IMG SRC="<%=buttons%>nextoff.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="addA" ALT="Assign schedule"><P>
  319.                                             <%
  320.                                         }
  321.                                         if (s.schedule.first())
  322.                                         {
  323.                                             %>
  324.                                             <A onMouseDown="change('deleteA','delete',1)" onMouseOut="change('deleteA','delete',0)"
  325.                                             HREF="javascript:onDelete()"><IMG SRC="<%=buttons%>prev.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="deleteA" ALT="Remove schedule"></A>
  326.                                             <%
  327.                                         }
  328.                                         else
  329.                                         {
  330.                                             %>
  331.                                             <IMG SRC="<%=buttons%>prevoff.gif" WIDTH="40" HEIGHT="20" BORDER="0" NAME="deleteA" ALT="Remove schedule"></A>
  332.                                             <%
  333.                                         }
  334.                                         %>
  335.                                     </TD>
  336.                                     <TD>
  337.                                         <SELECT NAME="schedules" SIZE="10" MULTIPLE CLASS="SEL100">
  338.                                             <%
  339.                                             ok=s.schedule.first()
  340.                                             while (ok)
  341.                                             {
  342.                                                 %>
  343.                                                 <OPTION VALUE="<%=s.schedule.name%>"><%=s.schedule.name%></OPTION>
  344.                                                 <%
  345.                                                 ok=s.schedule.next()
  346.                                             }
  347.                                             %>
  348.                                         </SELECT>
  349.                                     </TD>
  350.                                 </TR>
  351.                             </TABLE>
  352.                         </TD>
  353.                     </TR>
  354.                 </TABLE>
  355.             </TD>
  356.         </TR>
  357.         <!-- sub table ends here -->
  358.         <!-- sub table goes here -->
  359.         <TR>
  360.             <TD ALIGN="RIGHT">
  361.                 <A HREF="javascript:onClose()"
  362.                 onMouseDown="change('closeA', 'ok', 1)"
  363.                 onMouseOut="change('closeA', 'ok', 0)"><IMG SRC="<%=buttons%>ok.gif" NAME="closeA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Apply changes and close" HSPACE="5"></A>
  364.             </TD>
  365.         </TR>
  366.         <!-- sub table ends here -->
  367.   </TABLE>
  368. </TD>
  369. </TR>
  370. <!-- end of block -->
  371. </TABLE>
  372. <!-- end of the tab body -->
  373. </TD></TR></TABLE>
  374.  
  375. <!-- footer starts here -->
  376. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  377. <!--
  378.     var href="/smartpop/schedules.fts?id=<%=s.id%>";
  379.     var bodywidth=<%=bodywidth%>;
  380. //-->
  381. </SCRIPT>
  382. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/footer.js" TYPE="text/javascript"></SCRIPT>
  383. <!-- footer ends here -->
  384. </FORM>
  385. </TD><TD WIDTH="10"> </TD></TR></TABLE>
  386. </BODY>
  387. </HTML>
  388.