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

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