Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
3.6 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% 'Option Explicit %>
  3. <!-- #include file="../directives.inc" -->
  4. <!--#include file="jsbrowser.str"-->
  5. <%
  6. 'Call this page with a query string of ?sname=machinename
  7. 'example: http://larad01/iis/iicnct.asp?sname=larad01
  8. 'On Error Resume Next
  9. Dim path, sname, scripttimeout, FileSystem, quote, errd, currentADsObj, lastobj
  10. Dim newid, topid, firstid, currentid, numNewItems
  11. 'This script can take a _long_ time to execute,
  12. 'as we may be dealing with thousands of items
  13. 'to add to our JScript object.
  14. 'save our current script timeout value & set to a much longer value...
  15. scripttimeout = Server.ScriptTimeOut
  16. Server.ScriptTimeOut = 2000
  17. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  18. path=Request.QueryString("fspath")
  19. quote=chr(34)
  20. errd=False
  21. lastobj = ""
  22. %>
  23. <HTML>
  24. <HEAD>
  25. <SCRIPT LANGUAGE="JavaScript">
  26. var theList=parent.head.cachedList;
  27. var listFuncs = new parent.head.listFuncs();
  28. <%
  29. if errd=0 then
  30. newid=Request("newid")
  31. firstid=newid
  32. if firstid="" then
  33. firstid=0
  34. end if
  35. currentid=Request("item")
  36. if currentid="" then
  37. currentid=firstid
  38. newid=newid + 1
  39. end if
  40. numNewItems=0
  41. Response.write "//" & path
  42. Response.write "//" & currentid
  43. addDirs path, currentid
  44. Server.ScriptTimeOut = scripttimeout
  45. end if
  46. Sub addDirs(path, parentid)
  47. Dim thisid, thisname, thisstate, thisadspath, i, f
  48. if path <> "" then
  49. if FileSystem.FolderExists(path) then
  50. Set f=FileSystem.GetFolder(path)
  51. For Each i In f.SubFolders
  52. thisid=newid
  53. SetJscriptObj i, i.Name,parentid
  54. numNewItems=numNewItems + 1
  55. Next
  56. end if
  57. end if
  58. End Sub
  59. Sub SetJscriptObj(path, caption, parentid)
  60. %>
  61. theList[<%= newid %>]=new parent.head.listObj(<%= newid %>,"<%= Replace(path,"\","\\") %>","<%= caption %>",<%= parentid %>);
  62. <%
  63. newid=newid + 1
  64. End Sub
  65. ' we need to insert the whole group into the correct place In the array.
  66. ' since we Set the first entry (machine) to the exisitng place In the array,
  67. ' the Next level In the hierarchy (vservers) will be pointing to the correct
  68. ' parent ids. However, the following level (vdirs, and below) will be pointing
  69. ' to the parent ids as they existed at the bottom of the array, before the
  70. ' move, and will need to be adjusted.
  71. %>
  72. <% if errd=0 then %>
  73. var item=<%= firstid %>;
  74. currentid=<%= currentid %>;
  75. if (currentid !=item){
  76. x=currentid + 1;
  77. //correct the id on the "new" objects
  78. for (var i=item; i < theList.length; i++) {
  79. theList[i].id=x;
  80. if (theList[i].parentid !=currentid){
  81. theList[i].parentid=theList[i].parentid - (item - (currentid + 1));
  82. }
  83. x++;
  84. }
  85. //move the following records "down" the array
  86. for (var i=currentid + 1; i < item;i++){
  87. theList[i].id=theList[i].id + <%= numNewItems %>;
  88. if (theList[i].parentid >currentid){
  89. theList[i].parentid=theList[i].parentid + <%= numNewItems %>;
  90. }
  91. }
  92. }
  93. //and re-sort.
  94. theList[0].sortList();
  95. theList[0].markTerms();
  96. if (theList.length==1){
  97. listFuncs.selIndex=0;
  98. theList[0].selected=true;
  99. }
  100. else{
  101. theList[listFuncs.selIndex].selected=false;
  102. listFuncs.selIndex=<%= currentid %>;
  103. theList[<%= currentid %>].selected=true;
  104. }
  105. // Force a refresh
  106. listFuncs.loadList();
  107. <% else %>
  108. alert("<%= L_CNCTERR_TEXT %> (<%= err %>)");
  109. <% end if %>
  110. </SCRIPT>
  111. <% if err <> 0 then %>
  112. <% Response.write "err: " & err.description %><BR>
  113. <% Response.write "currentcontainer: " & currentADsObj.ADsPath %><BR>
  114. <% Response.write " " & currentADsObj.KeyType %><BR>
  115. <% Response.write "Err Container:" & lastobj %><BR>
  116. <% end if %>
  117. </HEAD>
  118. <BODY>
  119. </BODY>
  120. </HTML>