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

  1. <%
  2. #include </utility/security.fts>
  3. #include </utility/global.fts>
  4. #include </utility/theme.fts>
  5. #include </utility/ftgate.fts>
  6.  
  7. var w = new server.web
  8.  
  9. var id
  10.  
  11. session.system.error=0
  12.  
  13. if (form.config=="1")
  14. {
  15.     id = form.id
  16.  
  17.     w.id = id
  18.     w.scripttimeout = form.scripttimeout
  19.  
  20.     if (form.command=="1")
  21.         w.script.add(form.scripturl, form.scriptscript)
  22.     else if (form.command=="2")
  23.         w.script.remove(form.scriptlist)
  24.  
  25.     if (form.redirect!="")
  26.     output.redirect(form.redirect+"?id="+id)
  27. }
  28. else if (form.config=="2")
  29. {
  30.   if (form.redirect!="")
  31.     output.redirect(form.redirect+"?id="+form.id)
  32. }
  33. else
  34. {
  35.     id = request.id
  36.     w.id = id
  37. }
  38. %>
  39. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  40. <HTML>
  41. <HEAD>
  42. <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
  43. <META name="GENERATOR" content="Microsoft Developer Studio">
  44. <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  45. <TITLE>Services -- Web Scripts</TITLE>
  46.  
  47. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  48. <!--
  49. var dir="<%=buttons%>";
  50. var pro=<%=build()==FTGATE_PRO%>;
  51.  
  52. if (!document.images) {}
  53. else {
  54.   create0 = new Image();
  55.   create0.src  = dir+"create.gif";
  56.   create1 = new Image();
  57.   create1.src = dir+"createon.gif";
  58.   delete0 = new Image();
  59.   delete0.src  = dir+"delete.gif";
  60.   delete1 = new Image();
  61.   delete1.src = dir+"deleteon.gif";
  62.   plus0 = new Image();
  63.   plus0.src  = dir+"open.gif";
  64.   plus1 = new Image();
  65.   plus1.src = dir+"openon.gif";
  66.   minus0 = new Image();
  67.   minus0.src  = dir+"close.gif";
  68.   minus1 = new Image();
  69.   minus1.src = dir+"closeon.gif";
  70. }
  71.  
  72. <%
  73. if (netscape)
  74. {
  75.   %>
  76.   document.captureEvents(Event.KEYPRESS);
  77.   document.onkeypress = keypress;
  78.  
  79.   function keypress(event)
  80.   {
  81.     if (event.which==13)
  82.     {
  83.       onAdd(document.ftgate.scripturl, document.ftgate.scriptscript, document.ftgate.scriptlist, 'createA');
  84.       return false;
  85.     }
  86.  
  87.     return true;
  88.   }
  89.   <%
  90. }
  91. else
  92. {
  93.   %>
  94.   function keypress()
  95.   {
  96.     if (event.keyCode==13)
  97.     {
  98.       event.returnValue=null;
  99.       onAdd(document.ftgate.scripturl, document.ftgate.scriptscript, document.ftgate.scriptlist, 'createA');
  100.     }
  101.   }
  102.   <%
  103. }
  104. %>
  105.  
  106. function onLoad()
  107. {
  108.     setPage(5, "Web Service");
  109.  
  110.     onSelect(document.ftgate.scripturl, document.ftgate.scriptscript, document.ftgate.scriptlist)
  111.     document.ftgate.scripttimeout.value = toNicePeriod(<%=w.scripttimeout%>);
  112.  
  113.   document.ftgate.scripturl.focus();
  114. }
  115.  
  116. function isURL(url)
  117. {
  118.     if (url!="")
  119.         return true;
  120.     else
  121.         return false;
  122. }
  123.  
  124. function onAdd(url, script, list, button)
  125. {
  126.     var index=-1;
  127.  
  128.   change(button, 'create', 0);
  129.  
  130.     if (!isURL(url.value))
  131.     {
  132.         alert("Enter a URL of the form '\\folder1\\folder2'.");
  133.         url.focus();
  134.         return;
  135.     }
  136.  
  137.     if (!isScript(script.value))
  138.     {
  139.         alert(errScript);
  140.         script.focus();
  141.         return;
  142.     }
  143.  
  144.     if (list.length)
  145.     {
  146.         var found=false;
  147.         for (i=0; i<list.length; i++)
  148.         {
  149.             if (list.options[i].value == url.value)
  150.             {
  151.                 found=true;
  152.                 break;
  153.             }
  154.         }
  155.  
  156.         if (found)
  157.         {
  158.             alert("This address is already present.")
  159.             return;
  160.         }
  161.     }
  162.  
  163.     if (!isOK(document.ftgate))
  164.         return;
  165.  
  166.     document.ftgate.command.value=1;
  167.     document.ftgate.submit();
  168. }
  169.  
  170. function onDelete(list, button)
  171. {
  172.   change(button, 'delete', 0);
  173.  
  174.     if (!isOK(document.ftgate))
  175.         return;
  176.  
  177.     if (list.selectedIndex!=-1)
  178.     {
  179.         document.ftgate.command.value=2;
  180.         document.ftgate.submit();
  181.     }
  182. }
  183.  
  184. function onSelect(part1, part2, list)
  185. {
  186.     var index = list.selectedIndex;
  187.  
  188.     if (index!=-1)
  189.     {
  190.         var str = list.options[index].text;
  191.         var start = str.indexOf("[");
  192.         var end = str.indexOf("]");
  193.  
  194.         part1.value = str.slice(0, start);
  195.         part2.value = str.slice(start+1,end);
  196.     }
  197. }
  198.  
  199. function isOK(form)
  200. {
  201.     if (!isPeriod(form.scripttimeout.value))
  202.     {
  203.         alert(errPeriod);
  204.         form.scripttimeout.focus();
  205.         return false;
  206.     }
  207.  
  208.     form.scripttimeout.value = fromNicePeriod(form.scripttimeout.value);
  209.  
  210.   return true;
  211. }
  212.  
  213. function onUpEdit()
  214. {
  215.   change('plusA', 'plus', 0);
  216.   onUpPeriod(document.ftgate.scripttimeout);
  217.     setModified(true);
  218. }
  219.  
  220. function onDownEdit()
  221. {
  222.   change('minusA', 'minus', 0);
  223.   onDownPeriod(document.ftgate.scripttimeout, true);
  224.     setModified(true);
  225. }
  226. //-->
  227. </SCRIPT>
  228. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js" TYPE="text/javascript"></SCRIPT>
  229. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js" TYPE="text/javascript"></SCRIPT>
  230. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/time.js" TYPE="text/javascript"></SCRIPT>
  231. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/spin.js" TYPE="text/javascript"></SCRIPT>
  232. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/dialog.js" TYPE="text/javascript"></SCRIPT>
  233. </HEAD>
  234.  
  235. <BODY BGCOLOR="white" onLoad="onLoad()" MARGINHEIGHT="0" MARGINWIDTH="0" onkeypress="keypress()">
  236.  
  237. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="<%=bodywidth%>" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
  238.  
  239. <A HREF="index.fts"><SPAN ID="top">Services</SPAN></A><SPAN ID="top"> /</SPAN>
  240. <SPAN ID="topsel"><%=w.name%></SPAN>
  241.  
  242. <FORM NAME="ftgate" METHOD="POST" onSubmit="return isOK(this)" ACTION="scripts.fts">
  243. <!-- hidden variables -->
  244. <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
  245. <INPUT TYPE="HIDDEN" NAME="command" VALUE="0">
  246.  
  247. <INPUT TYPE="HIDDEN" NAME="id" VALUE="<%=id%>">
  248. <INPUT TYPE="HIDDEN" NAME="redirect" VALUE="">
  249.  
  250. <!-- start of the tabs -->
  251. <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
  252.   <TR>
  253.         <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  254.         <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('http.fts')" CLASS="navoff">General</A></TD>
  255.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  256.         <TD CLASS="navon" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('scripts.fts')" CLASS="navon">Scripts</A></TD>
  257.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  258.         <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('virtuals.fts')" CLASS="navoff">Virtuals</A></TD>
  259.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  260.         <TD CLASS="navoff" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('addresshttp.fts')" CLASS="navoff">Addresses</A></TD>
  261.         <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  262.         <TD WIDTH="<%=bodywidth-223%>" HEIGHT="18"> </TD>
  263.   </TR>
  264. </TABLE>
  265. <!-- end of the tabs -->
  266.  
  267. <!-- start of the tab body -->
  268. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD>
  269. <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
  270. <!-- start of block -->
  271. <TR>
  272. <TD VALIGN="TOP">
  273.   <TABLE BORDER="0" WIDTH="100%">
  274.         <!-- sub table goes here -->
  275.     <TR>
  276.       <TD>
  277.               <TABLE CLASS="box" WIDTH="100%">
  278.                     <TR>
  279.                         <TD>
  280.                             <TABLE BORDER="0" WIDTH="100%">
  281.                                 <TR>
  282.                                     <TD ROWSPAN="2" WIDTH="1%" VALIGN="TOP">
  283.                              <A HREF="javascript:onDelete(document.ftgate.scriptlist, 'deleteA')"
  284.                               onMouseDown="change('deleteA', 'delete', 1)"
  285.                                         onMouseOut="change('deleteA', 'delete', 0)"><IMG SRC="<%=buttons%>delete.gif" NAME="deleteA" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Remove selected script"></A>
  286.                                     </TD>
  287.                                     <TD ROWSPAN="2">
  288.                                         <SELECT NAME="scriptlist" CLASS="SEL100" SIZE="5"
  289.                                             onChange="onSelect(document.ftgate.scripturl, document.ftgate.scriptscript, document.ftgate.scriptlist)">
  290.                                         <%
  291.                                         var first=true
  292.  
  293.                                         var ok=w.script.first()
  294.                                         while (ok)
  295.                                         {
  296.                                             var str = w.script.url+"["+w.script.name+"]"
  297.  
  298.                                             output.write("<OPTION ")
  299.                                             if (first)
  300.                                             {
  301.                                                 first=false
  302.                                                 output.write("SELECTED ")
  303.                                             }
  304.                                             output.writeln("VALUE="+w.script.url+">"+str+"</OPTION>")
  305.                                             ok=w.script.next()
  306.                                         }
  307.                                         %>
  308.                                         </SELECT>
  309.                                     </TD>
  310.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP">URL</TD>
  311.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP"><INPUT TYPE="TEXT" NAME="scripturl" VALUE="" onChange="setModified(true)"></TD>
  312.                                     <TD WIDTH="1%" VALIGN="TOP" ROWSPAN="2">
  313.                              <A HREF="javascript:onAdd(document.ftgate.scripturl, document.ftgate.scriptscript, document.ftgate.scriptlist, 'createA')"
  314.                               onMouseDown="change('createA', 'create', 1)"
  315.                                         onMouseOut="change('createA', 'create', 0)"><IMG SRC="<%=buttons%>create.gif" NAME="createA" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Add script"></A>
  316.                                     </TD>
  317.                                 </TR>
  318.                                 <TR>
  319.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP">Script</TD>
  320.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP"><INPUT TYPE="TEXT" NAME="scriptscript" VALUE="" onChange="setModified(true)"></TD>
  321.                                 </TR>
  322.                                 <TR>
  323.                                     <TD COLSPAN="4">Script timeout
  324.                                         <INPUT TYPE="TEXT" NAME="scripttimeout" VALUE="<%=w.scripttimeout%>" SIZE="6" onChange="setModified(true)">
  325.                                         <A HREF="javascript:onUpEdit()"
  326.                                         onMouseDown="change('plusA', 'plus', 1)"
  327.                                         onMouseOut="change('plusA', 'plus', 0)"><IMG SRC="<%=buttons%>open.gif" NAME="plusA" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Increment"></A>
  328.                                         <A HREF="javascript:onDownEdit()"
  329.                                         onMouseDown="change('minusA', 'minus', 1)"
  330.                                         onMouseOut="change('minusA', 'minus', 0)"><IMG SRC="<%=buttons%>close.gif" NAME="minusA" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Decrement"></A>
  331.                                     </TD>
  332.                                 </TR>
  333.                             </TABLE>
  334.                         </TD>
  335.                     </TR>
  336.                 </TABLE>
  337.             </TD>
  338.         </TR>
  339.         <!-- sub table ends here -->
  340.         <!-- table footer goes here -->
  341.         <TR>
  342.             <TD ALIGN="RIGHT">
  343.                 <A HREF="javascript:onClose()"
  344.                 onMouseDown="change('closeA', 'ok', 1)"
  345.                 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>
  346.                 <A HREF="javascript:onCancel()"
  347.                 onMouseDown="change('cancelA', 'cancel', 1)"
  348.                 onMouseOut="change('cancelA', 'cancel', 0)"><IMG SRC="<%=buttons%>cancel.gif" NAME="cancelA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Cancel"></A>
  349.                 <A HREF="javascript:onApply()"
  350.                 onMouseDown="change('applyA', 'apply', 1)"
  351.                 onMouseOut="change('applyA', 'apply', 0)"><IMG SRC="<%=buttons%>apply.gif" NAME="applyA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Apply changes" HSPACE="5"></A>
  352.             </TD>
  353.         </TR>
  354.         <!-- table footer ends here -->
  355.   </TABLE>
  356. </TD>
  357. </TR>
  358. <!-- end of block -->
  359. </TABLE>
  360. <!-- end of the tab body -->
  361. </TD></TR></TABLE>
  362.  
  363. <!-- footer starts here -->
  364. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  365. <!--
  366.     var href="/services/scripts.fts?id=<%=id%>";
  367.     var bodywidth=<%=bodywidth%>;
  368. //-->
  369. </SCRIPT>
  370. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/footer.js" TYPE="text/javascript"></SCRIPT>
  371. <!-- footer ends here -->
  372. </FORM>
  373. </TD><TD WIDTH="10"> </TD></TR></TABLE>
  374. </BODY>
  375. </HTML>
  376.