home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 9 / IOPROG_9.ISO / contrib / iis4 / iis4_03.cab / iimnu.asp < prev    next >
Encoding:
Text File  |  1997-09-05  |  14.3 KB  |  486 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <%Option Explicit %>
  3.  
  4. <% 
  5. Const L_NOTIMPLEMENTED_ERRORMESSAGE="This feature is not yet implemented."
  6. Const L_WORKINGSERVER_TEXT="You cannot change the status of the web server you are currently connected to."
  7. Const L_NORENAME_TEXT="Please use the windows explorer or the MMC snapin to rename physical directories."
  8. Const L_ONLYSERVER_TEXT="Only Web Sites and FTP Sites may be started and stopped."
  9. Const L_DELETEDIR_TEXT="WARNING!\rDeleting a directory permanently removes that directory, \rand all of it's subdirectories and files. \r\rAre you sure you want to continue?"
  10. Const L_DELETEVDIR_TEXT="Deleting a virtual directory removes all associated configuration information. \rThe physical directory structure is not affected. \r\rAre you sure you want to continue?"
  11. Const L_DELETESITE_TEXT="Deleting a site removes all associated configuration information \rincluding all virtual directories associated with the site. \rThe physical directory structure is not affected. \r\rAre you sure you want to continue?"
  12. Const L_CONNECT_TEXT="Connect..."
  13. Const L_NEW_TEXT="New"
  14. Const L_RENAME_TEXT="Rename"
  15. Const L_DELETE_TEXT="Delete"
  16. Const L_PROPS_TEXT="Properties"
  17. Const L_BROWSE_TEXT="Browse"
  18. Const L_BACKUP_TEXT = "Backup Configuration"
  19. Const L_START_TEXT="Start"
  20. Const L_STOP_TEXT="Stop"
  21. Const L_PAUSE_TEXT="Pause"
  22. Const L_RESUME_TEXT="Resume"
  23. Const L_STARTING_TEXT="Starting service..."
  24. Const L_STOPPING_TEXT="Stopping service..."
  25. Const L_PAUSING_TEXT="Pausing service..."
  26. Const L_CONTING_TEXT="Resuming service..."
  27. Const L_REFRESH_TEXT="Refresh"
  28. Const L_RELEASE_TEXT="Release"
  29. Const L_ENTERNAME_TEXT="Enter a name for the new"
  30. Const L_ENTERNEWNAME_TEXT="Enter a new name."
  31. Const L_NEWWEB_TEXT="New FTP"
  32. Const L_NEWFTP_TEXT="New Web"
  33. Const L_WEBSITE_TEXT="Site"
  34. Const L_VDIR_TEXT="Virtual Directory"
  35. Const L_DIR_TEXT="Directory"
  36. Const L_WEB_TEXT="Web"
  37. Const L_FTP_TEXT="FTP"
  38. Const L_MASTER_TEXT="Master Properties"
  39. Const L_NEWPATH_TEXT=""
  40. Const L_ENTERPATH_TEXT="Please enter a path for the virtual directory before adding subdirectories."
  41. Const L_DELETENOTALLOWED_TEXT = "Deleting the server node is not allowed."
  42. Const L_RENAMENOTALLOWED_TEXT = "Renaming the server node is not allowed."
  43. Const L_SERVICEALREADY_TEXT = "This site has already been "
  44.  
  45.  
  46. Dim isAdmin
  47.  
  48. isAdmin=Session("isAdmin")
  49.  
  50. %>
  51. <html>
  52. <head>
  53.  
  54. <script language="javascript">
  55.  
  56.     // set the default helpfile name...
  57.     top.head.Global.helpFileName="iipxmain";
  58.  
  59.     // instance state constants
  60.     START=2
  61.     STOP=4
  62.     PAUSE=6
  63.     CONT=0
  64.  
  65.     function connect(){
  66.         var theList=top.head.nodeList;
  67.         
  68.         //connect is a global function in iihd.asp
  69.         theList[0].connect();
  70.     }
  71.     
  72.     function master(){
  73.         // loads the master www & ftp property pages (ie for the service).
  74.         var path;        
  75.         var thetype=document.mnuform.MSvcType.options[document.mnuform.MSvcType.selectedIndex].value;
  76.         var sel=0;
  77.         top.body.iisstatus.location.href=("iistat.asp?thisState=Loading");
  78.  
  79.         path="stype=" + thetype;
  80.         path=path + "&vtype=" + "svc"
  81.  
  82.         if (thetype == "www"){
  83.             top.head.Global.selName="Master WWW Properties"                
  84.             path=path + "&title=" + escape("Master WWW Properties");        
  85.             path=path + "&dpath=" + escape("IIS://localhost/W3SVC");            
  86.             path=path + "&spath=" + escape("IIS://localhost/W3SVC");
  87.         }
  88.         
  89.         if (thetype == "ftp"){
  90.             top.head.Global.selName="Master FTP Properties"        
  91.             path=path + "&title=" + escape("Master FTP Properties");        
  92.             path=path + "&dpath=" + escape("IIS://localhost/MSFTPSVC");            
  93.             path=path + "&spath=" + escape("IIS://localhost/MSFTPSVC");
  94.         }        
  95.  
  96.         top.head.Global.selSType=thetype
  97.         top.head.Global.selVType="svc"        
  98.  
  99.         //set up our session variables...
  100.     
  101.         page="iiset.asp?"+path; 
  102.         top.connect.location.href=(page);
  103.     
  104.     }
  105.  
  106.  
  107.     function add(){
  108.     
  109.         //add calls worker script iiaction.asp
  110.         //which intern calls the global insertitem function
  111.         //that inserts the new item in the cachedList
  112.             
  113.         theList=top.head.nodeList;
  114.         gVars=top.head.Global;
  115.         sel=gVars.selId;
  116.         
  117.  
  118.         <% if isAdmin then %>
  119.             thetype=document.mnuform.SvcType.options[document.mnuform.SvcType.selectedIndex].value;
  120.  
  121.  
  122.             if (theList[sel].vtype=="comp"){
  123.                 nodetype=thetype + " <%= L_WEBSITE_TEXT %>";
  124.                 vtype="server";
  125.             }
  126.             else{
  127.                 if (theList[sel].stype=="www"){
  128.                     thetype="<%= L_WEB_TEXT %>";
  129.                     document.mnuform.SvcType.selectedIndex=0;        
  130.                 }
  131.                 if (theList[sel].stype=="ftp"){
  132.                     thetype="<%= L_FTP_TEXT %>";
  133.                     document.mnuform.SvcType.selectedIndex=1;
  134.                 }
  135.             }
  136.  
  137.             if (theList[sel].vtype=="server"){        
  138.                 nodetype=thetype + " <%= L_VDIR_TEXT %>";
  139.                 vtype="vdir";
  140.             }
  141.  
  142.             if (theList[sel].vtype=="vdir"){
  143.                 nodetype="<%= L_DIR_TEXT %>";
  144.                 vtype="dir";
  145.             }
  146.  
  147.             if (theList[sel].vtype=="dir"){
  148.                 nodetype="<%= L_DIR_TEXT %>";
  149.                 vtype="dir";
  150.             }
  151.             
  152.             if (thetype=="Web"){
  153.                 stype="www"
  154.             }
  155.             else{
  156.                 stype="ftp"
  157.             }
  158.             
  159.         <% else %>
  160.             nodetype="<%= L_DIR_TEXT %>";
  161.             vtype="dir";
  162.             stype = theList[sel].stype
  163.         <% end if %>
  164.         
  165.  
  166.  
  167.         nodename=prompt("<%= L_ENTERNAME_TEXT %> "+nodetype+".","<%= L_NEW_TEXT %> " +nodetype);
  168.  
  169.     <% if Session("Browser") = "IE3" then %>
  170.         if (nodename != ""){
  171.     <% else %>
  172.         if (nodename != null){    
  173.     <% end if %>
  174.             parentpath=escape(theList[sel].path +"/"+nodename);
  175.             path="a=add&path="+parentpath+"&stype="+stype+"&vtype="+vtype+"&sel=" + sel;
  176.             top.connect.location.href="iiaction.asp?"+path;
  177.         }
  178.     }
  179.  
  180.     function edit(){
  181.         var theList=top.head.nodeList;
  182.         
  183.         //global function located in iihd.asp
  184.         theList[0].openLocation();
  185.     }
  186.     
  187.     function renameItem(){
  188.         var theList=top.head.nodeList;
  189.         gVars=top.head.Global;
  190.         sel=gVars.selId;
  191.         
  192.         if (theList[sel].vtype=="comp"){
  193.             alert("<%= L_RENAMENOTALLOWED_TEXT %>");
  194.         }
  195.         else{
  196.             if (theList[sel].vtype=="dir"){
  197.                 alert("<%= L_NORENAME_TEXT %>");
  198.             }
  199.             else{
  200.                 nodename=prompt("<%= L_ENTERNEWNAME_TEXT %>",theList[sel].title);
  201.                 
  202.                 <% if Session("Browser") = "IE3" then %>
  203.                     if (nodename != ""){
  204.                 <% else %>
  205.                     if (nodename != null){    
  206.                 <% end if %>
  207.                     thispath=escape(theList[sel].path);
  208.                     path = "sel=" + sel + "&path=" + thispath + "&nodename=" + nodename;
  209.                     top.connect.location.href="iirename.asp?"+path;
  210.                 }
  211.             }
  212.         }
  213.     }
  214.  
  215.     function deleteItem(){
  216.         
  217.         //delete item calls worker script iiaction.asp
  218.         //which intern calls the global delete function
  219.         //that marks the item in the cached list as deleted.
  220.         
  221.         theList=top.head.nodeList;
  222.         gVars=top.head.Global;
  223.         sel=gVars.selId;        
  224.  
  225.         <% if Session("isAdmin") then %>
  226.  
  227.         if (theList[sel].vtype=="comp"){
  228.             alert("<%= L_DELETENOTALLOWED_TEXT %>");
  229.         }
  230.         else{
  231.  
  232.             if (theList[sel].vtype=="server"){        
  233.                     alerttext="<%= L_DELETESITE_TEXT %>";
  234.             }
  235.     
  236.     
  237.         <% else %>
  238.         if (theList[sel].vtype=="server"){    
  239.             alert("<%= L_DELETENOTALLOWED_TEXT %>");
  240.         }
  241.         else{
  242.         <% end if %>
  243.     
  244.             if (theList[sel].vtype=="vdir"){
  245.                     alerttext="<%= L_DELETEVDIR_TEXT %>";
  246.             }
  247.     
  248.             if (theList[sel].vtype=="dir"){
  249.                     alerttext="<%= L_DELETEDIR_TEXT %>";
  250.             }
  251.  
  252.     
  253.             if (confirm(alerttext)){
  254.                 thispath=escape(theList[sel].path);
  255.                 path="a=del&path="+thispath+"&stype="+theList[sel].stype+"&vtype="+theList[sel].vtype+"&sel=" + sel;
  256.                 top.connect.location.href="iiaction.asp?"+path;
  257.             }
  258.         }
  259.     }
  260.  
  261.     function SetState(x) {
  262.     
  263.         //setState calls worker script iiaction.asp
  264.         //which calls the sets the state on the item in the cached list
  265.         
  266.         var theList=top.head.nodeList;
  267.         var gVars=top.head.Global;
  268.         var sel=gVars.selId;
  269.         if (theList[sel].vtype=="server"){
  270.             if (theList[sel].state != x){
  271.             
  272.                 if (theList[sel].isWorkingServer){
  273.                     alert("<%= L_WORKINGSERVER_TEXT %>");
  274.                 }
  275.                 
  276.                 
  277.                 else{
  278.                     doaction = true;
  279.                     if (x==START){
  280.                         if (theList[sel].state == PAUSE){
  281.                             x = CONT                    
  282.                         }
  283.                         else{
  284.                             parent.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_STARTING_TEXT %>") + "&moving=yes";
  285.                         }
  286.                     }
  287.                     
  288.                     if (x==STOP){
  289.                         parent.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_STOPPING_TEXT %>")+ "&moving=yes";
  290.                     }
  291.                     
  292.                     if (x==PAUSE){
  293.                         if (theList[sel].state == STOP){
  294.                             alert("<%= L_SERVICEALREADY_TEXT %>"+gVars.state[STOP]+".");                                
  295.                             doaction = false;                            
  296.                         }
  297.                         else{
  298.                             parent.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_PAUSING_TEXT %>")+ "&moving=yes";
  299.                         }
  300.                     }
  301.  
  302.                     if (x==CONT){
  303.  
  304.                         if (theList[sel].state == START){
  305.                             alert("<%= L_SERVICEALREADY_TEXT %>"+gVars.state[START]+".");        
  306.                             doaction = false;
  307.                         }
  308.                         else{
  309.                             if (theList[sel].state == STOP){
  310.                                 x=START
  311.                             }
  312.                             parent.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CONTING_TEXT %>")+ "&moving=yes";                            
  313.                         }
  314.                     }
  315.  
  316.                     if (doaction){
  317.                         thispath=escape(theList[sel].path);
  318.                         path="a="+x+"&path="+thispath+"&stype="+theList[sel].stype+"&vtype="+theList[sel].vtype + "&sel=" + sel;
  319.  
  320.                         top.connect.location.href="iiaction.asp?"+path
  321.                     }
  322.                 }
  323.             }
  324.             else{
  325.                 alert("<%= L_SERVICEALREADY_TEXT %>"+gVars.state[x]+".");
  326.             }
  327.             parent.list.location.href=parent.list.location.href;
  328.             }
  329.         else{
  330.             alert("<%= L_ONLYSERVER_TEXT %>");
  331.         }
  332.     }
  333.  
  334.     
  335.     function backup(){
  336.         popBox("Backup",405,300,"iibkup");
  337.     }
  338.  
  339.  
  340.     function popBox(title, width, height, filename){
  341.         thefile=(filename + ".asp");
  342.         thefile="iipop.asp?pg="+thefile+"&tools=no";
  343.         <% if Session("Browser") <> "IE3" then %>
  344.             width=width +25;
  345.             height=height + 50;                
  346.         <% end if %>
  347.  
  348.         popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
  349.         if(popbox !=null){
  350.             if (popbox.opener==null){
  351.                 popbox.opener=self;
  352.             }
  353.         }
  354.     }
  355.     
  356. </script>
  357.  
  358.  
  359. </head>
  360.  
  361. <body background="images/iisnav.gif" bgcolor="#000000" link="#FFFFFF" vlink="#FFFFFF" alink="#FFCC00" topmargin="0" leftmargin="0" style="font-face: Verdana; font-size: 10pt;">
  362. <% if Session("IsIE") then %>
  363. <br>
  364. <% end if %>
  365. <img src="images/ism.gif" border="0" alt width="160" height="76"><form name="mnuform">
  366.         <table border="0" cellpadding="4" cellspacing="0">
  367.  
  368.     <tr>
  369.         <td width="50" valign="top" align="right">
  370.             <a href="javascript:add();"><img height="16" width="16" hspace="2" align="middle" src="images/new.gif" border="0" alt="<%= L_NEW_TEXT %>"></a>
  371.         </td>
  372.         <td valign="top">
  373.             <% if isAdmin then %>
  374.             <font face="ARIAL" size="2"><b><a href="javascript:add();"><%= L_NEW_TEXT %></a></b></font> <select name="SvcType" size="1">    <option selected value="Web"><%= L_WEB_TEXT %>...<option value="FTP"><%= L_FTP_TEXT %>...</select>
  375.             <% else %>
  376.             <font face="ARIAL" size="2"><b><a href="javascript:add();"><%= L_NEW_TEXT %></a></b></font>
  377.             <% end if %>
  378.         </td>
  379.     </tr>
  380.  
  381.     <tr>
  382.         <td valign="top" align="right">
  383.             <a href="javascript:deleteItem();"><img height="16" width="16" hspace="2" align="top" src="images/remv.gif" border="0" alt="<%= L_DELETE_TEXT %>"></a>
  384.         </td>
  385.         <td valign="top">
  386.             <font face="ARIAL" size="2"><b><a href="javascript:deleteItem();"><%= L_DELETE_TEXT %></a></b></font>
  387.         </td>
  388.     </tr>
  389.     
  390.         <tr>
  391.         <td valign="top" align="right">
  392.             <a href="javascript:renameItem();"><img height="16" width="16" hspace="2" align="top" src="images/rename.gif" border="0" alt="<%= L_RENAME_TEXT %>"></a>
  393.         </td>
  394.         <td valign="top">
  395.             <font face="ARIAL" size="2"><b><a href="javascript:renameItem();"><%= L_RENAME_TEXT %></a></b></font>
  396.         </td>
  397.     </tr>
  398.  
  399.     <tr>
  400.         <td valign="top" align="right">
  401.             <a href="javascript:edit();"><img height="16" width="16" hspace="2" align="top" src="images/edit.gif" border="0" alt="<%= L_PROPS_TEXT %>"></a>
  402.         </td>
  403.         <td valign="top">
  404.             <font face="ARIAL" size="2"><b><a href="javascript:edit();"><%= L_PROPS_TEXT %></a></b></font>
  405.         </td>
  406.     </tr>
  407.     
  408.     <tr>
  409.         <td colspan="2" valign="middle">
  410.             <font face="ARIAL" size="2"><b> </b></font>
  411.         </td>
  412.     </tr>
  413.  
  414.     <% if isAdmin then %>
  415.     <tr>
  416.         <td valign="top" align="right">
  417.             <a href="javascript:SetState(START);"><img height="16" width="16" hspace="2" align="top" src="images/Next.gif" border="0" alt="<%= L_START_TEXT %>"></a>
  418.         </td>
  419.         <td valign="top">
  420.             <font face="ARIAL" size="2"><b><a href="javascript:SetState(START);"><%= L_START_TEXT %></a></b></font>
  421.         </td>
  422.     </tr>
  423.  
  424.  
  425.     <tr>
  426.         <td valign="top" align="right">
  427.             <a href="javascript:SetState(STOP);"><img height="16" width="16" hspace="2" align="top" src="images/stop.gif" border="0" alt="<%= L_STOP_TEXT %>"></a>
  428.         </td>
  429.         <td valign="top">
  430.             <font face="ARIAL" size="2"><b><a href="javascript:SetState(STOP);"><%= L_STOP_TEXT %></a></b></font>
  431.         </td>
  432.     </tr>
  433.  
  434.     <tr>
  435.         <td valign="top" align="right">
  436.             <a href="javascript:SetState(PAUSE);"><img height="16" width="16" hspace="2" align="top" src="images/pause.gif" border="0" alt="<%= L_PAUSE_TEXT %>"></a>
  437.         </td>
  438.         <td valign="top">
  439.             <font face="ARIAL" size="2"><b><a href="javascript:SetState(PAUSE);"><%= L_PAUSE_TEXT %></a></b></font>
  440.         </td>
  441.     </tr>
  442.  
  443.     <tr>
  444.         <td valign="top" align="right">
  445.             <a href="javascript:SetState(CONT);"><img height="16" width="16" hspace="2" align="top" src="images/cont.gif" border="0" alt="<%= L_RESUME_TEXT %>"></a>
  446.         </td>
  447.         <td valign="top">
  448.             <font face="ARIAL" size="2"><b><a href="javascript:SetState(CONT);"><%= L_RESUME_TEXT %></a></b></font>
  449.         </td>
  450.     </tr>
  451.     
  452.     <tr>
  453.         <td colspan="2" valign="middle">
  454.             <font face="ARIAL" size="2"><b> </b></font>
  455.         </td>
  456.     </tr>    
  457.     
  458.     
  459.     <tr>
  460.         <td valign="top" align="right">
  461.             <a href="javascript:master();"><img height="16" width="16" hspace="2" align="top" src="images/master.gif" border="0" alt="<%= L_BACKUP_TEXT %>"></a>
  462.         </td>
  463.         <td valign="top">
  464.             <font face="ARIAL" size="2"><b><a href="javascript:master();"><%= L_MASTER_TEXT %></a></b></font> <select name="MSvcType" size="1">    <option selected value="www"><%= L_WEB_TEXT %>...<option value="ftp"><%= L_FTP_TEXT %>...</select>
  465.         </td>
  466.     </tr>
  467.  
  468.     
  469.     <tr>
  470.         <td valign="top" align="right">
  471.             <a href="javascript:backup();"><img height="16" width="16" hspace="2" align="top" src="images/save.gif" border="0" alt="<%= L_BACKUP_TEXT %>"></a>
  472.         </td>
  473.         <td valign="top">
  474.             <font face="ARIAL" size="2"><b><a href="javascript:backup();"><%= L_BACKUP_TEXT %></a></b></font>
  475.         </td>
  476.     </tr>
  477.  
  478.     
  479. <% end if %>
  480.  
  481. </table>
  482.  
  483. </form>
  484.  
  485. </body>
  486. </html>