home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / ins.cab / nngrphd.asp < prev    next >
Text File  |  1997-10-23  |  11KB  |  374 lines

  1. <% Response.Expires = 0 %>
  2.  
  3. <%
  4. REM LOCALIZATION
  5.  
  6. L_PAGETITLE_TEXT = "Microsoft Internet Service Manager"
  7. L_ERRORIS_TEXT = "Error is: "
  8. L_ENTERNEWSGROUPNAME_TEXT = "Please enter a newsgroup name."
  9. L_CONFIRMDELETE_TEXT = "Are you sure you want to remove this newsgroup?"
  10. L_HEADTITLE_TEXT = "Newsgroups on"
  11. L_NEWSGROUPNAME_TEXT = "Newsgroup name:"
  12. L_FINDBUTTON_TEXT = "Find"
  13. L_DISPLAYRESULTS_TEXT = "Displaying newsgroups "
  14. L_MATCHINGNEWSGROUPS_TEXT = " matching newsgroups."
  15. L_TITLEMATCHINGNEWSGROUP_TEXT = "Matching Newsgroup"
  16. L_TITLEMATCHINGNEWSGROUPS_TEXT = "Matching Newsgroups"
  17. L_NOMATCHINGROUPS_TEXT = "No matching groups"
  18. L_RESULTS_TEXT    = "Results: "
  19. L_ACCESSDENIED_TEXT    = "Error: Access is Denied."
  20.  
  21. L_OPEN_TEXT        = "open" 'Internal String do NOT localize
  22. L_REMOVE_TEXT    = "remove" 'Internal String do NOT localize
  23.  
  24. REM END LOCALIZATION
  25. %>
  26. <SCRIPT LANGUAGE="javascript">
  27.  
  28. <% REM Get starting number for groups to show %>
  29. <% startNum = Request("startNum") %>
  30. <% REM if startNum has a value then use it, otherwise use start value of 1 %>
  31. <% if (startNum = "") then %>
  32.     <% startNum = 1 %>
  33. <% end if %>
  34.  
  35. <% startNumClean = startNum %>
  36.     
  37. <% REM Set number of groups to display per page %>
  38. <% GroupsPerPage = 10 %>
  39.  
  40. <% REM GET ACTION VARIABLE %>
  41. <% REM VALUE IS "remove" OR NOTHING %>
  42. <% a = Request("a") %>
  43. <% svr = Session("svr") %>
  44.  
  45. <% REM create nntp admin object %>
  46.  
  47. <% On Error Resume Next %>
  48. <% Set GroupAdm = Server.CreateObject("nntpadm.groups") %>
  49. <% if Err <> 0 then %>
  50.         <p>
  51.         <% = L_ACCESSDENIED_TEXT %>
  52.         alert(' <% = L_ERRORIS_TEXT %><% = Err.description %> ');
  53. <% end if %>
  54.  
  55. <% REM get server name %>
  56. <% GroupAdm.Server = svr %>
  57.  
  58. <% REM set service instance %>
  59. <% GroupAdm.ServiceInstance = Session("ServiceInstance") %>
  60.  
  61. <% Session("find") = Request("find") %>
  62.  
  63. <% if (Session("find") <> "") then %>
  64.     <% FindNewsgroup = Session("Find") %>
  65. <% else %>
  66.     <% FindNewsgroup = Request("find") %>
  67. <% end if %>
  68.  
  69. <% if (FindNewsgroup = "") then %>
  70.     <% FindNewsgroup = "*" %>
  71. <% end if %>
  72.  
  73. <% REM set Newsgroup to current value of "group" %>
  74. <% Newsgroup = Request("group") %>
  75.  
  76. <% REM Remove Group if "a" == "remove" %>
  77. <% if (a = L_REMOVE_TEXT) then %>
  78.  
  79.     <% NewsgroupToDelete = Request("NewsgroupToDelete") %>
  80.  
  81.     <% On Error Resume Next %>
  82.     <% GroupAdm.Remove(NewsgroupToDelete) %>
  83.     <% if Err <> 0 then %>
  84.             alert ( "<% = L_ERRORIS_TEXT %><% = Err.description %>" );
  85.     <% end if %>
  86. <% end if %>
  87.  
  88. <!--#include file="_cnst.asp" -->
  89.  
  90. <% if (cont = true) then %>
  91. </script>
  92. <% REM START OF HTML %>
  93. <HTML>
  94. <HEAD>
  95. <script language="javascript">
  96. <% REM Determine browser to set pop-up window size %>
  97.  
  98. <% if Instr(Request.ServerVariables("HTTP_USER_AGENT"), "IE 4", 1) then %>
  99.     winstr = "width=430,height=380,directories=no,status=no,scrollbars=no,resize=no";
  100.  
  101. <% elseif Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") then %>
  102.     winstr = "width=390,height=280,directories=no,status=no,scrollbars=no,resize=no";
  103.  
  104. <% else %>
  105.     winstr = "width=420,height=350,menubar=no,directories=no,status=no,scrollbars=no,resize=no";
  106. <% end if %>
  107.  
  108. <% REM Create uForm object and methods %>
  109.  
  110.     var uForm = new Object();
  111.     uForm.itemList = new Array();
  112.     uForm.startNum = "<% = startNum %>";
  113.     uForm.GroupsPerPage = <% = GroupsPerPage %>;
  114.     uForm.selectedItem = uForm.startNum - 1;
  115.     uForm.editItem = editItem;
  116.     uForm.selectItem = selectItem;
  117.     uForm.loadList = loadList;
  118.     uForm.removeItem = removeItem;
  119.     uForm.addItem = addItem;
  120.     uForm.next = next;
  121.     uForm.previous = previous;
  122.     uForm.refresh = refresh;
  123.     uForm.FindNewsgroup = top.menu.document.hiddenform.txtFindNewsgroup.value;
  124.     uForm.startNumClean = "<% = startNumClean %>";
  125.  
  126. <% maxReturn = 1000    %>
  127.  
  128. <% groupadm.server = svr %>
  129. <% groupadm.serviceinstance = Session("ServiceInstance") %>
  130.  
  131. <% On Error Resume Next %>
  132. <% GroupAdm.Find findnewsgroup, maxReturn %>
  133. <% if Err <> 0 then %>
  134.         alert( "<% = Err.description %> ");
  135. <% end if %>
  136.  
  137. <% numGroups = GroupAdm.Count %>
  138.  
  139. uForm.numGroups = "<% = numGroups %>";
  140.  
  141. top.menu.document.hiddenform.nNewsgroupListStart.value = "<% = startNum %>";
  142.  
  143. <% i = startNum - 1 %>
  144.  
  145. <% while( (i < numGroups) AND ( i < (startNum + GroupsPerPage - 1) ) ) %>
  146.  
  147.     <% On Error Resume Next %>
  148.     <% x = GroupAdm.MatchingGroup( i ) %>
  149.     <% do while ( Err <> 0 ) %>            
  150.         alert ( "<% = L_ERRORIS_TEXT %><% = Err.description %>" );            
  151.         <% exit do %>
  152.     <% loop %>
  153.     
  154.     <% On Error Resume Next %>
  155.     <% GroupAdm.Get(x) %>
  156.     <% if ( Err <> 0 ) then %>            
  157.         alert ( "<% = L_ERRORIS_TEXT %><% = Err.description %>" );            
  158.     <% end if %>
  159.     
  160.     uForm.itemList[<% = i %>] = new Object();
  161.     uForm.itemList[<% = i %>].newsgroup = "<% = GroupAdm.Newsgroup %>";
  162.     uForm.itemList[<% = i %>].description = "<% = Server.URLEncode( GroupAdm.Description ) %>";
  163.     uForm.itemList[<% = i %>].readOnly = "<% = GroupAdm.ReadOnly %>";
  164.     uForm.itemList[<% = i %>].moderator = "<% = GroupAdm.Moderator %>";
  165.     
  166.     if( uForm.itemList[<% = i %>].moderator != "" )
  167.     {
  168.         uForm.itemList[<% = i %>].moderated = "1";
  169.     }
  170.     else
  171.     {
  172.         uForm.itemList[<% = i %>].moderated = "0";
  173.     }
  174.     <% i = i + 1 %>
  175. <% Wend %>
  176.  
  177. <% startNum = startNum + GroupsPerPage %>
  178.  
  179. top.menu.document.hiddenform.nNewsgroupListStart.value = "<% = startNum %>";
  180.  
  181. function next()
  182. {
  183.     if( parseInt(top.menu.document.hiddenform.nNewsgroupListStart.value) <= parseInt(uForm.numGroups) )
  184.     {
  185.         parent.head.location = "nngrphd.asp?svr=<% = svr %>&startNum=" + top.menu.document.hiddenform.nNewsgroupListStart.value + "&find=" + top.menu.document.hiddenform.txtFindNewsgroup.value;
  186.     }
  187. }
  188.  
  189. function previous()
  190. {
  191.     sum = uForm.GroupsPerPage + 1;
  192.     if( sum != parseInt(top.menu.document.hiddenform.nNewsgroupListStart.value) )
  193.     {
  194.         parent.head.location = "nngrphd.asp?svr=<% = svr %>&startNum=" + (top.menu.document.hiddenform.nNewsgroupListStart.value - ( uForm.GroupsPerPage * 2 ) ) + "&find=" + top.menu.document.hiddenform.txtFindNewsgroup.value;
  195.     }
  196. }    
  197.  
  198. function refresh()
  199. {
  200.     parent.head.location = "nngrphd.asp?svr=<% = svr %>&startNum=&find=" + top.menu.document.hiddenform.txtFindNewsgroup.value;
  201. }
  202.  
  203. function onUpdateList(nDirection)
  204. {
  205.     var oldvalue = parseInt ( top.menu.document.hiddenform.nNewsgroupListStart.value );
  206.     var newvalue = nDirection * 5 + oldvalue;
  207.     if ( nDirection == 0 )
  208.     {
  209.         newvalue = 0;
  210.     }
  211.     top.menu.document.hiddenform.nNewsgroupListStart.value = newvalue;
  212.     
  213.     
  214.  
  215.     parent.head.location = "nngrphd.asp?svr=<% = svr %>&startNum=" + top.menu.document.hiddenform.nNewsgroupListStart.value + "&find=" + top.menu.document.hiddenform.txtFindNewsgroup.value;
  216. }
  217.  
  218. function checkValue()
  219. {
  220.     if (document.userform.txtFindNewsgroup.value==""){
  221.         alert("<% = L_ENTERNEWSGROUPNAME_TEXT %>");
  222.         document.userform.txtFindNewsgroup.focus();
  223.         return false;
  224.     }
  225.     else {
  226.         return true;
  227.     }
  228. }
  229.  
  230. <% REM when the find href receives a mouseDown %>
  231. function onFind()
  232. {
  233.     if (checkValue())
  234.     {
  235.                top.menu.document.hiddenform.txtFindNewsgroup.value = document.userform.txtFindNewsgroup.value;
  236.                uForm.refresh();
  237.     }
  238. }
  239.  
  240. <% REM Javascript function selectItem (if IE, reloads list at specified position -- broken in Netscape) %>
  241. function selectItem(index)
  242.     {
  243.         uForm.selectedItem = index;
  244.         parent.list.location.href = "nngrpls.asp";
  245.     }
  246.  
  247. <% REM Javascript function addItem %>
  248.  
  249. function addItem()
  250.     {
  251.         win = window.open("nngrped.asp?svr=<% = svr %>&a=new","PropWindow",winstr);
  252.         if (win.opener == null)
  253.         {
  254.                win.opener = self;
  255.            }
  256. }
  257.  
  258. <% REM Javascript function editItem %>
  259. function editItem()
  260. {
  261.     if(uForm.numGroups > 0)
  262.     {
  263.         index = uForm.selectedItem;
  264.         Newsgroup = uForm.itemList[index].newsgroup;
  265.         Description = uForm.itemList[index].description;
  266.         readOnly = uForm.itemList[index].readOnly;
  267.         Moderator = uForm.itemList[index].moderator;
  268.         Moderated = uForm.itemList[index].moderated;
  269.         win = window.open("nngrped.asp?svr=<% = svr %>&a=edit&Group=" + Newsgroup + "&txtDescription=" + Description + "&hdnReadOnly=" + readOnly + "&txtModerator=" + Moderator + "&hdnModerated=" + Moderated + "&index=" + index,"PropWindow",winstr);
  270.         if (win.opener == null)
  271.         {
  272.             win.opener = self;
  273.         }
  274.     }
  275. }
  276.  
  277. <% REM Javascript function removeItem %>
  278.  
  279. function removeItem()
  280. {
  281.     if (confirm("<% = L_CONFIRMDELETE_TEXT %>"))
  282.     {
  283.         index = uForm.selectedItem;
  284.         NewsgroupToDelete = uForm.itemList[index].newsgroup;
  285.         self.location = "nngrphd.asp?svr=<% = svr %>&a=remove&NewsgroupToDelete=" + NewsgroupToDelete;
  286.     }
  287. }
  288.  
  289. function onLoad() 
  290. {
  291.     document.userform.txtFindNewsgroup.value = top.menu.document.hiddenform.txtFindNewsgroup.value;
  292. }
  293.  
  294. <% REM Javascript function loadList loads list frame after header is completed %>
  295. function loadList() 
  296. {
  297.     parent.list.location = "nngrpls.asp?svr=<% = svr %>";
  298. }    
  299.  
  300. </SCRIPT>
  301. <TITLE><% = L_PAGETITLE_TEXT %></TITLE>
  302. </HEAD>
  303.  
  304. <BODY TEXT="#000000" LINK="#FFFFFF" ALINK="#FFFFFF" BGCOLOR="#CCCCCC" TOPMARGIN=10 VLINK="#FFFFFF">
  305. <FORM NAME="userform" ACTION="" onSubmit = "onFind(); return false;" METHOD="post">
  306. <TABLE BORDER="0">
  307.     <TR>
  308.         <TD COLSPAN=2>
  309.             <P><IMG SRC="images/gnicttl.gif" ALIGN="textmiddle" HEIGHT=10 WIDTH=10> <FONT SIZE=2 FACE="Arial"><B><% = L_HEADTITLE_TEXT %>  </B></FONT><FONT SIZE=3 FACE="Times New Roman"><I><% = svr %></I><BR> </FONT>
  310.         </TD>
  311.     </TR>
  312.     <TR>
  313.         <TD WIDTH=25> </TD>
  314.         <TD><FONT SIZE=2 FACE="Arial">
  315.             <% = L_NEWSGROUPNAME_TEXT %>  <INPUT TYPE = "text" NAME = "txtFindNewsgroup">
  316.         </TD>
  317.         <TD>
  318.         <TABLE BORDER="0" CELLPADDING=5 CELLSPACING=2>
  319.             <TR>        
  320.                 <TD VALIGN="bottom" BGCOLOR="#555555">
  321.                     <FONT FACE="Arial" SIZE=2>
  322.                     <B><A HREF="javascript:onFind();">
  323.                     <% = L_FINDBUTTON_TEXT %></A></B>
  324.                     </FONT>
  325.                 </TD>    
  326.             </TR>
  327.         </TABLE>
  328.         </TD>
  329.     </TR>
  330.     <TR>
  331.         <TD WIDTH=25> </TD>
  332.         <TD COLSPAN = 2>
  333.             <FONT SIZE=2 FACE="Arial">
  334.                  <BR>
  335. <% if (numGroups = 0) then %>
  336.     <% = L_NOMATCHINGROUPS_TEXT %><br>
  337. <% else %>
  338.             <% = L_RESULTS_TEXT %><b><% = startNumClean %></b> - <b><% if( (startNumClean + GroupsPerPage - 1) < numGroups ) then %>
  339.             <% = startNumClean + GroupsPerPage - 1 %><% else %><% = numGroups %><% end if %></b> out of <b><% = numGroups %></b></br>
  340. <% end if %>
  341.             </FONT>        
  342.         </TD>
  343.     </TR>
  344.     <TR>
  345.         <TD COLSPAN=2 HEIGHT=4></TD>
  346.     </TR>
  347. </TABLE>
  348.  
  349. </FORM>
  350.  
  351. <TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0 WIDTH=400>
  352.     <TR>
  353.     <TD WIDTH=10>
  354.     </TD>
  355.     <TD WIDTH=390>
  356.     <B><FONT SIZE=2 FACE="Arial"><% = L_TITLEMATCHINGNEWSGROUPS_TEXT %></FONT></B>
  357.     </TD>
  358.     </TR>
  359. </TABLE>
  360. <% REM Load list page after head has completely loaded %>
  361. <% if ( (a = L_OPEN_TEXT) OR (a = L_REMOVE_TEXT) ) then %>
  362.     <SCRIPT LANGUAGE="javascript">
  363.         parent.head.location = "nngrphd.asp?svr=<% = svr %>&find=" + top.menu.document.hiddenform.txtFindNewsgroup.value;
  364.     </SCRIPT>
  365. <% else %>
  366.     <SCRIPT LANGUAGE="javascript">
  367.         timeList = setTimeout('loadList()',500);
  368.         onLoad();
  369.     </SCRIPT>
  370. <% end if %>
  371. </BODY>
  372. </HTML>
  373. <% end if %>
  374.