FolderList.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:4k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../../FS_Inc/Const.asp" -->
  3. <%
  4. Dim CurrPath,FsoObj,FolderObj,SubFolderObj,FileObj,i,FsoItem
  5. Dim ParentPath,FileExtName,AllowShowExtNameStr
  6. AllowShowExtNameStr = "htm,html,shtml"
  7. CurrPath = Request("CurrPath")
  8. if CurrPath = "" then
  9. CurrPath = "/"
  10. end if
  11. Set FsoObj = Server.CreateObject(G_FS_FSO)
  12. Set FolderObj = FsoObj.GetFolder(Server.MapPath(CurrPath))
  13. Set SubFolderObj = FolderObj.SubFolders
  14. Set FileObj = FolderObj.Files
  15. Function CheckFileShowTF(AllowShowExtNameStr,ExtName)
  16. if ExtName="" then
  17. CheckFileShowTF = False
  18. else
  19. if InStr(1,AllowShowExtNameStr,ExtName) = 0 then
  20. CheckFileShowTF = False
  21. else
  22. CheckFileShowTF = True
  23. end if
  24. end if
  25. End Function
  26. %>
  27. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  28. <html>
  29. <head>
  30. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  31. <title><% = CurrPath %>目录文件列表</title>
  32. </head>
  33. <link href="../../FS_Inc/FS_css.css" rel="stylesheet">
  34. <body topmargin="0" leftmargin="0" scroll=yes>
  35. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  36.   <tr> 
  37.     <td height="20" class="ButtonListLeft"> <div align="center"><font color="#000000">名称</font></div></td>
  38.     <td height="20" class="ButtonList"> <div align="center"><font color="#000000">类型</font></div></td>
  39.     <td height="20" class="ButtonList"> <div align="center"><font color="#000000">修改日期</font></div></td>
  40.   </tr>
  41. <%
  42. for Each FsoItem In SubFolderObj
  43. %>
  44.   <tr> 
  45.     <td height="20"> 
  46.         <table border="0" cellspacing="0" cellpadding="0">
  47.           <tr title="双击鼠标进入此目录"> 
  48.             
  49.           <td><img src="../Images/Folder/folderclosed.gif"></td>
  50.             <td> <span class="TempletItem" Path="<% = FsoItem.name %>" onDblClick="OpenFolder(this);" onClick="SelectFolder(this);"> 
  51.               <% = FsoItem.name %>
  52.               </span> </td>
  53.           </tr>
  54.         </table>
  55.       </div></td>
  56.     <td height="20"> 
  57.       <div align="center">文件夹</div></td>
  58.     <td height="20"> 
  59.       <div align="center"><% = FsoItem.Size %></div></td>
  60.   </tr>
  61.     <%
  62. Next
  63. for each FsoItem In FileObj
  64. FileExtName = LCase(Mid(FsoItem.name,InstrRev(FsoItem.name,".")+1))
  65. if CheckFileShowTF(AllowShowExtNameStr,FileExtName) = True then
  66. %>
  67.   <tr title="单击选择文件"> 
  68.     <td height="20"> 
  69.       <table width="100%" border="0" cellspacing="0" cellpadding="0">
  70.         <tr>
  71.           <td width="3%">&nbsp;</td>
  72.           <td width="97%"><span class="TempletItem" File="<% = FsoItem.name %>" onClick="SelectFile(this);">
  73.             <% = FsoItem.name %>
  74.             </span></td>
  75.         </tr>
  76.       </table>
  77.     </td>
  78.     <td height="20"> <div align="center"> 
  79.         <% = FsoItem.Type %>
  80.       </div></td>
  81.     <td height="20"> <div align="center"> 
  82.         <% = FsoItem.DateLastModified %>
  83.       </div></td>
  84.   </tr>
  85.   <%
  86.    end if
  87. next
  88. %>
  89. </table>
  90. </body>
  91. </html>
  92. <%
  93. Set FsoObj = Nothing
  94. Set FolderObj = Nothing
  95. Set FileObj = Nothing
  96. %>
  97. <script language="JavaScript">
  98. var CurrPath='<% = CurrPath %>';
  99. var FileName='';
  100. function SelectFile(Obj)
  101. {
  102. for (var i=0;i<document.all.length;i++)
  103. {
  104. if (document.all(i).className=='TempletSelectItem') document.all(i).className='TempletItem';
  105. }
  106. Obj.className='TempletSelectItem';
  107. FileName=Obj.File;
  108. }
  109. function SelectFolder(Obj)
  110. {
  111. for (var i=0;i<document.all.length;i++)
  112. {
  113. if (document.all(i).className=='TempletSelectItem') document.all(i).className='TempletItem';
  114. }
  115. Obj.className='TempletSelectItem';
  116. }
  117. function OpenFolder(Obj)
  118. {
  119. var SubmitPath='';
  120. if (CurrPath=='/') SubmitPath=CurrPath+Obj.Path;
  121. else SubmitPath=CurrPath+'/'+Obj.Path;
  122. location.href='FolderList.asp?CurrPath='+SubmitPath;
  123. AddFolderList(parent.document.all.FolderSelectList,SubmitPath,SubmitPath);
  124. }
  125. function AddFolderList(SelectObj,Lable,LableContent)
  126. {
  127. var i=0,AddOption;
  128. if (!SearchOptionExists(SelectObj,Lable))
  129. {
  130. AddOption = document.createElement("OPTION");
  131. AddOption.text=Lable;
  132. AddOption.value=LableContent;
  133. SelectObj.add(AddOption);
  134. SelectObj.options(SelectObj.length-1).selected=true;
  135. }
  136. }
  137. function SearchOptionExists(Obj,SearchText)
  138. {
  139. var i;
  140. for(i=0;i<Obj.length;i++)
  141. {
  142. if (Obj.options(i).text==SearchText)
  143. {
  144. Obj.options(i).selected=true;
  145. return true;
  146. }
  147. }
  148. return false;
  149. }
  150. </script>