home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 9 / IOPROG_9.ISO / contrib / iis4 / ins.cab / nnadved.asp < prev    next >
Encoding:
Text File  |  1997-08-23  |  6.6 KB  |  263 lines

  1. <% Response.Expires = 0 %>
  2.  
  3. <% REM Advanced Page add/edit pop-up window %>
  4.  
  5. <% REM Get variables %>
  6. <% REM svr = Server name %>
  7. <% REM a = Action to be performed by server-side code (add,save,new,edit) %>
  8. <% REM SecListTypeGranted = Access type %>
  9. <% REM SecAddress = IP address %>
  10. <% REM SecMask = Subnet mask %>
  11.  
  12. <% svr = Request("svr") %>
  13. <% a = Request("a") %>
  14. <% SecListTypeGranted = Request("SecListTypeGranted") %>
  15. <% SecAddress = Request("SecAddress") %>
  16. <% SecMask = Request("SecMask") %>
  17.  
  18.  
  19. <!--#include file="_cnst.asp" -->
  20.  
  21. <% if (cont = true) then %>
  22.  
  23. <HTML>
  24. <HEAD>
  25. <SCRIPT LANGUAGE="javascript">
  26.  
  27.     <% REM Javascript function onOK submits form when "OK" link is clicked %>
  28.  
  29.     function onOk() 
  30.     {
  31.         <% if (a = "new") then %>
  32.             document.userform.a.value = "add";
  33.         <% else %>
  34.             document.userform.a.value = "save";
  35.         <% end if %>
  36.             document.userform.submit();
  37.     }
  38.  
  39.  
  40.     <% REM Javascript function maintainChk fills/clears "Mask" field accordingly when "Group" radio is clicked %>
  41.  
  42.     function maintainChk(group) 
  43.     {
  44.         if (group) 
  45.         {
  46.             if (document.userform.hdnSecMask.value != "255.255.255.255") 
  47.             { 
  48.                 document.userform.txtSecMask.value = document.userform.hdnSecMask.value;
  49.             }
  50.             document.userform.txtSecMask.focus();
  51.         }
  52.         else 
  53.         {
  54.             document.userform.txtSecMask.value = "";
  55.         }
  56.     }
  57.  
  58.  
  59.     <% REM Javascript function maintainTxt checks "Groups" radio button when "Mask" field is filled %>
  60.  
  61.     function maintainTxt()
  62.     {
  63.         document.userform.hdnSecMask.value = document.userform.txtSecMask.value;
  64.         if (!(document.userform.rdoSecAddressType[1].checked)) 
  65.         {
  66.             document.userform.rdoSecAddressType[1].checked = true;
  67.         }
  68.     }
  69.  
  70. </SCRIPT>
  71. <TITLE><% if (SecListTypeGranted = "0") then %>Deny <% else %>Grant <% end if %>Access On</TITLE>
  72. </HEAD>
  73.  
  74. <% REM Perform actions %>
  75.  
  76. <% if ((a = "add") OR (a = "save"))then %>
  77.  
  78.     <% set nntp = Server.CreateObject("MSWC.Nntp") %>
  79.  
  80.     <% txtSecAddress = Request("txtSecAddress") %>
  81.     <% txtSecMask = Request("txtSecMask") %>
  82.  
  83.     <% if (a = "add") then %>
  84.  
  85.         <% if (SecListTypeGranted = "0") then %>
  86.             <% nntp.SecTypeGranted = FALSE %>
  87.         <% else %>
  88.             <% nntp.SecTypeGranted = TRUE %>
  89.         <% end if %>
  90.  
  91.         <% nntp.SecAddress = txtSecAddress %>
  92.     
  93.         <% if (Request("rdoSecAddressType") = "single") then %>
  94.             <% nntp.SecMask = "255.255.255.255" %>
  95.         <% else %>
  96.             <% nntp.SecMask = txtSecMask %>
  97.         <% end if %>
  98.  
  99.         <% error = nntp.SecAdd %>
  100.     
  101.     <% elseif (a = "save") then %>
  102.  
  103.         <% error = nntp.SecEnumerate %>
  104.  
  105.         <% if (SecListTypeGranted = "0") then %>
  106.             <% nntp.SecTypeGranted = FALSE %>
  107.         <% else %>
  108.             <% nntp.SecTypeGranted = TRUE %>
  109.         <% end if %>
  110.  
  111.         <% nntp.SecAddress = Request("hdnSecAddress") %>
  112.         <% error = nntp.SecGetInfo %>
  113.  
  114.         <% nntp.SecAddress = txtSecAddress %>
  115.  
  116.         <% if (Request("rdoSecAddressType") = "single") then %>
  117.             <% nntp.SecMask = "255.255.255.255" %>
  118.         <% else %>
  119.             <% nntp.SecMask = txtSecMask %>
  120.         <% end if %>
  121.  
  122.         <% error = nntp.SecSetInfo %>
  123.  
  124.     <% end if %>
  125.  
  126.     <% if (error <> 0) then %>
  127.             <SCRIPT LANGUAGE="javascript">
  128.                     alert("<% = nntp.ErrorToString (error) %>");
  129.                self.location = "nnadved.asp?svr=<% = svr %>&SecAddress=<% = hdnSecAddress %>&SecMask=<% = txtSecMask %>";
  130.                </SCRIPT>    
  131.     <% else %>
  132.         <SCRIPT LANGUAGE="javascript">
  133.                 opener.location = "nnadvhd.asp?svr=<% = svr %>";
  134.                 self.close();
  135.         </SCRIPT>
  136.     <% end if %>
  137.     
  138. <% elseif (a = "new") then %>
  139.  
  140.     <% rdoSecAddressType = "single" %>
  141.  
  142. <% elseif (a = "edit") then %>
  143.  
  144.     <% if (SecMask = "255.255.255.255") then %>
  145.         <% rdoSecAddressType = "single" %>
  146.     <% else %>
  147.         <% rdoSecAddressType = "group" %>
  148.     <% end if %>
  149.         
  150. <% end if %>
  151.  
  152.  
  153. <BODY BGCOLOR="#000000" TEXT="#000000" TOPMARGIN=15 LINK="#000000" VLINK="#000000" ALINK="#000000">
  154.  
  155. <FORM NAME="userform" ACTION="nnadved.asp" onSubmit="return false;" METHOD="post">
  156.  
  157. <INPUT TYPE="hidden" NAME="svr" VALUE="<% = svr %>">
  158. <INPUT TYPE="hidden" NAME="SecListTypeGranted" VALUE="<% = SecListTypeGranted %>">
  159. <INPUT TYPE="hidden" NAME="a" VALUE="<% = a %>">
  160.  
  161. <P>
  162. <TABLE BORDER=1 BGCOLOR="#CCCCCC" WIDTH=100% CELLPADDING=10>
  163.  
  164. <TR><TD>
  165.  
  166.     <FONT SIZE=2 FACE="Arial">
  167.  
  168.     <B><IMG SRC="images/gnicttl.gif" ALIGN="textmiddle" HEIGHT=10 WIDTH=10> <% if (SecListTypeGranted = "0") then %>Deny <% else %>Grant <% end if %>Access On</B>
  169.  
  170.     <% if (rdoSecAddressType = "single") then %>
  171.         <P><INPUT NAME="rdoSecAddressType" TYPE="radio" onClick="maintainChk(false);" VALUE="single" CHECKED>Single computer
  172.         <P><INPUT NAME="rdoSecAddressType" TYPE="radio" onClick="maintainChk(true);" VALUE="group">Group of computers 
  173.     <% else %>
  174.         <P><INPUT NAME="rdoSecAddressType" TYPE="radio" onClick="maintainChk(false);" VALUE="single">Single computer
  175.         <P><INPUT NAME="rdoSecAddressType" TYPE="radio" onClick="maintainChk(true);" VALUE="group" CHECKED>Group of computers 
  176.     <% end if %>
  177.  
  178.     <P>
  179.     <TABLE WIDTH=250>
  180.     
  181.         <TR>
  182.             <TD WIDTH=125><FONT SIZE=2 FACE="Arial">IP address:</TD>
  183.             <TD WIDTH=125><INPUT NAME="txtSecAddress" TYPE="text" VALUE="<% = SecAddress %>" SIZE=15></TD>
  184.                 <INPUT NAME="hdnSecAddress" TYPE="hidden" VALUE="<% = SecAddress %>">
  185.         </TR>
  186.  
  187.         <TR>
  188.             <TD HEIGHT=4 COLSPAN=2></TD>
  189.         </TR>
  190.     
  191.         <TR>
  192.             <TD WIDTH=125><FONT SIZE=2 FACE="Arial">Subnet mask:</TD>
  193.     
  194.             <% if (SecMask <> "255.255.255.255") then %>
  195.                 <TD WIDTH=125><INPUT NAME="txtSecMask" TYPE="text" VALUE="<% = SecMask %>" SIZE=15 onChange="maintainTxt();">
  196.             <% else %>
  197.                 <TD WIDTH=125><INPUT NAME="txtSecMask" TYPE="text" VALUE="" SIZE=15 onChange="maintainTxt();">
  198.             <% end if %>
  199.                     <INPUT TYPE="hidden" NAME="hdnSecMask" VALUE="<% = SecMask %>">
  200.                 </TD>
  201.  
  202.         </TR>
  203.  
  204. </TABLE>
  205.  
  206. </TD></TR>
  207.  
  208. </TABLE>
  209.  
  210. <P>
  211. <TABLE ALIGN="right" CELLPADDING=1 CELLSPACING=1>
  212.  
  213. <TR>
  214.  
  215.     <TD><TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
  216.  
  217.         <TR>
  218.                 
  219.             <TD VALIGN="middle">
  220.                 <FONT FACE="Arial" SIZE=2>
  221.                 <B><A HREF="javascript:onOk();">
  222.                 <IMG SRC="images/gnicok.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
  223.                 <A HREF="javascript:onOk();">OK</A></B>
  224.                 </FONT>
  225.             </TD>    
  226.  
  227.         </TR>
  228.         
  229.     </TABLE></TD>
  230.  
  231.     <P>
  232.     <TD><TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
  233.  
  234.         <TR>
  235.                 
  236.             <TD VALIGN="middle">
  237.                 <FONT FACE="Arial" SIZE=2>
  238.                 <B><A HREF="javascript:close();">
  239.                 <IMG SRC="images/gniccncl.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
  240.                 <A HREF="javascript:close();">Cancel</A></B>
  241.                 </FONT>
  242.             </TD>    
  243.  
  244.         </TR>
  245.         
  246.     </TABLE></TD>
  247.  
  248.     <TD> </TD>
  249.  
  250. </TR>
  251.  
  252. </TABLE>
  253.  
  254. </TD></TR>
  255.  
  256. </TABLE>
  257.     
  258. </FORM>
  259.  
  260. </BODY>
  261. </HTML>
  262.  
  263. <% end if %>