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

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <%
  6. Const L_RENAME_ERR="The node could not be renamed."
  7. %>
  8.  
  9. <HTML>
  10.  
  11. <%
  12. On Error Resume Next 
  13.  
  14. Dim nodename, path, currentobj, newobj, sel,baseobj, basepath
  15.  
  16. nodename=Request.QueryString("nodename")
  17. path=Request.QueryString("path")
  18. sel=Request.QueryString("sel")
  19. Set currentobj=GetObject(path)
  20.  
  21. Response.write nodename & "<BR>"
  22. Response.write path & "<BR>"
  23. if Instr(currentobj.KeyType,"Server") then
  24.     currentobj.ServerComment = nodename
  25.     currentobj.SetInfo
  26.     Set newobj = GetObject(path)
  27. elseif Instr(currentobj.KeyType,"VirtualDir") then
  28.  
  29.     Response.write currentobj.ADsPath & "<BR>"
  30.  
  31.     'and cyle through the baseobj till we find the next whack,
  32.     'building up the path in new name as we go
  33.     basepath = Mid(currentobj.ADsPath,1,InStrRev(currentobj.ADsPath,"/")-1)
  34.     Response.write baseobj & "<BR>"
  35.     Set baseobj=GetObject(basepath)
  36.  
  37.     Response.write nodename & "<BR>"
  38.     Set newobj = baseobj.MoveHere(currentobj.Name,nodename)
  39.     newobj.SetInfo
  40.     Response.write err
  41. end if
  42.                                 
  43.  %>
  44.  
  45. <BODY BGCOLOR="#000000" TEXT="#FFCC00" TOPMARGIN=0 LEFTMARGIN=0>
  46. <SCRIPT LANGUAGE="JavaScript">
  47.     <% if err.Number = 0 then %>
  48.     // Now that we've set it in the object, we need to update our client cachedList:
  49.     top.title.nodeList[<%= sel %>].title = "<%= nodename %>";
  50.     top.title.nodeList[<%= sel %>].path = "<%= newobj.ADsPath %>"
  51.     top.body.list.location.href="iisrvls.asp";
  52.     <% else %>
  53.         alert("<%= L_RENAME_ERR %> (<%= err.description %>)");
  54.     <% end if %>
  55. </SCRIPT>
  56. </BODY>
  57. </HTML>