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

  1. <% Response.Expires = 0 %>
  2.  
  3. <% a = Request("a") %>
  4. <% svr = Request("svr") %>
  5. <% 
  6. rem BEGIN LOCALIZATION
  7.  
  8. L_STARTED        = 2
  9. L_ADD_EXPIRATION_TXT        = "Add Expiration Policy"
  10. L_NO_SERVICE_TXT            = "The NNTP Service is not started, You must start the service before you can add an Expiration Policy."
  11.  
  12.  
  13. REM END LOCALIZATION
  14. %>
  15. <!--#include file="_cnst.asp" -->
  16.  
  17. <% if (cont = true) then %>
  18.  
  19. <% REM Create Nntp admin object To check to see if the service is running%>
  20.  
  21. <% On Error Resume Next %>
  22. <% Set Admin = Server.CreateObject("NntpAdm.Admin.1") %>
  23. <% if Err <> 0 then %>
  24.     <script language="javascript>
  25.         alert("<% = Err.description %> : Line #42");
  26.     </script>
  27. <% end if %>
  28.  
  29. <% On Error Resume Next %>
  30. <% set nntpService = Server.CreateObject("Nntpadm.VirtualServer.1") %>
  31. <% if (Err <> 0 ) then %>    
  32.     <script language="javascript">
  33.         alert("<% = L_SERVICE_ERROR%><%  = Err.description %>");
  34.     </script>
  35. <% end if %>
  36.  
  37. <% REM Set nntp Service Server %>
  38. <% On Error Resume Next %>
  39. <% nntpService.Server = svr %>
  40. <% if (Err <> 0 ) then %>    
  41.     <script language="javascript">
  42.         alert("<% = L_SERVICE_ERROR%><%  = Err.description %>");
  43.     </script>
  44. <% end if %>
  45.  
  46. <% REM Set nntp Service Service Instance %>
  47. <% On Error Resume Next %>
  48. <% nntpService.ServiceInstance = Session("ServiceInstance") %>
  49. <% if (Err <> 0 ) then %>    
  50.     <script language="javascript">
  51.         alert("<% = L_SERVICE_ERROR%><%  = Err.description %>");
  52.     </script>
  53. <% end if %>
  54.  
  55.  
  56. <% nntpService.Get %>
  57. <% ServerState = nntpService.State %>
  58.  
  59. <% if (ServerState <> L_STARTED) then %>
  60.     <script language="javascript">
  61.         alert("<% = L_NO_SERVICE_TXT %>");
  62.         self.close();
  63.     </script>
  64. <% else %>
  65.  
  66. <% On Error Resume Next %>
  67. <% Set ExpireObj = Server.CreateObject("NntpAdm.Expiration") %>
  68. <% if Err <> 0 then %>
  69.     <script language="javascript">
  70.         alert('<% = Err.description %> ');
  71.     </script>
  72. <% end if %>
  73.  
  74. <% REM get server name %>
  75. <% ExpireObj.Server = svr %>
  76.  
  77. <% REM set service instance %>
  78. <% ExpireObj.ServiceInstance = Session("ServiceInstance") %>
  79.  
  80. <HTML>
  81. <HEAD>
  82.  
  83. <script language="javascript">
  84.  
  85.     <!--#include file="nnisnum.htm"-->
  86.  
  87.     function helpBox() 
  88.     {
  89.         window.open("help/nnexpplh.htm","Help","toolbar=no,scrollbars=yes,directories=no,menubar=no,width=300,height=425");
  90.     }
  91.  
  92.     function checkPolicy() 
  93.     {
  94.         ExpSizeHorizon = document.userform.ExpSizeHorizon;
  95.         hExpSizeHorizon = document.userform.hExpSizeHorizon;
  96.         ExpTime = document.userform.ExpTime;
  97.         hExpTime = document.userform.hExpTime;
  98.  
  99.         if (document.userform.ExpPolicy[0].checked) {
  100.             ExpTime.value = hExpTime.value;
  101.             if (ExpSizeHorizon.value != "-1") {
  102.                 hExpSizeHorizon.value = ExpSizeHorizon.value;
  103.             }
  104.             ExpSizeHorizon.value = "";
  105.         }
  106.         else {
  107.             if (document.userform.ExpPolicy[1].checked) {
  108.                 ExpSizeHorizon.value = hExpSizeHorizon.value;
  109.                 if (ExpTime.value != "-1") {
  110.                     hExpTime.value = ExpTime.value;
  111.                 }
  112.                 ExpTime.value = "";
  113.             }
  114.             else {
  115.                 if (ExpTime.value==""){
  116.                     ExpTime.value = hExpTime.value;
  117.                 }
  118.                 if (ExpSizeHorizon.value==""){
  119.                     ExpSizeHorizon.value = hExpSizeHorizon.value;
  120.                 }
  121.             }
  122.         }
  123.     }
  124.  
  125.  
  126.     function okAdd() {
  127.         document.userform.submit();
  128.     }
  129.  
  130.     function closeAdd(id) {
  131.         self.close();
  132.         opener.location = "nnexphd.asp?svr=<% = svr %>&a=add&id=" + id;
  133.     }
  134.  
  135.     function checkMax(cntrl,hiddencntrl) {
  136.         if (isNum(cntrl.value)) {
  137.             hiddencntrl.value = cntrl.value;
  138.             if ((document.userform.ExpTime.value != "") && (document.userform.ExpSizeHorizon.value != "")) {
  139.                 document.userform.ExpPolicy[2].checked = true;
  140.             }    
  141.             checkPolicy();
  142.         }
  143.         else {
  144.             cntrl.value = hiddencntrl.value;
  145.             cntrl.focus();
  146.         }
  147.     }
  148.  
  149. </SCRIPT>
  150. <TITLE><% = L_ADD_EXPIRATION_TXT %></TITLE>
  151.  
  152. </HEAD>
  153.  
  154. <% On Error Resume Next %>
  155. <% ExpireObj.Default %>
  156. <% if ( Err <> 0 ) then %>
  157.     <script language="javascript">
  158.         alert( "<% = Err.description %>" );
  159.     </script>
  160. <% end if %>
  161.  
  162. <% if (a = "add") then %>
  163.  
  164.     <% ExpPolicy = Request("ExpPolicy") %>
  165.     <% ExpTime = ExpireObj.ExpireTime %>
  166.     <% ExpTime = ExpTime * 24 %>
  167.     <% ExpSizeHorizon = Request("ExpSizeHorizon") %>
  168.  
  169.     <% if (ExpPolicy = "date") then %>
  170.         <% ExpireObj.ExpireTime = ExpTime %>
  171.         <% ExpireObj.ExpireSize = -1 %>
  172.     <% elseif (ExpPolicy = "size") then %>
  173.         <% ExpireObj.ExpireSize = ExpSizeHorizon %>
  174.         <% ExpireObj.ExpireTime = -1 %>
  175.     <% else %>
  176.         <% ExpireObj.ExpireTime = ExpTime %>
  177.         <% ExpireObj.ExpireSize = ExpSizeHorizon %>
  178.     <% end if %>
  179.  
  180.     <% ExpireObj.PolicyName = "a" %>
  181.     <% dim x(0) %>
  182.     <% x(0) = "*" %>
  183.     <% expireobj.NewsgroupsVariant = x %>
  184.  
  185.     <% REM ExpireObj.Enumerate %>
  186.     <% On Error Resume Next %>
  187.     <% ExpireObj.Add %>
  188.     <% if (Err <> 0) then %>
  189.         <SCRIPT LANGUAGE="javascript">
  190.             alert ( "<% = Err.description %>" );
  191.             self.location = "nnexpad.asp?svr=<% = svr %>"
  192.         </SCRIPT>
  193.     <% else %>
  194.         <% id = ExpireObj.ExpireId %>
  195.         <BODY BGCOLOR="#000000" TOPMARGIN=15 LINK="#000000" VLINK="#000000" ALINK="#000000" onLoad="closeAdd('<% = id %>');">            
  196.         <% end if %>
  197. <% else %>
  198.  
  199. <BODY BGCOLOR="#000000" TOPMARGIN=15 TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000">
  200. <% REM <BODY BGCOLOR="#000000" TOPMARGIN=15 TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000"> %>
  201.  
  202. <FORM NAME="userform" METHOD="post" ACTION="nnexpad.asp">
  203.  
  204. <INPUT NAME="a" TYPE="hidden" VALUE="add">
  205. <INPUT NAME="svr" TYPE="hidden" VALUE="<% = svr %>">
  206.  
  207. <TABLE BORDER="1" BGCOLOR="#CCCCCC" WIDTH=100% HEIGHT=80% CELLPADDING=10>
  208.  
  209. <TR>
  210.     <TD>
  211.  
  212.     <P><IMG SRC="images/gnicttl.gif" ALIGN="textmiddle" HEIGHT=10 WIDTH=10> 
  213.     <FONT SIZE=2 FACE="Arial"><B>Add Expiration Policy on </B></FONT>
  214.     <FONT SIZE=3 FACE="Times New Roman"><I><% = svr %></I></FONT>
  215.  
  216.     <FONT SIZE=2 FACE="Arial">
  217.  
  218.     <P>
  219.     <TABLE WIDTH=400 BORDER="0" ALIGN="left">
  220.  
  221.         <TR>
  222.             <TD WIDTH=200><INPUT NAME="ExpPolicy" TYPE="radio" VALUE="date" onClick="checkPolicy();"> <FONT SIZE=2 FACE="Arial">Newsgroups older than</FONT></TD>
  223.             <TD WIDTH=200>
  224.  
  225.                 <% ExpTime = ExpireObj.ExpireTime %>
  226.                 <% ExpTime = ExpTime / 24 %>
  227.  
  228.                 <FONT SIZE=2 FACE="Arial">
  229.                  max <INPUT NAME="ExpTime" TYPE="text" SIZE=5 onChange="checkMax(document.userform.ExpTime,document.userform.hExpTime);" VALUE="<%  = ExpTime %>"> days</FONT>
  230.                 <INPUT NAME="hExpTime" TYPE="hidden" VALUE="<% = ExpTime %>">
  231.             </TD>
  232.         </TR>
  233.         <TR>
  234.             <TD HEIGHT=4 BGCOLOR="#CCCCCC"></TD>
  235.         </TR>
  236.         <TR>
  237.             <TD WIDTH=200><FONT SIZE=2 FACE="Arial"><INPUT NAME="ExpPolicy" TYPE="radio" VALUE="size" onClick="checkPolicy();"> Newsgroups bigger than</TD>
  238.             <TD WIDTH=200>
  239.  
  240.                 <% ExpSizeHorizon = ExpireObj.ExpireSize %>
  241.  
  242.                 <FONT SIZE=2 FACE="Arial">
  243.                 max <INPUT NAME="ExpSizeHorizon" TYPE="text" SIZE=5 onChange="checkMax(document.userform.ExpSizeHorizon,document.userform.hExpSizeHorizon);" VALUE="<% = ExpSizeHorizon %>"> MB</FONT>
  244.                 <INPUT NAME="hExpSizeHorizon" TYPE="hidden" VALUE="<% = ExpSizeHorizon %>">
  245.         </TD>
  246.         </TR>
  247.         <TR>
  248.             <TD COLSPAN=2 HEIGHT=4 BGCOLOR="#CCCCCC"></TD>
  249.         </TR>
  250.         <TR>
  251.             <TD COLSPAN=2>
  252.                 <FONT SIZE=2 FACE="Arial">
  253.                     <INPUT NAME="ExpPolicy" TYPE="radio" VALUE="both" onClick="checkPolicy();" CHECKED> Both
  254.                 </FONT>
  255.             </TD>
  256.         </TR>
  257.  
  258.         </TABLE>
  259.  
  260.     </TD>
  261. </TR>
  262.  
  263. </TABLE>
  264.  
  265. <P>
  266. <TABLE ALIGN="right" CELLPADDING=1 CELLSPACING=1>
  267. <TR>
  268.     <TD><TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
  269.         <TR>
  270.             <TD VALIGN="middle">
  271.                 <FONT FACE="Arial" SIZE=2>
  272.                 <A HREF="javascript:okAdd();">
  273.                 <IMG SRC="images/gnicok.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
  274.                 <B><A HREF="javascript:okAdd();">OK</A></B>
  275.                 </FONT>
  276.             </TD>
  277.         </TR>
  278.     </TABLE>
  279.     </TD>
  280.     <TD><TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
  281.         <TR>
  282.             <TD VALIGN="middle">
  283.                 <FONT FACE="Arial" SIZE=2>
  284.                 <A HREF="javascript:close();">
  285.                 <IMG SRC="images/gniccncl.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
  286.                 <B><A HREF="javascript:close();">Cancel</A></B>
  287.                 </FONT>
  288.             </TD>
  289.         </TR>
  290.     </TABLE>
  291.     </TD>
  292.     <TD><TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
  293.         <TR>
  294.             <TD VALIGN="middle">
  295.                 <FONT FACE="Arial" SIZE=2>
  296.                 <B><A HREF="javascript:helpBox();"><IMG HEIGHT=16 WIDTH=16 ALIGN="top" SRC="images/gnichelp.gif" BORDER=0 ALT="Help"></A>
  297.                 <A HREF="javascript:helpBox();">Help</A></B>
  298.                 </FONT>
  299.             </TD>
  300.         </TR>
  301.     </TABLE></TD>
  302.  
  303.     <TD> </TD>
  304. </TR>
  305. </TABLE>
  306.  
  307. <% end if %>
  308.  
  309. </BODY>
  310. </HTML>
  311.  
  312. <% end if %>
  313. <% end if %>
  314.