home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_03.cab / jsbrwset.asp < prev    next >
Text File  |  1997-11-13  |  2KB  |  98 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <%    
  6.  
  7.     Const L_PATHNOTFOUND_TEXT = "The path was not found."
  8.     Const L_SLASH_TEXT = "\"    
  9.  
  10.     Const TDIR = 0
  11.     Const TFILE = 1
  12.     
  13.     Const FIXEDDISK = 2
  14.  
  15.     
  16.     Dim i, newid,path, f, sc, fc, fl, FileSystem,btype,drive, drives
  17.     Dim primarydrive
  18.     
  19.     bType = CInt(Request.Querystring("btype"))
  20.     
  21.     Set FileSystem=CreateObject("Scripting.FileSystemObject")
  22.     Set drives = FileSystem.Drives
  23.  
  24.     For Each drive in drives
  25.         primarydrive = drive    
  26.         
  27.         'exit after the first FIXEDDISK if there is one...
  28.         if drive.DriveType = FIXEDDISK then
  29.             Exit For            
  30.         end if
  31.         
  32.     Next
  33.     
  34.     primarydrive = primarydrive & L_SLASH_TEXT
  35.     
  36.     newid = 0
  37.     
  38.     If Request.QueryString("path") <> "" Then
  39.         path = Request.QueryString("path")    
  40.         if FileSystem.FolderExists(path) then
  41.             Response.Cookies("HTMLA")("LASTPATH")=path            
  42.         end if
  43.     Else
  44.         path = Request.Cookies("HTMLA")("LASTPATH")
  45.     End If 
  46.  
  47.     If path = "" Then
  48.         Response.Cookies("HTMLA")("LASTPATH")=primarydrive
  49.         path = primarydrive
  50.     End If    
  51. %>
  52.  
  53. <HTML>
  54. <HEAD>
  55.  
  56. <SCRIPT LANGUAGE="JavaScript">
  57.  
  58.     <% if FileSystem.FolderExists(path) then %>
  59.         top.main.head.cachedList = new Array();
  60.         cachedList = top.main.head.cachedList;        
  61.     <%    
  62.          Set f=FileSystem.GetFolder(path)
  63.          Set sc = f.SubFolders
  64.          For Each i In sc
  65.              if i.Attributes AND 2 then                     
  66.             else
  67.              %>
  68.              cachedList[<%= newid %>]= new top.main.head.listObj("<%= Replace(i,"\","\\") %>","<%= i.name %>","","","<%= i.Type %>","<%= i.DateLastModified %>",true);
  69.              <%
  70.              newid = newid +1     
  71.             end if
  72.          Next
  73.          if bType = TFILE then 
  74.              Set fc = f.Files
  75.              For Each fl in fc
  76.                  if fl.Attributes AND 2 then                     
  77.                 else
  78.                      %>
  79.                      cachedList[<%= newid %>]= new top.main.head.listObj("<%= Replace(i,"\","\\") %>","<%= fl.name %>","","<%= fl.size %>","<%= fl.Type %>","<%= fl.DateLastModified %>",false);
  80.                      <%
  81.                      newid = newid +1                         
  82.                  end if
  83.  
  84.              Next
  85.          end if
  86.     %>         
  87.         top.main.head.listFunc.selIndex=0;
  88.         top.main.list.location.href ="JSBrwLs.asp";
  89.     <% else %>
  90.         alert(top.main.head.document.userform.currentPath.value+"\r\r<%= L_PATHNOTFOUND_TEXT %>");
  91.         top.main.head.document.userform.currentPath.value = "<%= Replace(Request.Cookies("HTMLA")("LASTPATH"),"\","\\") %>";        
  92.     <% end if %>
  93. </SCRIPT>
  94.  
  95. </HEAD>
  96. <BODY>
  97. </BODY>
  98. </HTML>