home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 March / VPR0003B.ISO / nec98 / iiput.asp < prev    next >
Text File  |  1999-10-14  |  6KB  |  245 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <%
  6.  
  7. Const L_CHANGESSAVED_TEXT="変更が保存されました。"
  8. Const ADS_PROPERTY_CLEAR = 1
  9. Const IIS_DATA_INHERIT = 1
  10. %>
  11.  
  12. <HTML>
  13. <HEAD>
  14.  
  15.  
  16. <% 
  17. On Error Resume Next 
  18.  
  19. Dim path, lasterr, currentobj, key, sobj, specprops, newval,dirkeyType
  20. Dim changed, objname, thisobj, value, bval, curval,quote, childpath, aSetChildPaths
  21. Dim clearPaths, child, proparray
  22. dirkeyType = "IIsWebDirectory"
  23. quote = chr(34)
  24.  
  25. lasterr=""
  26. path=Session("path")
  27. Response.write path
  28.  
  29. if Session("clearPathsOneTime") <> "" then 
  30.     clearPaths = Session("clearPathsOneTime")
  31. else
  32.     clearPaths = (Session("clearPaths") <> "")
  33. end if
  34. Set currentobj=GetObject(path)
  35.  
  36. %>
  37. <!--#include file="iifixpth.inc"-->
  38. <%
  39.  
  40. specprops = "SERVERBINDINGS,HTTPEXPIRES,GRANTBYDEFAULT,MSDOSDIROUTPUT," & _
  41. "HCDOSTATICCOMPRESSION,HCDODYNAMICCOMPRESSION,HCCOMPRESSIONDIRECTORY," & _
  42. "HCDODISKSPACELIMITING,HCMAXDISKSPACEUSAGE,APPISOLATED"
  43.  
  44. changed=false
  45.  
  46. For Each key In Request.QueryString
  47.     key = UCase(key)
  48.     changed=false
  49.     Response.write key & "<BR>"
  50.     if (key <>"PAGE" ) and (key <> "STATE") and  (key <> "CLEARPATHS")  then
  51.         if inStr(specprops,key) <> 0 then
  52.             err=0
  53.             Set thisobj=sobj        
  54.             value=Request.QueryString(key)
  55.             if UCase(value)="TRUE" then
  56.                 bval=True
  57.             else
  58.                 bval=False
  59.             end if 
  60.  
  61.             Select Case UCase(key)
  62.             Case "GRANTBYDEFAULT" 
  63.                 if thisobj.GrantbyDefault <> bval then
  64.                     changed = true    
  65.                     thisobj.GrantbyDefault=bval                
  66.                 end if
  67.                 currentobj.IPSecurity=thisobj
  68.  
  69.             Case "FRONTPAGEWEB"
  70.                 if thisobj.FrontPageWeb <> bval then            
  71.                     changed = true                    
  72.                     thisobj.FrontPageWeb=bval
  73.                 end if
  74.                 
  75.             Case "MSDOSDIROUTPUT"
  76.                 if thisobj.MSDOSDirOutput <> bval then            
  77.                     changed = true                    
  78.                     thisobj.MSDOSDirOutput=bval
  79.  
  80.                 end if        
  81.                 
  82.             Case "HTTPEXPIRES"
  83.                 if value = "d,-1" then            
  84.                     changed = true                    
  85.                     thisobj.HttpExpires = ""
  86.                 else
  87.                     if thisobj.HttpExpires <> value then
  88.                         changed = true    
  89.                         thisobj.Put key, (value)
  90.                     end if
  91.                 end if
  92.  
  93.             Case "SERVERBINDINGS"            
  94.                 Dim bindings
  95.                 Response.write "ServerBindings:"
  96.                 bindings = split(value,",")
  97.                 Response.write "Bound:" & UBound(bindings)
  98.                 if chkUpdated(thisobj.ServerBindings,bindings) then
  99.                     thisobj.Put key, (bindings)
  100.                 end if
  101.                 
  102.             End Select
  103.             
  104.             thisobj.SetInfo
  105.     
  106.         else
  107.             Set thisobj=currentobj
  108.  
  109.             newval=Request.QueryString(key)        
  110.             curval=thisobj.Get(key)
  111.                     
  112.                 if not isArray(curval) then
  113.                     Select Case typename(curval)
  114.                         Case "Boolean" 
  115.                             if UCase(newval)="TRUE" then
  116.                                 value=True
  117.                             else
  118.                                 value=False
  119.                             end if 
  120.                         Case "Long"
  121.                             value = cLng(newval)
  122.                         Case Else
  123.                             value = newval
  124.                     End Select
  125.                     
  126.                     if curval <> value then    
  127.                         changed = true                                                
  128.                         thisobj.Put key, (value)
  129.                     end if    
  130.                 else
  131.                     ReDim proparray(0)
  132.                     proparray(0) = newval
  133.                     if chkUpdated(curval,proparray) then
  134.                         thisobj.Put key, (proparray)
  135.                     end if
  136.                 end if            
  137.  
  138.                 thisobj.SetInfo
  139.         end if
  140.     end if
  141.  
  142.     if changed then
  143.  
  144.         if clearPaths then
  145.             aSetChildPaths = thisobj.GetDataPaths(key,IIS_DATA_INHERIT) 
  146.             if err = 0 then
  147.                 For Each childpath in aSetChildPaths
  148.                     childPath = cleanPath(childPath)
  149.                 
  150.                     Set child = GetObject(childpath)
  151.                     if child.ADSPath <> thisobj.ADSPath then
  152.                         if (instr(LCase(child.ADSPath), "IIS://localhost/w3svc/info") > 0) OR (instr(LCase(child.ADSPath), "IIS://localhost/msftpsvc/info") > 0) then
  153.                         else
  154.                             child.PutEx ADS_PROPERTY_CLEAR, key, ""
  155.                             child.SetInfo
  156.                         end if
  157.                     end if
  158.                 Next    
  159.             end if
  160.             err = 0
  161.         end if
  162.     end if
  163. Next
  164.  
  165. currentobj.SetInfo
  166.  
  167.  
  168. Function cleanPath(pathstr)
  169.     if Right(pathstr,1) = "/" then
  170.         pathstr = Mid(pathstr, 1,len(pathstr)-1)
  171.     end if
  172.     cleanPath = pathstr
  173. End Function
  174.  
  175. Function chkUpdated(oldarray,proparray)
  176.  
  177.     dim proparraybound,arrayWasUpdated, i
  178.     
  179.     if IsArray(oldarray) then
  180.         proparraybound=UBound(proparray)
  181.         if UBound(oldarray) <> proparraybound then
  182.             arrayWasUpdated=true
  183.         else
  184.             for i=0 to proparraybound
  185.                 if oldarray(i) <> proparray(i) then                    
  186.                     arrayWasUpdated=true
  187.                 end if
  188.             Next
  189.         end if
  190.     else        
  191.         if proparraybound > 0 then
  192.             arrayWasUpdated=true
  193.         else
  194.             arrayWasUpdated=(proparray(0) <> oldarray)            
  195.         end if
  196.     end if
  197.     
  198.     'set our global changed var
  199.     changed = arrayWasUpdated
  200.     
  201.     chkUpdated = arrayWasUpdated
  202.     
  203. End Function
  204.  
  205. %>
  206.  
  207. </HEAD>
  208.  
  209. <BODY BGCOLOR="#000000" TEXT="#FFCC00" TOPMARGIN=0 LEFTMARGIN=0>
  210. <SCRIPT LANGUAGE="JavaScript">
  211.  
  212.     <% if Request.QueryString("PAGE") <> "popup" then %>
  213.     top.title.Global.updated=false;
  214.     if (top.body.frames.length > 0){    
  215.         <% if Request("ServerComment") <> "" then %>
  216.         top.title.nodeList[top.title.Global.selId].title="<%= Request("ServerComment") %>";
  217.         if (top.body.menu != null){
  218.             top.body.menu.location.href=top.body.menu.location.href;
  219.         }
  220.         <% end if %>
  221.         
  222.  
  223.         if (top.body.frames.length > 3){
  224.         <% if Session("IsIE") then %>
  225.             top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  226.         
  227.         <% else %>
  228.             top.body.frames[3].location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  229.         <% end if %>            
  230.         }
  231.         else{
  232.             if (top.body.iisstatus != null){    
  233.                 top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  234.             }
  235.         }
  236.     }    
  237.     <% end if %>
  238.     
  239. </SCRIPT>
  240.  
  241. </BODY>
  242. </HTML>
  243.  
  244.  
  245.