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

数据库编程

开发平台:

ASP/ASPX

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