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.

154 lines
4.0 KiB

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="../directives.inc" -->
  4. <!-- #include file="jsbrowser.str"-->
  5. <%
  6. Const TDIR = 0
  7. Const TFILE = 1
  8. Const FIXEDDISK = 2
  9. Const HIDDEN = 2
  10. Const MAX_FS_OBJS = 200 'Maximum number of JavaScript browser objects before heap overflow
  11. Dim i, newid, path, f, sc, fc, fl, FileSystem, iFldrCntr, iFileCntr
  12. Dim btype, drive, drives, bToManyFSObjects, primarydrive
  13. bToManyFSObjects = False
  14. newid = 0
  15. bType = CInt(Request.Querystring("btype"))
  16. iFldrCntr = 1 'Count from 1 to MAX_FS_OBJS
  17. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  18. Set drives = FileSystem.Drives
  19. For Each drive In drives
  20. primarydrive = drive
  21. 'Exit after the first FIXEDDISK if there is one...
  22. If drive.DriveType = FIXEDDISK Then
  23. Exit For
  24. End If
  25. Next
  26. primarydrive = primarydrive & L_SLASH_TEXT
  27. If Request.QueryString("path") <> "" Then
  28. path = Request.QueryString("path")
  29. If FileSystem.FolderExists(path) Then
  30. Response.Cookies("HTMLA")("LASTPATH")=path
  31. End If
  32. Else
  33. path = Request.Cookies("HTMLA")("LASTPATH")
  34. End If
  35. If path = "" Then
  36. Response.Cookies("HTMLA")("LASTPATH")=primarydrive
  37. path = primarydrive
  38. End If
  39. %>
  40. <HTML>
  41. <HEAD>
  42. <SCRIPT LANGUAGE="JavaScript">
  43. var DRIVE = 0
  44. var FOLDER = 1
  45. var FILE = 2
  46. <%
  47. If path = ":" Then 'Path
  48. %>
  49. top.main.head.cachedList = new Array();
  50. cachedList = top.main.head.cachedList;
  51. <%
  52. For Each drive In drives
  53. 'exit after the first FIXEDDISK if there is one...
  54. If drive.DriveType = FIXEDDISK Then
  55. %>
  56. cachedList[<%= newid %>]= new top.main.head.listObj("<%= drive.Path & L_DBLSLASH_TEXT %>","<%= drive.DriveLetter %>","","","<%= drive.DriveType %>","","",DRIVE);
  57. <%
  58. newid = newid +1
  59. End If
  60. Next
  61. %>
  62. top.main.head.listFunc.selIndex=0;
  63. top.main.list.location.href ="JSBrwLs.asp";
  64. <%
  65. Else
  66. If FileSystem.FolderExists(path) Then 'FileSystem
  67. %>
  68. top.main.head.cachedList = new Array();
  69. cachedList = top.main.head.cachedList;
  70. <%
  71. Set f=FileSystem.GetFolder(path)
  72. Set sc = f.SubFolders
  73. For Each i In sc
  74. 'Do not print more than the MAX_FS_OBJS limit
  75. If iFldrCntr > MAX_FS_OBJS Then
  76. bToManyFSObjects = True
  77. Exit For
  78. End If
  79. 'Print out only those i that are not hidden.
  80. If Not (i.Attributes AND HIDDEN) = HIDDEN Then
  81. %>
  82. cachedList[<%= newid %>]= new top.main.head.listObj("<%= Replace(i,L_SLASH_TEXT,L_DBLSLASH_TEXT) %>","<%= i.name %>","","","<%= i.Type %>","<%= CLng(10000*i.DateLastModified) %>","<%= CStr(i.DateLastModified) %>",FOLDER);
  83. <%
  84. newid = newid +1
  85. iFldrCntr = iFldrCntr + 1
  86. End If
  87. Next
  88. 'Make sure that !printed MAX_FS_OBJS
  89. If bType = TFILE And bToManyFSObjects = False Then
  90. Set fc = f.Files
  91. iFileCntr = iFldrCntr 'Start counting where iFldrCntr left off
  92. For Each fl In fc
  93. If iFileCntr > MAX_FS_OBJS Then
  94. bToManyFSObjects = True
  95. Exit For
  96. End If
  97. 'Print out only those fl that are not hidden.
  98. If Not (fl.Attributes AND HIDDEN) = HIDDEN Then
  99. %>
  100. cachedList[<%= newid %>]= new top.main.head.listObj("<%= Replace(i,L_SLASH_TEXT,L_DBLSLASH_TEXT) %>","<%= fl.name %>","","<%= fl.size %>","<%= fl.Type %>","<%= CLng(10000*fl.DateLastModified) %>","<%= CStr(fl.DateLastModified) %>",FILE);
  101. <%
  102. newid = newid +1
  103. iFileCntr = iFileCntr + 1
  104. End If
  105. Next
  106. End If
  107. %>
  108. top.main.head.listFunc.selIndex=0;
  109. top.main.list.location.href ="JSBrwLs.asp";
  110. <%
  111. If bToManyFSObjects = True Then
  112. %>
  113. alert(top.main.head.document.userform.currentPath.value + "\r\r<%= L_TOMANYFSOBJECTS_TEXT %>");
  114. <%
  115. End If
  116. Else
  117. %>
  118. alert(top.main.head.document.userform.currentPath.value+"\r\r<%= L_PATHNOTFOUND_TEXT %>");
  119. top.main.head.document.userform.currentPath.value = "<%= Replace(Request.Cookies("HTMLA")("LASTPATH"),L_SLASH_TEXT,L_DBLSLASH_TEXT) %>";
  120. <%
  121. End If 'FileSystem
  122. End If 'Path
  123. %>
  124. </SCRIPT>
  125. </HEAD>
  126. <BODY bgcolor="silver">
  127. </BODY>
  128. </HTML>