📄 template.asp
字号:
<!--#include file="../ACT.Function.asp"-->
<%
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
If Not ACTCMS.ChkAdmin() Then '超级管理员检测
Call Actcms.ACTCMSErr("")
End If
Dim ACT_Path,ACT_TypePath,str_ShowPath,strShowErr
ACT_TypePath=replace(replace(Request("ShowPath"),"'",""),"""","")
If ACT_TypePath="" Then
ACT_TypePath=actcms.ActCMS_Sys(3)&"templets"
str_ShowPath = actcms.ActCMS_Sys(3)&"templets"
Else
str_ShowPath =ACT_TypePath
End If
ACT_Path = Mid(ACT_TypePath,1,InstrRev(ACT_TypePath,"/")-1)
Dim ACT_FSO,ACT_FolderObj,ACT_SubFolderObj,p_FileObj,FileIconDic
Dim ACT_FileItem
Set ACT_FSO = Server.CreateObject("scripting.filesystemobject")
Set ACT_FolderObj = ACT_FSO.GetFolder(Server.MapPath(ACT_TypePath))
Set ACT_SubFolderObj = ACT_FolderObj.SubFolders
Set p_FileObj = ACT_FolderObj.Files
Set FileIconDic = CreateObject("Scripting.Dictionary")
FileIconDic.Add "txt","print/FileIcon/txt.gif"
FileIconDic.Add "gif","print/FileIcon/gif.gif"
FileIconDic.Add "exe","print/FileIcon/exe.gif"
FileIconDic.Add "asp","print/FileIcon/asp.gif"
FileIconDic.Add "html","print/FileIcon/html.gif"
FileIconDic.Add "htm","print/FileIcon/html.gif"
FileIconDic.Add "jpg","print/FileIcon/jpg.gif"
FileIconDic.Add "jpeg","print/FileIcon/jpg.gif"
FileIconDic.Add "pl","print/FileIcon/perl.gif"
FileIconDic.Add "perl","print/FileIcon/perl.gif"
FileIconDic.Add "zip","print/FileIcon/zip.gif"
FileIconDic.Add "rar","print/FileIcon/zip.gif"
FileIconDic.Add "gz","print/FileIcon/zip.gif"
FileIconDic.Add "doc","print/FileIcon/doc.gif"
FileIconDic.Add "xml","print/FileIcon/xml.gif"
FileIconDic.Add "xsl","print/FileIcon/xml.gif"
FileIconDic.Add "dtd","print/FileIcon/xml.gif"
FileIconDic.Add "vbs","print/FileIcon/vbs.gif"
FileIconDic.Add "js","print/FileIcon/vbs.gif"
FileIconDic.Add "wsh","print/FileIcon/vbs.gif"
FileIconDic.Add "sql","print/FileIcon/script.gif"
FileIconDic.Add "bat","print/FileIcon/script.gif"
FileIconDic.Add "tcl","print/FileIcon/script.gif"
FileIconDic.Add "eml","print/FileIcon/mail.gif"
FileIconDic.Add "swf","print/FileIcon/flash.gif"
if Request.QueryString("Type") = "FileReName" then
Dim NewFileName,OldFileName,Path,PhysicalPath,FileObj
Path = replace(replace(Request("Path"),"'",""),"""","")
if Path <> "" then
NewFileName = Request("NewFileName")
OldFileName = Request("OldFileName")
if (NewFileName <> "") And (OldFileName <> "") then
PhysicalPath = Server.MapPath(Path) & "\" & OldFileName
if ACT_FSO.FileExists(PhysicalPath) = True then
PhysicalPath = Server.MapPath(Path) & "\" & NewFileName
if ACT_FSO.FileExists(PhysicalPath) = False then
Set FileObj = ACT_FSO.GetFile(Server.MapPath(Path) & "\" & OldFileName)
FileObj.Name = NewFileName
Set FileObj = Nothing
end if
end if
end if
end if
'Call MF_Insert_oper_Log("模板管理","改名了模板文件,名称:"& OldFileName &",路径:"& Path &"",now,session("admin_name"),"MF")
strShowErr = "<li>修改文件成功</li>"
Response.Redirect("../Error.asp?Errs="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
Response.end
End if
if Request.QueryString("Type") = "FolderReName" then
Dim NewPathName,OldPathName
Path = replace(replace(Request("Path"),"'",""),"""","")
if Path <> "" then
NewPathName = replace(replace(Request("NewFileName"),"'",""),"""","")
OldPathName = replace(replace(Request("OldFileName"),"'",""),"""","")
if (NewPathName <> "") And (OldPathName <> "") then
PhysicalPath = Server.MapPath(Path) & "\" & OldPathName
if ACT_FSO.FolderExists(PhysicalPath) = True then
PhysicalPath = Server.MapPath(Path) & "\" & NewPathName
if ACT_FSO.FolderExists(PhysicalPath) = False then
Set FileObj = ACT_FSO.GetFolder(Server.MapPath(Path) & "\" & OldPathName)
FileObj.Name = NewPathName
Set FileObj = Nothing
end if
end if
end if
end if
'Call MF_Insert_oper_Log("模板管理","改名了模板目录,目录:"& OldPathName &",路径:"& Path &"",now,session("admin_name"),"MF")
strShowErr = "<li>修改目录成功</li>"
Response.Redirect("../Error.asp?Errs="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
Response.end
End if
if Request.QueryString("Type") = "AddFolder" then
Path = replace(replace(Request("Path"),"'",""),"""","")
if Path <> "" then
Path = Server.MapPath(Replace(Path,"//","/"))
if ACT_FSO.FolderExists(Path) = True then
strShowErr = "<li>目录已经存在</li>"
Response.Redirect("error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
Response.end
else
ACT_FSO.CreateFolder Path
end if
end if
strShowErr = "<li>创建目录成功</li>"
Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
Response.end
end if
if Request.QueryString("Action") = "Delfolder" then
Path = replace(replace(Request.QueryString("Dir"),"'",""),"""","") &"/"&replace(replace(Request.QueryString("File"),"'",""),"""","")
if Path <> "" then
Path = Server.MapPath(Path)
if ACT_FSO.FolderExists(Path) = true then ACT_FSO.DeleteFolder Path
end if
'Call MF_Insert_oper_Log("模板管理","删除了目录,目录:"& replace(replace(Request.QueryString("File"),"'",""),"""","") &",路径:"& replace(replace(Request.QueryString("Dir"),"'",""),"""","") &"",now,session("admin_name"),"MF")
strShowErr = "<li>删除目录成功!</li>"
Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
Response.end
End if
if Request.QueryString("Action") = "Delfile" then
Dim DelFileName
Path = replace(replace(Request.QueryString("Dir"),"'",""),"""","")
DelFileName = replace(replace(Request.QueryString("File"),"'",""),"""","")
if (DelFileName <> "") And (Path <> "") then
Path = Server.MapPath(Path)
if ACT_FSO.FileExists(Path & "\" & DelFileName) = true then ACT_FSO.DeleteFile Path & "\" & DelFileName
end if
'Call MF_Insert_oper_Log("模板管理","删除了文件,文件:"& replace(replace(Request.QueryString("File"),"'",""),"""","") &",路径:"& replace(replace(Request.QueryString("Dir"),"'",""),"""","") &"",now,session("admin_name"),"MF")
strShowErr = "<li>删除文件成功!</li>"
Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
Response.end
End if
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>fso操作</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
</HEAD>
<link href="print/act_css.css" rel="stylesheet" type="text/css">
<link href="../Images/css1/css.css" rel="stylesheet" type="text/css">
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
<tr>
<td class="bg_tr">您现在的位置:模板系统管理 >> 模板管理</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" >
<form name="form1" method="post" action="">
<tr>
<td width="204" height="20" ><div align="left">名称</div></td>
<td height="20"><div align="center">类型</div></td>
<td height="20"><div align="center">大小(kb)</div></td>
<td height="20"><div align="center">最后修改时间</div></td>
<td><div align="center">操作</div></td>
</tr>
<% If ACT_Path <> actcms.ActCMS_Sys(3) And ACT_Path <> "/" Then %>
<tr >
<td height="20" colspan="5" style="cursor:hand"><table border="0" cellpadding="0" cellspacing="0">
<tr >
<td><img src="print/FileIcon/arrow.gif" width="18" height="18"></td>
<td ><span title="上级目录<% = ACT_Path %>" onDblClick="OpenParentFolder(this);" Path="<% = ACT_Path %>">上级目录</span>(<font color=red>双击进入目录</font>)</td>
</tr>
</table></td>
</tr>
<%
End If
For Each ACT_FileItem In ACT_SubFolderObj
%>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td height=""> <table border="0" cellspacing="0" cellpadding="0">
<tr title="双击鼠标进入此目录" style="cursor:hand">
<td><img src="print/FileIcon/folder.gif" width="20" height="16"></td>
<td ><span class="TempletItem" Path="<% = ACT_FileItem.name %>" onDblClick="OpenFolder(this);">
<% = ACT_FileItem.name %>
</span> </td>
</tr>
</table></td>
<td> <div align="center">文件夹</div></td>
<td> <div align="center">
<%
if ACT_FileItem.Size<100 then
Response.Write ACT_FileItem.Size &"Byte"
Else
Response.Write FormatNumber(ACT_FileItem.Size/1024,1,-1) &"KB"
End if
%>
</div></td>
<td> <div align="center">
<% = ACT_FileItem.DateLastModified %>
</div></td>
<td><div align="center"><a href="#" onClick="EditFolder('<% = ACT_FileItem.name %>','<%=str_ShowPath%>')">改名</a>|<a href="?Action=Delfolder&File=<% = ACT_FileItem.name %>&Dir=<%=str_ShowPath%>" onClick="{if(confirm('确定删除此目录吗?')){return true;}return false;}">删除</a>
</div></td>
</tr>
<%
Next
For Each ACT_FileItem In p_FileObj
Dim p_FileIcon,p_FileExtName
p_FileExtName = Mid(CStr(ACT_FileItem.Name),Instr(CStr(ACT_FileItem.Name),".")+1)
If lcase(p_FileExtName)="html" Or lcase(p_FileExtName)="htm" Or lcase(p_FileExtName)="css" Then
p_FileIcon = FileIconDic.Item(LCase(p_FileExtName))
If p_FileIcon = "" Then
p_FileIcon = "print/FileIcon/unknown.gif"
End If
%>
<tr>
<td style="cursor:hand"> <table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="<% = p_FileIcon %>"></td>
<td><span File="<% = ACT_FileItem.Name %>">
<a href="TempletEdit.asp?File=<% = ACT_FileItem.name %>&Dir=<%=str_ShowPath%>"> <% = ACT_FileItem.Name %></a>
</span></td>
</tr>
</table></td>
<td width="98"> <div align="center">
<% = ACT_FileItem.Type %>
</div></td>
<td width="80"> <div align="center">
<%
if ACT_FileItem.Size<100 then
Response.Write ACT_FileItem.Size &"字节"
Else
Response.Write FormatNumber(ACT_FileItem.Size/1024,1,-1) &"KB"
End if
%>
</div></td>
<td width="143"> <div align="center">
<% = ACT_FileItem.DateLastModified %>
</div></td>
<td width="230"><div align="left"><a href="TempletEdit.asp?A=T&File=<% = ACT_FileItem.name %>&Dir=<%=str_ShowPath%>">在线编辑</a>|<a href="#" onClick="Editfile('<% = replace(ACT_FileItem.name,"'","\'") %>','<%=str_ShowPath%>')">改名</a>|<a href="<%=str_ShowPath%>/<% = ACT_FileItem.name %>" target="_blank">预览</a>|<a href="?Action=Delfile&File=<% = ACT_FileItem.name %>&Dir=<%=str_ShowPath%>" onClick="{if(confirm('确定删除此文件吗?')){return true;}return false;}">删除</a>
</div></td>
</tr>
<%
else
end if
next
%>
<tr>
<td colspan="5" height="32"><div align="right"><span class="tx">小提示:双击目录进入下一级目录</span>
<input type="button" class="ACT_btn" onClick="window.location.href='TempletEdit.asp?Action=Add&Dir=<%=str_ShowPath%>'" value="新建模板">
<input type="button" class="ACT_btn" name="Submit2" value="新建目录" onClick="AddFolder();">
</div></td>
</tr>
</form>
</table>
</body>
</html>
<%
Set ACT_FSO = Nothing
Set ACT_FolderObj = Nothing
Set ACT_SubFolderObj = Nothing
Set FileIconDic = Nothing
%>
<script>
function overColor(Obj)
{
var elements=Obj.childNodes;
for(var i=0;i<elements.length;i++)
{
elements[i].className="tdbg1"
Obj.bgColor="";
}
}
function outColor(Obj)
{
var elements=Obj.childNodes;
for(var i=0;i<elements.length;i++)
{
elements[i].className="tdbg";
Obj.bgColor="";
}
}
function AddFolder()
{
var CurrPath='<% = ACT_TypePath %>';
var ReturnValue=prompt('新建目录名:','');
if ((ReturnValue!='') && (ReturnValue!=null))
window.location.href='?Path=<%=ACT_TypePath%>/'+ReturnValue+'&Type=AddFolder&CurrPath=<%=ACT_TypePath%>';
}
function OpenFolder(Obj)
{
var SubmitPath='';
var CurrPath='<% = ACT_TypePath %>';
if (CurrPath=='/') SubmitPath=CurrPath+Obj.Path;
else SubmitPath=CurrPath+'/'+Obj.Path;
location.href='?ShowPath='+SubmitPath;
}
function OpenParentFolder(Obj)
{
location.href='?ShowPath='+Obj.Path;
}
function Editfile(filename,path)
{
var ReturnValue='';
ReturnValue=prompt('修改的名称:',filename.replace(/'|"/g,''));
if ((ReturnValue!='') && (ReturnValue!=null)) window.location.href='?Type=FileReName&Path='+path+'&OldFileName='+filename+'&NewFileName='+ReturnValue;
else if(ReturnValue!=null){alert('请填写要更名的名称');}
}
function EditFolder(filename,path)
{
var ReturnValue='';
ReturnValue=prompt('修改的名称:',filename.replace(/'|"/g,''));
if ((ReturnValue!='') && (ReturnValue!=null)) window.location.href='?Type=FolderReName&Path='+path+'&OldFileName='+filename+'&NewFileName='+ReturnValue;
else if(ReturnValue!=null){alert('请填写要更名的名称');}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -