home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_03.cab / iimnu.asp < prev    next >
Text File  |  1997-11-12  |  15KB  |  495 lines

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