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

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_Inc/Function.asp" -->
  5. <!--#include file="../FS_Inc/Cls_Cache.asp" -->
  6. <%
  7. Response.Expires = -1
  8. Response.ExpiresAbsolute = Now() - 1
  9. Response.Expires = 0
  10. Response.CacheControl = "no-cache"
  11. Dim Conn
  12. MF_Default_Conn
  13. MF_Session_TF
  14. if not MF_Check_Pop_TF("MF_Templet") then Err_Show
  15. Dim p_ParentPath,p_ShowPath,str_ShowPath,strShowErr
  16. p_ShowPath=replace(replace(Request("ShowPath"),"'",""),"""","")
  17. If p_ShowPath="" Then
  18. p_ShowPath=Add_Root_Dir("/") & G_TEMPLETS_DIR
  19. str_ShowPath = p_ShowPath
  20. Else
  21. str_ShowPath =p_ShowPath
  22. End If
  23. p_ParentPath = Mid(p_ShowPath,1,InstrRev(p_ShowPath,"/")-1)
  24. Dim p_FSO,p_FolderObj,p_SubFolderObj,p_FileObj,p_FileIconDic
  25. Dim p_FileItem
  26. Set p_FSO = Server.CreateObject(G_FS_FSO)
  27. Set p_FolderObj = p_FSO.GetFolder(Server.MapPath(p_ShowPath))
  28. Set p_SubFolderObj = p_FolderObj.SubFolders
  29. Set p_FileObj = p_FolderObj.Files
  30. Set p_FileIconDic = CreateObject(G_FS_DICT)
  31. p_FileIconDic.Add "txt","Images/FileIcon/txt.gif"
  32. p_FileIconDic.Add "gif","Images/FileIcon/gif.gif"
  33. p_FileIconDic.Add "exe","Images/FileIcon/exe.gif"
  34. p_FileIconDic.Add "asp","Images/FileIcon/asp.gif"
  35. p_FileIconDic.Add "html","Images/FileIcon/html.gif"
  36. p_FileIconDic.Add "htm","Images/FileIcon/html.gif"
  37. p_FileIconDic.Add "jpg","Images/FileIcon/jpg.gif"
  38. p_FileIconDic.Add "jpeg","Images/FileIcon/jpg.gif"
  39. p_FileIconDic.Add "pl","Images/FileIcon/perl.gif"
  40. p_FileIconDic.Add "perl","Images/FileIcon/perl.gif"
  41. p_FileIconDic.Add "zip","Images/FileIcon/zip.gif"
  42. p_FileIconDic.Add "rar","Images/FileIcon/zip.gif"
  43. p_FileIconDic.Add "gz","Images/FileIcon/zip.gif"
  44. p_FileIconDic.Add "doc","Images/FileIcon/doc.gif"
  45. p_FileIconDic.Add "xml","Images/FileIcon/xml.gif"
  46. p_FileIconDic.Add "xsl","Images/FileIcon/xml.gif"
  47. p_FileIconDic.Add "dtd","Images/FileIcon/xml.gif"
  48. p_FileIconDic.Add "vbs","Images/FileIcon/vbs.gif"
  49. p_FileIconDic.Add "js","Images/FileIcon/vbs.gif"
  50. p_FileIconDic.Add "wsh","Images/FileIcon/vbs.gif"
  51. p_FileIconDic.Add "sql","Images/FileIcon/script.gif"
  52. p_FileIconDic.Add "bat","Images/FileIcon/script.gif"
  53. p_FileIconDic.Add "tcl","Images/FileIcon/script.gif"
  54. p_FileIconDic.Add "eml","Images/FileIcon/mail.gif"
  55. p_FileIconDic.Add "swf","Images/FileIcon/flash.gif"
  56. if Request.QueryString("Type") = "FileReName" then
  57. if not MF_Check_Pop_TF("MF002") then Err_Show
  58. Dim NewFileName,OldFileName,Path,PhysicalPath,FileObj
  59. Path = replace(replace(Request("Path"),"'",""),"""","")
  60. if Path <> "" then
  61. NewFileName = Request("NewFileName")
  62. OldFileName = Request("OldFileName")
  63. if (NewFileName <> "") And (OldFileName <> "") then
  64. PhysicalPath = Server.MapPath(Path) & "" & OldFileName
  65. if p_FSO.FileExists(PhysicalPath) = True then
  66. PhysicalPath = Server.MapPath(Path) & "" & NewFileName
  67. if p_FSO.FileExists(PhysicalPath) = False then
  68. Set FileObj = p_FSO.GetFile(Server.MapPath(Path) & "" & OldFileName)
  69. FileObj.Name = NewFileName
  70. Set FileObj = Nothing
  71. end if
  72. end if
  73. end if
  74. end if
  75. Call MF_Insert_oper_Log("模板管理","改名了模板文件,名称:"& OldFileName &",路径:"& Path &"",now,session("admin_name"),"MF")
  76. strShowErr = "<li>修改文件成功</li>"
  77. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  78. Response.end
  79. End if
  80. if Request.QueryString("Type") = "FolderReName" then
  81. if not MF_Check_Pop_TF("MF002") then Err_Show
  82. Dim NewPathName,OldPathName
  83. Path = replace(replace(Request("Path"),"'",""),"""","")
  84. if Path <> "" then
  85. NewPathName = replace(replace(Request("NewFileName"),"'",""),"""","")
  86. OldPathName = replace(replace(Request("OldFileName"),"'",""),"""","")
  87. if (NewPathName <> "") And (OldPathName <> "") then
  88. PhysicalPath = Server.MapPath(Path) & "" & OldPathName
  89. if p_FSO.FolderExists(PhysicalPath) = True then
  90. PhysicalPath = Server.MapPath(Path) & "" & NewPathName
  91. if p_FSO.FolderExists(PhysicalPath) = False then
  92. Set FileObj = p_FSO.GetFolder(Server.MapPath(Path) & "" & OldPathName)
  93. FileObj.Name = NewPathName
  94. Set FileObj = Nothing
  95. end if
  96. end if
  97. end if
  98. end if
  99. Call MF_Insert_oper_Log("模板管理","改名了模板目录,目录:"& OldPathName &",路径:"& Path &"",now,session("admin_name"),"MF")
  100. strShowErr = "<li>修改目录成功</li>"
  101. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  102. Response.end
  103. End if
  104. if Request.QueryString("Type") = "AddFolder" then
  105. if not MF_Check_Pop_TF("MF004") then Err_Show
  106. Path = replace(replace(Request("Path"),"'",""),"""","")
  107. if Path <> "" then
  108. Path = Server.MapPath(Replace(Path,"//","/"))
  109. if p_FSO.FolderExists(Path) = True then
  110. strShowErr = "<li>目录已经存在</li>"
  111. Response.Redirect("error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  112. Response.end
  113. else
  114. p_FSO.CreateFolder Path
  115. end if
  116. end if
  117. strShowErr = "<li>创建目录成功</li>"
  118. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  119. Response.end
  120. end if
  121. if Request.QueryString("Action") = "Delfolder" then
  122. if not MF_Check_Pop_TF("MF003") then Err_Show
  123. Path = replace(replace(Request.QueryString("Dir"),"'",""),"""","") &"/"&replace(replace(Request.QueryString("File"),"'",""),"""","")
  124. if Path <> "" then
  125. Path = Server.MapPath(Path)
  126. if p_FSO.FolderExists(Path) = true then p_FSO.DeleteFolder Path
  127. end if
  128. Call MF_Insert_oper_Log("模板管理","删除了目录,目录:"& replace(replace(Request.QueryString("File"),"'",""),"""","") &",路径:"& replace(replace(Request.QueryString("Dir"),"'",""),"""","") &"",now,session("admin_name"),"MF")
  129. strShowErr = "<li>删除目录成功!</li>"
  130. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  131. Response.end
  132. End if
  133. if Request.QueryString("Action") = "Delfile" then
  134. if not MF_Check_Pop_TF("MF003") then Err_Show
  135. Dim DelFileName
  136. Path = replace(replace(Request.QueryString("Dir"),"'",""),"""","")
  137. DelFileName = replace(replace(Request.QueryString("File"),"'",""),"""","")
  138. if (DelFileName <> "") And (Path <> "") then
  139. Path = Server.MapPath(Path)
  140. if p_FSO.FileExists(Path & "" & DelFileName) = true then p_FSO.DeleteFile Path & "" & DelFileName
  141. end if
  142. Call MF_Insert_oper_Log("模板管理","删除了文件,文件:"& replace(replace(Request.QueryString("File"),"'",""),"""","") &",路径:"& replace(replace(Request.QueryString("Dir"),"'",""),"""","") &"",now,session("admin_name"),"MF")
  143. strShowErr = "<li>删除文件成功!</li>"
  144. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  145. Response.end
  146. End if
  147. %>
  148. <html xmlns="http://www.w3.org/1999/xhtml">
  149. <HEAD>
  150. <TITLE>FoosunCMS</TITLE>
  151. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  152. </HEAD>
  153. <script language="JavaScript" src="../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  154. <link href="images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  155. <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes>
  156. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  157.   <tr> 
  158.     <td class="xingmu">模板管理</td>
  159.   </tr>
  160. </table>
  161. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" >
  162.   <form name="form1" method="post" action="">
  163.     <tr class="hback"> 
  164.       <td width="204" height="20"  class="xingmu"><div align="left">名称</div></td>
  165.       <td height="20" class="xingmu"><div align="center">类型</div></td>
  166.       <td height="20" class="xingmu"><div align="center">大小(kb)</div></td>
  167.       <td height="20" class="xingmu"><div align="center">最后修改时间</div></td>
  168.       <td class="xingmu"><div align="center">操作</div></td>
  169.     </tr>
  170.     <% If p_ParentPath <> "/" & G_VIRTUAL_ROOT_DIR And p_ParentPath <> "/" Then %>
  171.     <tr class="hback"> 
  172.       <td  style="cursor:hand"><table border="0" cellpadding="0" cellspacing="0">
  173.           <tr> 
  174.             <td><img src="Images/arrow.gif" width="18" height="18"></td>
  175.             <td><span class="TempletItem" title="上级目录<% = p_ParentPath %>" onDblClick="OpenParentFolder(this);" Path="<% = p_ParentPath %>">上级目录</span></td>
  176.           </tr>
  177.         </table></td>
  178.       <td height="20" width="98">&nbsp;</td>
  179.       <td height="20" width="87">&nbsp;</td>
  180.       <td height="20" width="143">&nbsp;</td>
  181.       <td width="218">&nbsp;</td>
  182.     </tr>
  183.     <%
  184. End If
  185. For Each p_FileItem In p_SubFolderObj
  186. %>
  187.     <tr class="hback"> 
  188.       <td height=""> <table border="0" cellspacing="0" cellpadding="0">
  189.           <tr title="双击鼠标进入此目录" style="cursor:hand"> 
  190.             <td><img src="Images/Folder/folder.gif" width="20" height="16"></td>
  191.             <td ><span class="TempletItem" Path="<% = p_FileItem.name %>" onDblClick="OpenFolder(this);"> 
  192.               <% = p_FileItem.name %>
  193.               </span> </td>
  194.           </tr>
  195.         </table></td>
  196.       <td> <div align="center">文件夹</div></td>
  197.       <td> <div align="center"> 
  198.           <%
  199.   if p_FileItem.Size<100 then
  200.  Response.Write p_FileItem.Size &"Byte"
  201.   Else
  202.  Response.Write FormatNumber(p_FileItem.Size/1024,1,-1) &"KB"
  203.   End if
  204.   %>
  205.         </div></td>
  206.       <td> <div align="center"> 
  207.           <% = p_FileItem.DateLastModified %>
  208.         </div></td>
  209.       <td><div align="left"><a href="#" onClick="EditFolder('<% = p_FileItem.name %>','<%=str_ShowPath%>')">改名</a>|<a href="Templets_List.asp?Action=Delfolder&File=<% = p_FileItem.name %>&Dir=<%=str_ShowPath%>" onClick="{if(confirm('确定删除此目录吗?')){return true;}return false;}">删除</a> 
  210.         </div></td>
  211.     </tr>
  212.     <%
  213. Next
  214. For Each p_FileItem In p_FileObj
  215. Dim p_FileIcon,p_FileExtName
  216. p_FileExtName = Mid(CStr(p_FileItem.Name),Instr(CStr(p_FileItem.Name),".")+1)
  217. If lcase(p_FileExtName)="html" Or lcase(p_FileExtName)="htm" Or lcase(p_FileExtName)="css" Then 
  218. p_FileIcon = p_FileIconDic.Item(LCase(p_FileExtName))
  219. If p_FileIcon = "" Then
  220. p_FileIcon = "Images/FileIcon/unknown.gif"
  221. End If
  222. %>
  223.     <tr class="hback"> 
  224.       <td  style="cursor:hand"> <table border="0" cellspacing="0" cellpadding="0">
  225.           <tr> 
  226.             <td><img src="<% = p_FileIcon %>"></td>
  227.             <td><span File="<% = p_FileItem.Name %>"> 
  228.               <% = p_FileItem.Name %>
  229.               </span></td>
  230.           </tr>
  231.         </table></td>
  232.       <td width="98"> <div align="center"> 
  233.           <% = p_FileItem.Type %>
  234.         </div></td>
  235.       <td width="87"> <div align="center"> 
  236.           <%
  237.   if p_FileItem.Size<100 then
  238.  Response.Write p_FileItem.Size &"字节"
  239.   Else
  240.  Response.Write FormatNumber(p_FileItem.Size/1024,1,-1) &"KB"
  241.   End if
  242.   %>
  243.         </div></td>
  244.       <td width="143"> <div align="center"> 
  245.           <% = p_FileItem.DateLastModified %>
  246.         </div></td>
  247.       <td width="218"><div align="left"><a href="Templets_Edit_.asp?File=<% = p_FileItem.name %>&Dir=<%=str_ShowPath%>">在线编辑</a>|<a href="Templets_Edit_text.asp?File=<% = p_FileItem.name %>&Dir=<%=str_ShowPath%>">文本编辑</a>|<a href="#" onClick="Editfile('<% = replace(p_FileItem.name,"'","'") %>','<%=str_ShowPath%>')">改名</a>|<a href="<%=str_ShowPath%>/<% = p_FileItem.name %>" target="_blank">预览</a>|<a href="Templets_List.asp?Action=Delfile&File=<% = p_FileItem.name %>&Dir=<%=str_ShowPath%>" onClick="{if(confirm('确定删除此文件吗?')){return true;}return false;}">删除</a> 
  248.         </div></td>
  249.     </tr>
  250.     <%
  251.   else
  252.   end if
  253. next
  254. %>
  255.     <tr class="hback"> 
  256.       <td colspan="5" height="32"><div align="right"><span  class="tx">小提示:双击目录进入下一级目录</span>
  257.           <input type="button" name="Submit2" value="创建目录" onClick="AddFolder();">
  258.           <input type="button" name="Submit" value="导入文件" onClick="ImportTempletFile();" <%if not MF_Check_Pop_TF("MF005") then response.Write " disabled"%>>
  259.         </div></td>
  260.     </tr>
  261.   </form>
  262. </table>
  263. </body>
  264. </html>
  265. <%
  266. 'Conn.Close
  267. 'Set Conn = Nothing
  268. Set p_FSO = Nothing
  269. Set p_FolderObj = Nothing
  270. Set p_FileObj = Nothing
  271. Set p_SubFolderObj = Nothing
  272. Set p_FileIconDic = Nothing
  273. %>
  274. <script>
  275. function AddFolder()
  276. {
  277. var CurrPath='<% = p_ShowPath %>';
  278. var ReturnValue=prompt('新建目录名:','');
  279. if ((ReturnValue!='') && (ReturnValue!=null))
  280. window.location.href='?Path=<%=p_ShowPath%>/'+ReturnValue+'&Type=AddFolder&CurrPath=<%=p_ShowPath%>';
  281. }
  282. function ImportTempletFile()
  283. {
  284. var CurrPath='<% = p_ShowPath %>';
  285. OpenWindow('CommPages/SelectManageDir/Frame.asp?FileName=UpFileForm.asp&PageTitle=上传文件&Path='+CurrPath,350,170,window);
  286. }
  287. function OpenFolder(Obj)
  288. {    
  289. var SubmitPath='';
  290. var CurrPath='<% = p_ShowPath %>';
  291. if (CurrPath=='/') SubmitPath=CurrPath+Obj.Path;
  292. else SubmitPath=CurrPath+'/'+Obj.Path;
  293. location.href='Templets_List.asp?ShowPath='+SubmitPath;
  294. }
  295. function OpenParentFolder(Obj)
  296. {
  297. location.href='Templets_List.asp?ShowPath='+Obj.Path;
  298. }
  299. function Editfile(filename,path)
  300. {
  301. var ReturnValue='';
  302. ReturnValue=prompt('修改的名称:',filename.replace(/'|"/g,''));
  303. if ((ReturnValue!='') && (ReturnValue!=null)) window.location.href='?Type=FileReName&Path='+path+'&OldFileName='+filename+'&NewFileName='+ReturnValue;
  304. else if(ReturnValue!=null){alert('请填写要更名的名称');}
  305. }
  306. function EditFolder(filename,path)   
  307. {
  308. var ReturnValue='';
  309. ReturnValue=prompt('修改的名称:',filename.replace(/'|"/g,''));
  310. if ((ReturnValue!='') && (ReturnValue!=null)) window.location.href='?Type=FolderReName&Path='+path+'&OldFileName='+filename+'&NewFileName='+ReturnValue;
  311. else if(ReturnValue!=null){alert('请填写要更名的名称');}
  312. }
  313. </script>