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.

283 lines
4.8 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="../directives.inc" -->
  4. <!--#include file="jsbrowser.str"-->
  5. <%
  6. Const FIXEDDISK = 2
  7. %>
  8. <HTML>
  9. <HEAD>
  10. <TITLE></TITLE>
  11. <SCRIPT LANGUAGE="JavaScript">
  12. var DRIVE= 0;
  13. var FOLDER = 1;
  14. var FILE = 2;
  15. var REDRAW = true;
  16. </SCRIPT>
  17. </HEAD>
  18. <BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" ALINK="#000000" TOPMARGIN = 5 LEFTMARGIN = 5 onLoad="loadList();">
  19. <FORM NAME="userform" onSubmit="return false;">
  20. <TABLE>
  21. <TR>
  22. <TD WIDTH = 100%>
  23. <FONT FACE="Helv" SIZE = 1>
  24. <%= L_SELDIR_TEXT %>
  25. </FONT>
  26. </TD>
  27. </TR>
  28. </TABLE>
  29. </FORM>
  30. <SCRIPT LANGUAGE="JavaScript">
  31. function loadList()
  32. {
  33. parent.list.location.href = "JSBrwLs.asp";
  34. }
  35. function redrawList()
  36. {
  37. parent.list.location.href = "JSBrwLs.asp";
  38. }
  39. function expandItem(item,paint)
  40. {
  41. var theList = cachedList;
  42. var theitem = theList[item];
  43. theitem.open = true;
  44. listFunc.selIndex=item;
  45. if (!theitem.cached)
  46. {
  47. var thepath = escape(theitem.fspath);
  48. thepath = thepath + "&newid=" + theList.length + "&item=" + item;
  49. parent.hlist.location.href = "jsbrwset.asp?fspath=" + thepath;
  50. theitem.cached = true;
  51. }
  52. // Changed from if to else if --
  53. // Let jsbrwset.asp refresh the list.
  54. else if (paint)
  55. {
  56. listFunc.loadList();
  57. }
  58. }
  59. function expandPath(thisPath)
  60. {
  61. for (var i=0;i < cachedList.length; i++)
  62. {
  63. if (cachedList[i].fspath == thisPath)
  64. {
  65. expandItem(i,!REDRAW);
  66. return;
  67. }
  68. }
  69. }
  70. function sortOrder(a,b){
  71. x=a.id - b.id
  72. return x
  73. }
  74. function sortList(){
  75. cachedList.sort(sortOrder);
  76. }
  77. function markTerms(){
  78. //marks cached list items as being a terminater (ie, having no siblings)
  79. //this forces an "end" gif in the tree view...
  80. var i
  81. var listLength=cachedList.length;
  82. for (i=0; i < listLength; i++) {
  83. cachedList[i].lastChild=isLast(i);
  84. }
  85. }
  86. function isLast(item)
  87. {
  88. var i;
  89. last=false;
  90. var listLength=cachedList.length;
  91. if (item+1==listLength)
  92. {
  93. last=true;
  94. }
  95. else
  96. {
  97. if (cachedList[item].parentid==null)
  98. {
  99. last=true;
  100. for (i=item+1; i < listLength; i++)
  101. {
  102. if (cachedList[i].parentid==null)
  103. {
  104. last=false;
  105. break;
  106. }
  107. }
  108. }
  109. else
  110. {
  111. last=true;
  112. var y=item+1;
  113. while(cachedList[y].parentid >=cachedList[item].parentid)
  114. {
  115. if(cachedList[y].parentid==cachedList[item].parentid)
  116. {
  117. if(!cachedList[y].deleted)
  118. {
  119. last=false;
  120. break;
  121. }
  122. }
  123. y=y+1;
  124. if ((y)==listLength)
  125. {
  126. break;
  127. }
  128. }
  129. }
  130. }
  131. return last;
  132. }
  133. function setPath()
  134. {
  135. if (top.opener.JSBrowser == null)
  136. {
  137. top.close();
  138. }
  139. else
  140. {
  141. top.opener.JSBrowser.currentPath = cachedList[listFunc.selIndex].fspath;
  142. top.opener.JSBrowser.BrowserObjSetPath();
  143. top.location.href = "JSBrwCl.asp";
  144. }
  145. }
  146. function listFuncs()
  147. {
  148. this.loadList = loadList;
  149. this.selIndex = 0;
  150. this.setPath = setPath;
  151. this.expandItem = expandItem;
  152. this.expandPath = expandPath;
  153. }
  154. function listObj(id,fspath,fname,parentid)
  155. {
  156. this.id = id;
  157. this.selected = false;
  158. this.open = false;
  159. this.cached = false;
  160. this.fspath = fspath;
  161. this.fname = fname;
  162. this.lastChild = false;
  163. if (parentid == null)
  164. {
  165. this.level = 1;
  166. this.icon = "fdisk.gif";
  167. this.openicon = "fdisk.gif";
  168. }
  169. else
  170. {
  171. this.level = cachedList[parentid].level+1;
  172. if (parentid == 0)
  173. {
  174. this.icon = "fdisk.gif";
  175. this.openicon = "fdisk.gif";
  176. }
  177. else
  178. {
  179. this.icon = "cdir.gif";
  180. this.openicon = "odir.gif";
  181. }
  182. }
  183. this.parentid = parentid;
  184. this.markTerms = markTerms;
  185. this.sortList = sortList;
  186. }
  187. cachedList = new Array();
  188. listFunc = new listFuncs();
  189. <%
  190. Dim FileSystem, drives, drive, newid
  191. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  192. Set drives = FileSystem.Drives
  193. %>
  194. cachedList[0]= new listObj(0,"","<%= L_MYCOMPUTER_TEXT %>",null);
  195. cachedList[0].open = true;
  196. cachedList[0].cached = true;
  197. <%
  198. newid = 1
  199. For Each drive in drives
  200. ' This makes things too slow, but it does only show working drives.
  201. ' if drive.IsReady then
  202. %>
  203. cachedList[<%= newid %>]= new listObj(<%= newid %>,"<%= drive.DriveLetter & ":\\" %>","<%= drive.DriveLetter %>",0);
  204. <%
  205. newid = newid + 1
  206. ' end if
  207. Next
  208. %>
  209. cachedList[0].markTerms();
  210. var pathCntrl = top.opener.JSBrowser.pathCntrl;
  211. var selpath = "";
  212. if (selpath != "")
  213. {
  214. var lastLength = 0;
  215. var curLength = 0;
  216. var x = 0;
  217. var parsing = true;
  218. while(parsing)
  219. {
  220. lastLength = selpath.indexOf("\\",lastLength+1);
  221. if (x > 100)
  222. {
  223. parsing = false;;
  224. }
  225. x++;
  226. if (lastLength == -1)
  227. {
  228. parsing = false;
  229. }
  230. curpath = selpath.substr(0, lastLength+1);
  231. //alert(curpath);
  232. expandPath(curpath, !REDRAW);
  233. }
  234. expandPath(selpath, REDRAW);
  235. }
  236. </SCRIPT>
  237. </BODY>
  238. </HTML>