📄 templelist.asp
字号:
<!--#include file="check.asp"-->
<!--#include file="checkpower.asp"-->
<!--#INCLUDE FILE="connect.asp" -->
<html>
<head>
<title>公文模板管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
LocalFile="templelist.asp"
TempleFile="loadtemple.asp" '打开模板文件
SaveFile="uptemple.asp" '上传模板文件
HttpUrl="http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
HttpUrl=Left(HttpUrl,Len(HttpUrl)-Len(LocalFile))
TempleUrl=HttpUrl & TempleFile
SaveUrl=HttpUrl & SaveFile
%>
<script language="JavaScript" src="apply.js"></script>
<script language="JavaScript">
function checkaddtemple() {
if(document.form.filename.value=="") {
alert("请输入模板名称")
document.form.filename.focus()
return false;
}
if(document.form.file.value=="") {
alert("请选择上传文件")
document.form.file.focus()
return false;
}
if(document.form.file.value!="") { //判断文件路径是否正确
var isValid=1
var temp=document.form.file.value
if(temp.indexOf(".")==-1) {isValid=0}
if(temp.indexOf("\\")==-1) {isValid=0}
if (isValid==0) {alert("附件路径有误!");document.form.file.focus();return false;}
}
var result=false
var PsoUrl="<%=SaveUrl%>" //保存附件文件url路径
var MaxSize="<%=session("MaxSize")%>" //限制上传附件文件的大小
var PsoPath=document.form.file.value //定义附件路径
var PsoFile //定义附件的文件名
var PsoType //定义附件的扩展名
PsoFile=PsoPath
while(PsoFile.indexOf("\\")>0) //获得附件的文件名
{
i = PsoFile.indexOf("\\")
PsoFile = PsoFile.substring(i + 1, PsoFile.length);
} //获得附件的文件名
PsoPath=PsoPath.substring(0,PsoPath.lastIndexOf("\\")) //获得附件的路径
PsoType=PsoFile
if (PsoType.lastIndexOf(".")>0) //获得附件的扩展名
{
i = PsoType.lastIndexOf(".")
PsoType = PsoType.substring(i + 1, PsoType.length);
}
PsoType=PsoType.toLowerCase();
if (PsoType=="doc") {
result=form.web.upload(PsoUrl,PsoFile,PsoPath,MaxSize) //向服务器上传附件
}
else {
alert("目前模板只能使用doc格式的文件")
document.form.file.focus();
return false;
}
if (!result)
{
alert("对不起,你选择的文件不存在!")
document.form.file.value=""
document.form.file.focus();
return false; //上传附件失败,返回起草公文页面
}
else
{
document.location="savetemple.asp?title="+document.form.filename.value
return false;
}
//上传附件完毕
}
function checkdeltemple() { //删除模板函数
var ifchecked
if(form.checkbox+""=="undefined")
{ alert("你至少要选择一个要删除的公文模板!")
return false;
}
else {
if (form.checkbox.checked==true) {ifchecked="checked"}
for (var i=0;i<form.checkbox.length;i++)
{
var e = form.checkbox[i];
if (e.checked==true)
{
ifchecked="checked"
}
}
}
if (form.checkbox.checked==true) {ifchecked="checked"}
if (ifchecked=="checked")
{ if(confirm("您确定要删除吗?"))
{
document.form.choosedel.value="choosedel"
document.form.submit()
}
}
else {
alert("你至少要选择一个要删除的公文模板!")
}
return false;
}
var lastid="" //定义上次默认模板的id号
function setdefault() { //设置默认模板函数
var defaultid=""
for (var i=0;i<form.fileindex.length;i++)
{
var e = form.fileindex[i];
if (e.checked==true)
{
defaultid=e.value
break
}
}
if (lastid==defaultid) {}
else
{document.location="templeset.asp?id="+defaultid}
}
</script>
<link rel="stylesheet" href="apply.css" type="text/css">
</head>
<%
if Request.ServerVariables("Request_Method")="POST" and request("choosedel")="choosedel" then
j=request("checkbox").count
sql=request("checkbox")(1)
for i=2 to j
delid=request("checkbox")(i)
sql=sql&" or id="&delid
next
sql="delete from temple where id="&sql
conn.execute(sql)
end if
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu="return false">
<%set rs=server.createobject("adodb.recordset")
sql="select * from temple order by fileindex desc,wtime desc"
rs.open sql,conn,1,1
%>
<table width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td valign="top" width="940" align="center">
<form name="form" method="post" action="templelist.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="50">
<tr>
<td class="title" align="center"> <img src="images/systemtemple.gif"></td>
</tr>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center" height="26">
<tr height=1>
<td bgcolor="#A7BAE4" height="1" colspan="4"></td>
</tr>
<tr>
<td bgcolor="#D4DEF4" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="26">
<tr>
<td width="30"> </td>
<td width="160">目前共有<font class="picknum"><b><%=rs.recordcount %></b></font>个公文模板</td>
<td><a href="#" onClick="return checkaddtemple()" class="aapply">添加模板</a>
<a href="#" onClick="return checkdeltemple()" class="aapply">删 除</a>
<a href="javascript:gosystem()" class="aapply">返 回</a> </td>
</tr>
</table>
</td>
</tr>
<tr height=1>
<td bgcolor="#A7BAE4" height="1" colspan="4"></td>
</tr>
</table>
<table width="90%" border="0" cellspacing="0" align="center" cellpadding="0">
<tr align="center" bgcolor="#E7ECF7">
<td height="26" width="31%">模板名称:</td>
<td height="26" width="19%">模板类型:</td>
<td height="26" width="16%">模板大小</td>
<td height="26" width="17%">默认模板</td>
<td height="26" width="17%">删 除:</td>
</tr>
<%if rs.eof then %>
<tr height="1">
<td bgcolor="#ffffff" colspan="6"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr bgcolor="#F5FAFD" align="center">
<td height="26" colspan="6" class="f6wait">目前您还没有添加公文模板</td>
</tr>
<tr height="1">
<td bgcolor="#D6E1F8" colspan="6"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<%
else
while not rs.eof
%>
<tr height="1">
<td bgcolor="#ffffff" colspan="6"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr align="center" bgcolor="#F5FAFD">
<td height="26" width="31%">
<%
Temple=TempleUrl&"?id="&rs("id")%>
<a href="<%=Temple%>" target='_blank' class="aapply">
<%=rs("filename")%>
</a>
</td>
<td height="26" width="19%">
<a href="<%=Temple%>" target='_blank' class="aapply">
<%=rs("filetype")%>
</a></td>
<td height="26" width="16%"><%=rs("filesize")/1024%>K</td>
<td height="26" width="17%">
<%
response.write "<input type='radio' name='fileindex' value="&rs("id")
if rs("fileindex")=1 then response.write " checked"
response.write " onClick='setdefault()'>"
%>
</td>
<td height="26" width="17%">
<%if rs("fileindex")="1" then
else
%>
<input type="checkbox" name="checkbox" value="<%=rs("id")%>">
<% end if %>
</td>
</tr>
<tr height="1">
<td bgcolor="#D6E1F8" colspan="5"> <img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<%rs.movenext
wend
end if
%>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center" height="26">
<tr height=1>
<td bgcolor="#A7BAE4" height="1" colspan="4"></td>
</tr>
<tr>
<td bgcolor="#D4DEF4" align="center">模板名称:
<input type="text" name="filename" maxlength="30" size="20" class="boxinput">
文件位置:
<input type="file" name="file" class="boxinput">
</td>
</tr>
<tr height=1>
<td bgcolor="#A7BAE4" height="1" colspan="4"></td>
</tr>
</table>
<table width="100" border="0" cellspacing="0" cellpadding="0" align="center" height="1">
<tr>
<td> <object classid="clsid:8C9AA244-AC33-47F9-8968-CC114654A6EC" codebase="web.ocx" id="web" width="1" height="1">
<param name="_ExtentX" value="26">
<param name="_ExtentY" value="26">
</object>
<input type="hidden" name="choosedel">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!--#include file="close.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -