home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 March / VPR0003B.ISO / alpha / jsbrwhd.asp < prev    next >
Text File  |  1999-10-14  |  7KB  |  330 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <% 
  6.  
  7. Const L_LOOKIN_TEXT = "ファイルの場所:"
  8. Const L_NAME_TEXT = "名前"
  9. Const L_SIZE_TEXT = "サイズ"
  10. Const L_TYPE_TEXT = "種類"
  11. Const L_LASTMODIFIED_TEXT = "変更日"
  12. Const L_SLASH_TEXT = "\"    
  13. Const L_DBLSLASH_TEXT = "\\"    
  14. Const L_FWDSLASH_TEXT = "/"    
  15. Const FIXEDDISK = 2
  16.  
  17. Dim path, FileSystem, drives, drive, primarydrive
  18.  
  19. path = Request.Cookies("HTMLA")("LASTPATH")
  20.  
  21. If path = "" Then
  22.     Set FileSystem=CreateObject("Scripting.FileSystemObject")
  23.     Set drives = FileSystem.Drives
  24.  
  25.     For Each drive in drives
  26.         primarydrive = drive    
  27.         
  28.         'exit after the first FIXEDDISK if there is one...
  29.         if drive.DriveType = FIXEDDISK then
  30.             Exit For            
  31.         end if
  32.         
  33.     Next
  34.     
  35.     primarydrive = primarydrive & L_SLASH_TEXT
  36.  
  37.     Response.Cookies("HTMLA")("LASTPATH")=primarydrive
  38.     path = primarydrive
  39. End If
  40. %>
  41.  
  42. <HTML>
  43. <HEAD>
  44.     <TITLE></TITLE>
  45.     
  46.     <SCRIPT LANGUAGE="JavaScript">
  47.     
  48.     function writeTblOpen(){
  49.             document.write("<TABLE BORDER = 1 CELLPADDING = 1 CELLSPACING = 0  BORDERCOLOR='#CCCCCC'  BORDERCOLORDARK='#CCCCCC' BORDERCOLORLIGHT='#CCCCCC'><TR>");            
  50.     }
  51.     
  52.     function writeTblClose(){
  53.         document.write("</TABLE>");
  54.     }
  55.     
  56.     function writeTblHead(cellwidth,sortcol,sorttype,stringwidth,thestring)
  57.         {
  58.         var i;    
  59.         var quote = '"'
  60.                 
  61.         if (isNaN(stringwidth))
  62.         {
  63.             stringwidth = 20;
  64.         }
  65.                 
  66.         var writestr = "<TD WIDTH=" + cellwidth + " BORDER = 1  BORDERCOLOR='#CCCCCC' BORDERCOLORDARK='#FFFFFF' BORDERCOLORLIGHT='#000000'><FONT SIZE=2>";
  67.         if (sortcol != "")
  68.         {
  69.             writestr += "<A HREF = 'javascript:sortList("+quote+sortcol+quote+","+quote+sorttype+quote+");'>";
  70.             stringwidth = stringwidth - thestring.length;
  71.             for (i=stringwidth;i>0;i--)
  72.             {
  73.             thestring += " "
  74.             }
  75.         writestr += thestring;        
  76.         writestr += "</A></TD>";
  77.         }
  78.         else
  79.         {
  80.             stringwidth = stringwidth - thestring.length;
  81.             for (i=stringwidth;i>0;i--)
  82.                 {
  83.                 thestring += " "
  84.                 }
  85.             writestr += thestring;        
  86.             writestr += "</TD>";        
  87.         }
  88.     
  89.  
  90.         document.write(writestr);        
  91.         return;
  92.         }
  93.     </SCRIPT>
  94. </HEAD>
  95.  
  96. <BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" ALINK="#000000" TOPMARGIN = 5 LEFTMARGIN = 5 onLoad="loadList();">
  97. <FORM NAME="userform" onSubmit="return false;">
  98.  
  99. <TABLE>
  100. <TR><TD WIDTH = 110><FONT SIZE = 2>
  101.     <%= L_LOOKIN_TEXT %>
  102.     </TD>
  103.     <TD>
  104.     <INPUT TYPE="text" NAME="currentPath" VALUE="<%= path %>" SIZE = 50 OnBlur="changeDir(this.value);">
  105.     </TD>
  106.     <TD>
  107.         <A HREF="javascript:upDir();"><IMG SRC="updir.GIF" WIDTH=23 HEIGHT=22 BORDER=0></A>
  108.     </TD>
  109.     </TR>
  110. </TABLE>
  111.  
  112. <SCRIPT LANGUAGE="JavaScript">
  113.     writeTblOpen();
  114.     writeTblHead(175, "fname", "str", 0,"<%= L_NAME_TEXT %>");    
  115.     writeTblHead(75, "fsize","num",0,"<%= L_SIZE_TEXT %>");
  116.     writeTblHead(128, "ftype","str",0,"<%= L_TYPE_TEXT %>");
  117.     writeTblHead(190, "","str",0,"<%= L_LASTMODIFIED_TEXT %>");    
  118.     writeTblClose();
  119. </SCRIPT>
  120.  
  121. </FORM>
  122.  
  123. <SCRIPT LANGUAGE="JavaScript">
  124.     function loadList()
  125.         {
  126.         parent.hlist.location.href = "JSBrwSet.asp?btype=" + top.opener.JSBrowser.browsertype;        
  127.         }
  128.     function redrawList()
  129.         {
  130.         parent.list.location.href = "JSBrwLs.asp";        
  131.         }
  132.         
  133.  
  134.     function listFuncs()
  135.         {
  136.         this.loadList = loadList;
  137.         this.sortList = sortList;
  138.         this.SetFilter = SetFilter;
  139.         this.changeDir = changeDir;
  140.         this.setPath = setPath;
  141.         this.selIndex = 0;
  142.         this.sortby = "fname";
  143.         this.sortAsc = true;
  144.         this.filterType = "";
  145.         }
  146.  
  147.  
  148.     function upDir()
  149.         {
  150.         lastpath = document.userform.currentPath.value;
  151.         uppath = lastpath;
  152.         while (lastpath.indexOf("<%= L_FWDSLASH_TEXT %>") > -1)
  153.             {
  154.             lastpath = lastpath.substring(0,lastpath.indexOf("<%= L_FWDSLASH_TEXT %>")) + "<%= L_DBLSLASH_TEXT %>" + lastpath.substring(lastpath.indexOf("/")+1,lastpath.length);
  155.             }         
  156.         if (lastpath.lastIndexOf("<%= L_DBLSLASH_TEXT %>") == lastpath.length-1)
  157.             {
  158.             lastpath = lastpath.substring(0,lastpath.length-1);
  159.             }
  160.         lastwhack = lastpath.lastIndexOf("<%= L_DBLSLASH_TEXT %>");
  161.         if (lastwhack > 0)
  162.             {
  163.             uppath = lastpath.substring(0,lastwhack+1);
  164.             }    
  165.         document.userform.currentPath.value = uppath;
  166.         if (lastpath.lastIndexOf(":") == lastpath.length-1)
  167.             {
  168.             lastpath += "<%= L_DBLSLASH_TEXT %>";
  169.             }
  170.         changeDir(uppath);
  171.         }
  172.     
  173.     function changeDir(newpath)
  174.         {
  175.         newpath.toUpperCase();
  176.         var thispath = "JSBrwSet.asp?btype=" + top.opener.JSBrowser.browsertype + "&path=" + escape(newpath);
  177.         parent.hlist.location.href = thispath;
  178.         return false;
  179.         }
  180.     
  181.     function setPath()
  182.         {        
  183.         top.opener.JSBrowser.currentFile = parent.filter.document.userform.currentFile.value;
  184.         top.opener.JSBrowser.currentPath = document.userform.currentPath.value;        
  185.         top.opener.JSBrowser.BrowserObjSetPath();
  186.         top.location.href = "JSBrwCl.asp";        
  187.         }
  188.     
  189.     function SetFilter(selFilter)
  190.         {
  191.         listFunc.filterType = selFilter.options[selFilter.selectedIndex].value;
  192.         loadList();
  193.         }
  194.  
  195.  
  196.     function numOrder(a,b)
  197.         {
  198.         return a[listFunc.sortby]-b[listFunc.sortby];
  199.         }
  200.  
  201.     function sortList(sortby,sorttype)
  202.         {
  203.         if (sortby != listFunc.sortby)
  204.             {
  205.             listFunc.sortby = sortby;
  206.             listFunc.sortAsc = true;
  207.             }
  208.         else
  209.             {
  210.             listFunc.sortAsc = !listFunc.sortAsc;
  211.             }
  212.  
  213.         listItem = cachedList[0];
  214.         var num = parseFloat(listItem[sortby]);
  215.  
  216.         if (sorttype == "str")
  217.             {
  218.             cachedList.sort(sortOrder);
  219.             }
  220.         else
  221.             { 
  222.             cachedList.sort(numOrder);
  223.             }
  224.             
  225.         if (!listFunc.sortAsc)
  226.             {
  227.             cachedList.reverse();
  228.             }
  229.         redrawList();
  230.         }
  231.  
  232.     function sortOrder(a,b)
  233.         {
  234.         
  235.         astr = a["isFolder"] + a[listFunc.sortby]
  236.         bstr = b["isFolder"] + b[listFunc.sortby]
  237.         
  238.         
  239.         if (astr.toLowerCase() < bstr.toLowerCase())
  240.             {
  241.             return -1;
  242.             }
  243.         else
  244.             {
  245.             if (astr.toLowerCase() > bstr.toLowerCase())
  246.                 {
  247.                 return 1;
  248.                 }
  249.             else
  250.                 {
  251.                 return 0;
  252.                 }
  253.             }
  254.         }
  255.  
  256.         
  257.     function crop(thestring,size)
  258.         {
  259.         if (top.opener.JSBrowser.sysfontsize == 1)
  260.             {
  261.                 size = size-5;
  262.             }
  263.         if (thestring.length > size)
  264.             {
  265.             thestring = thestring.substring(0,size) + "...";
  266.             }
  267.         return thestring;
  268.         }
  269.  
  270.  
  271.     function fullname(fname,fext)
  272.         {
  273.         if (fext == "")
  274.             {
  275.             return fname;        
  276.             }
  277.         else
  278.             {            
  279.             return (fname + "." + fext);
  280.             }
  281.         }
  282.         
  283.     function formatsize(iStr)
  284.         {
  285.             iStr = parseInt(iStr);
  286.             if (!isNaN(iStr))
  287.             {
  288.                 iStr = Math.round(iStr/1024);
  289.             }
  290.             else
  291.             {
  292.                 iStr = 0
  293.             }
  294.             return iStr;
  295.         }
  296.     
  297.     function listObj(fpath, fname,fext, fsize, ftype, lastupdated,isFolder)
  298.         {
  299.         this.path = fpath;
  300.         if (isFolder == true)
  301.             {
  302.             this.icon = "dir.gif"
  303.             }
  304.         else
  305.             {
  306.             this.icon = "file.gif"
  307.             }
  308.         this.isFolder = isFolder;
  309.         this.fname = fname;    
  310.         this.fext = fext;
  311.         this.displayname = crop(fullname(fname,fext),30);    
  312.         this.fsize = fsize;
  313.         this.displaysize = formatsize(fsize);
  314.         this.ftype = crop(ftype,12);
  315.         this.nodetype = ftype
  316.         this.lastupdated = lastupdated;
  317.         this.displaydate = crop(lastupdated,30);
  318.         this.deleted = false;
  319.         this.updated = false;
  320.         this.newitem = false;
  321.         }
  322.     
  323.     cachedList = new Array();    
  324.     listFunc = new listFuncs();
  325.     
  326. </SCRIPT>
  327.  
  328. </BODY>
  329. </HTML>
  330.