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.

290 lines
5.6 KiB

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="../directives.inc" -->
  4. <!--#include file="jsbrowser.str"-->
  5. <!--#include file="iisetfnt.inc"-->
  6. <%
  7. Const FIXEDDISK = 2
  8. Dim path, FileSystem, drives, drive, primarydrive
  9. path = Request.Cookies("HTMLA")("LASTPATH")
  10. If path = "" Then
  11. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  12. Set drives = FileSystem.Drives
  13. For Each drive in drives
  14. primarydrive = drive
  15. 'exit after the first FIXEDDISK if there is one...
  16. if drive.DriveType = FIXEDDISK then
  17. Exit For
  18. end if
  19. Next
  20. primarydrive = primarydrive & L_SLASH_TEXT
  21. Response.Cookies("HTMLA")("LASTPATH")=primarydrive
  22. path = primarydrive
  23. End If
  24. %>
  25. <HTML>
  26. <HEAD>
  27. <TITLE></TITLE>
  28. <SCRIPT LANGUAGE="JavaScript">
  29. var DRIVE= 0;
  30. var FOLDER = 1;
  31. var FILE = 2;
  32. </SCRIPT>
  33. </HEAD>
  34. <BODY BGCOLOR="<%= Session("BGCOLOR") %>" LINK="#000000" VLINK="#000000" TEXT="#000000" TOPMARGIN=0 LEFTMARGIN=10 onLoad="loadList();">
  35. <FORM NAME="userform" onSubmit="return false;">
  36. <TABLE>
  37. <TR><TD>
  38. <%= sFont("","","",True) %>
  39. <%= L_LOOKIN_TEXT %>
  40. </FONT>
  41. </TD>
  42. <TD>
  43. <INPUT TYPE="text" NAME="currentPath" VALUE="<%= path %>" SIZE = 50 OnBlur="changeDir(this.value);">
  44. </TD>
  45. <TD>
  46. <A HREF="javascript:upDir();"><IMG SRC="updir.GIF" WIDTH=23 HEIGHT=22 BORDER=0></A>
  47. </TD>
  48. </TR>
  49. </TABLE>
  50. </FORM>
  51. <SCRIPT LANGUAGE="JavaScript">
  52. function loadList()
  53. {
  54. parent.hlist.location.href = "JSBrwSet.asp?btype=" + top.opener.JSBrowser.browsertype;
  55. }
  56. function redrawList()
  57. {
  58. parent.list.location.href = "JSBrwLs.asp";
  59. }
  60. function listFuncs()
  61. {
  62. this.loadList = loadList;
  63. this.sortList = sortList;
  64. this.SetFilter = SetFilter;
  65. this.changeDir = changeDir;
  66. this.setPath = setPath;
  67. this.selIndex = 0;
  68. this.sortby = "fname";
  69. this.sortAsc = true;
  70. this.filterType = "";
  71. }
  72. function upDir()
  73. {
  74. lastpath = document.userform.currentPath.value;
  75. parent.filter.document.userform.currentFile.value = "";
  76. uppath = lastpath;
  77. while (lastpath.indexOf("<%= L_FWDSLASH_TEXT %>") > -1)
  78. {
  79. lastpath = lastpath.substring(0,lastpath.indexOf("<%= L_FWDSLASH_TEXT %>")) + "<%= L_DBLSLASH_TEXT %>" + lastpath.substring(lastpath.indexOf("/")+1,lastpath.length);
  80. }
  81. if (lastpath.lastIndexOf("<%= L_DBLSLASH_TEXT %>") == lastpath.length-1)
  82. {
  83. lastpath = lastpath.substring(0,lastpath.length-1);
  84. }
  85. lastwhack = lastpath.lastIndexOf("<%= L_DBLSLASH_TEXT %>");
  86. if (lastwhack > 0)
  87. {
  88. uppath = lastpath.substring(0,lastwhack+1);
  89. }
  90. document.userform.currentPath.value = uppath;
  91. if (lastpath.lastIndexOf(":") == lastpath.length-1)
  92. {
  93. uppath = ":";
  94. document.userform.currentPath.value = "";
  95. }
  96. changeDir(uppath);
  97. }
  98. function changeDir(newpath)
  99. {
  100. newpath.toUpperCase();
  101. var thispath = "JSBrwSet.asp?btype=" + top.opener.JSBrowser.browsertype + "&path=" + escape(newpath);
  102. parent.hlist.location.href = thispath;
  103. return false;
  104. }
  105. function setPath()
  106. {
  107. if (top.opener.JSBrowser == null)
  108. {
  109. top.close();
  110. }
  111. else
  112. {
  113. top.opener.JSBrowser.currentFile = parent.filter.document.userform.currentFile.value;
  114. top.opener.JSBrowser.currentPath = document.userform.currentPath.value;
  115. top.opener.JSBrowser.BrowserObjSetPath();
  116. top.location.href = "JSBrwCl.asp";
  117. }
  118. }
  119. function SetFilter(selFilter)
  120. {
  121. listFunc.filterType = selFilter.options[selFilter.selectedIndex].value;
  122. loadList();
  123. }
  124. function numOrder(a,b)
  125. {
  126. return a[listFunc.sortby]-b[listFunc.sortby];
  127. }
  128. function sortList(sortby,sorttype)
  129. {
  130. if (sortby != listFunc.sortby)
  131. {
  132. listFunc.sortby = sortby;
  133. listFunc.sortAsc = true;
  134. }
  135. else
  136. {
  137. listFunc.sortAsc = !listFunc.sortAsc;
  138. }
  139. if(sortby == "sdate" || sortby == "fsize" )
  140. cachedList.sort(numOrder);
  141. else
  142. cachedList.sort(sortOrder);
  143. if (!listFunc.sortAsc)
  144. {
  145. cachedList.reverse();
  146. }
  147. redrawList();
  148. }
  149. function sortOrder(a,b)
  150. {
  151. astr = (a["oType"] == FOLDER) + a[listFunc.sortby]
  152. bstr = (b["oType"] == FOLDER) + b[listFunc.sortby]
  153. if (astr.toLowerCase() < bstr.toLowerCase())
  154. {
  155. return -1;
  156. }
  157. else
  158. {
  159. if (astr.toLowerCase() > bstr.toLowerCase())
  160. {
  161. return 1;
  162. }
  163. else
  164. {
  165. return 0;
  166. }
  167. }
  168. }
  169. function crop(thestring,size)
  170. {
  171. if (thestring.length > size)
  172. {
  173. thestring = thestring.substring(0,size) + "...";
  174. }
  175. return thestring;
  176. }
  177. function fullname(fname,fext)
  178. {
  179. if (fext == "")
  180. {
  181. return fname;
  182. }
  183. else
  184. {
  185. return (fname + "." + fext);
  186. }
  187. }
  188. function formatsize(iStr)
  189. {
  190. iStr = parseInt(iStr);
  191. if (!isNaN(iStr))
  192. {
  193. iStr = Math.round(iStr/1024);
  194. }
  195. else
  196. {
  197. iStr = 0
  198. }
  199. return iStr;
  200. }
  201. function getLocaleDate(sDate)
  202. {
  203. var oDate = new Date(sDate);
  204. return oDate.toLocaleString();
  205. }
  206. function listObj(fpath, fname,fext, fsize, ftype, lngLastUpdated, strLastUpdated, oType)
  207. {
  208. this.path = fpath;
  209. if (oType == DRIVE)
  210. {
  211. this.icon = "drive.gif";
  212. }
  213. else
  214. {
  215. if (oType == FOLDER)
  216. {
  217. this.icon = "dir.gif";
  218. }
  219. else
  220. {
  221. this.icon = "file.gif";
  222. }
  223. }
  224. this.oType = oType;
  225. this.fname = fname;
  226. this.fext = fext;
  227. this.displayname = crop(fullname(fname,fext),<%= L_NAMECHARS_NUM %>);
  228. this.fsize = fsize;
  229. this.displaysize = formatsize(fsize);
  230. this.ftype = crop(ftype,<%= L_TYPECHARS_NUM %>);
  231. this.nodetype = ftype
  232. this.sdate = lngLastUpdated;
  233. this.lastupdated = strLastUpdated;
  234. this.displaydate = crop(this.lastupdated ,<%= L_LASTMODIFIEDCHARS_NUM %>);
  235. this.deleted = false;
  236. this.updated = false;
  237. this.newitem = false;
  238. }
  239. cachedList = new Array();
  240. listFunc = new listFuncs();
  241. </SCRIPT>
  242. </BODY>
  243. </HTML>