📄 news_editlist.asp
字号:
<!--#include file="../Include/TimeOut.asp"-->
<%modulecode="0301"%>
<!--#include file="../Include/ModuleUserCheck.asp"-->
<!--#include file="../Include/online.asp"-->
<html>
<head>
<title>新闻列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
TD {FONT-SIZE: 9pt}
A:link
{
COLOR: #000000;
FONT-FAMILY: 宋体;
FONT-SIZE: 9pt
}
A:visited
{
COLOR: #000000;
FONT-FAMILY: 宋体;
FONT-SIZE: 9pt
}
A:active
{
COLOR: #000000;
FONT-FAMILY: 宋体;
FONT-SIZE: 9pt
}
A:hover
{
COLOR: blue;
FONT-FAMILY: 宋体;
FONT-SIZE: 9pt
}
</style>
</head>
<Script Language=JavaScript>
<!--
function SelAll_onclick(){
if(ConList.SelAll.checked){
SetAll();
}
else{
UnSetAll();
}
}
function SetAll(){
var intCount;
if(ConList.all("checkCon").length > 1){
for(intCount = 0; intCount < ConList.all("checkCon").length; intCount++){
ConList.checkCon(intCount).checked = true;
}
}
else{
ConList.checkCon.checked = true;
}
}
function UnSetAll(){
var intCount;
if(ConList.all("checkCon").length > 1){
for(intCount = 0; intCount < ConList.all("checkCon").length; intCount++){
ConList.checkCon(intCount).checked = false;
}
}
else{
ConList.checkCon.checked = false;
}
}
function checkCon_onclick(){
var intCount;
ConList.SelAll.checked = true;
if(ConList.all("checkCon").length > 1){
for(intCount = 0; intCount < ConList.all("checkCon").length; intCount++){
if(ConList.checkCon(intCount).checked == false){
ConList.SelAll.checked = false;
}
}
}
else{
if(ConList.checkCon.checked == false){
ConList.SelAll.checked = false;
}
}
}
//-->
</Script>
<script language="vbscript"runat="server">
function msgzh()
msgzh= MsgBox ("确定要删除这些记录吗?", vbYesNo, "提示信息")
if msgzh=vbyes then document.ConList.submit()
end function
function check_onclick(i,tpr)
msgsindel= MsgBox ("确定要删除这条记录吗?", vbYesNo, "提示信息")
if msgsindel=vbyes then
if tpr > 1 then
for intcount = 0 to ConList.all("checkCon").length - 1
if intcount=i-1 then ConList.checkCon(intCount).checked=true else ConList.checkCon(intCount).checked=false
next
else
ConList.checkCon.checked = true
end if
document.ConList.submit()
end if
end function
</script>
<body bgcolor="#FFFFFF" text="#000000">
<%
dim objrec 'recordset对象
dim strsql 'sql语句
if Request.QueryString("muldel")="muldel"then '从删除转来, 删除相应记录
for each item in Request.Form("checkCon")
code=split(Item,",")
'删除数据库记录
strsql="delete from XT_TD_usermessage where 消息题名="+"'"+code(0)+"'"
conn.Execute strsql,1
'删除附件文件
if code(1)<>"0" then
set fileobj=Server.CreateObject ("scripting.filesystemobject")
filepath=server.mappath("\news\fj") & "\" & code(1)&"*.*"
fileobj.DeleteFile(filepath)
set fileobj=nothing
end if
next
end if
if not Request.QueryString("strsql")="" then
select case Request.QueryString("strsql")
case "query" '由查询转来
'dim newstitle,SelectSendDate,Syear
dim FromSendDate
dim strQueryType
dim strSQLWhere
newstitle=trim(Request.Form("newstitle"))
NewsType=trim(Request.Form("NewsType"))
CheckSendDate=trim(Request.Form("CheckSendDate"))
FromSendYear=cstr(request("FromSendyear"))
FromSendMonth=cstr(request("FromSendMonth"))
FromSendDay=cstr(request("FromSendDay"))
FromSendDate=cdate(FromSendmonth&","&FromSendday&","&FromSendyear)'注意,好一番修改
ToSendYear=cstr(request("ToSendyear"))
ToSendMonth=cstr(request("ToSendMonth"))
ToSendDay=cstr(request("ToSendDay"))
ToSendDate=cdate(ToSendmonth&","&ToSendday&","&ToSendyear)'注意,好一番修改
formSendDate=trim(Request.Form("SenderName"))
'生成查询语句
'复选框选中时,strQueryType="%"
if Request.Form("checkbox").Count=1 then
strQueryType="%"
else
strQueryType=""
end if
'无任何where选项时
ListType=Request.QueryString ("ListType")'根据传来的变量确定是个人新闻管理,还是系统新闻管理
if listType="system" then
WhereType="1=1 "'系统新闻管理
else
WhereType="发送人编码='"&session("usercode")&"'"'个人新闻管理
end if
strsql="select * from XT_VD_usermessage where "&WhereType
'按查询界面各输入框生成多条件where选项
if not newstitle="" then
strSQLWhere=strSQLWhere+" and 消息题名 like '"+strQueryType+newstitle+strQueryType+"'"
end if
if not newstype="" then
strSQLWhere=strSQLWhere+" and 发送类别 like '"+strQueryType+newstype+strQueryType+"'"
end if
if CheckSendDate="sendckecked" then
strSQLWhere=strSQLWhere+" and 发送日期>= '"+Cstr(FromsendDate)+"' and 发送日期<='"+Cstr(ToSendDate)+"'"
end if
strSQL=strSQL+StrSQLWhere+"order by 发送日期 desc"
case else '各页间转换
strsql=Request.QueryString("strsql")
end select
set objres=server.CreateObject ("adodb.recordset")
objres.CursorType =3
objres.CursorLocation =3
objres.LockType =2
objres.Open strsql,strconn
dim pagesum '页数
dim thispagerecords '当前页记录条数
dim recordcode '记录序号
dim curpage '当前页码
dim pagesize
pagesize=10
pagesum=objres.PageCount
if Request.QueryString("page")=""then curpage=1 else curpage=Request.QueryString("page")
if cint(curpage)> cint(pagesum) then curpage=pagesum '转换成整数格式时必须的,大量实验已经证明
end if
%>
<% if not Request.QueryString("strsql")="" then %>
<form name=ConList method="post" action="../news/news_EditList.asp?muldel=muldel&strsql=<%=server.URLEncode(strsql)%>&page=<%=curpage%>">
<% else %>
<form name=ConList method="post" action="../news/news_EditList.asp">
<%
end if
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="383"><img src="images/title_news.gif" width="227" height="38"></td>
<td width="53">
</td>
<td width="43">
<div align="center"><a href="../news/News_Query.asp?query=query&ListType=<%=Request.QueryString("ListType")%>"><img src="../public/images/query.gif" width="24" height="18" border="0"><br>
</a> <font color="#003399">查询</font></div>
</td>
<td width="42">
<div align="center"><a href="../news/News_edit.asp?strsql=<%=server.URLEncode (strsql)%>&page=<% =curpage%>"><img src="../public/images/new.gif" width="19" height="23" border="0"></a><br>
<font color="#003399">新增</font> </div>
</td>
<td width="43">
<div align="center"><a href="vbscript:msgzh()"><img src="../public/images/del.gif" width="23" height="20" border="0"></a><br>
<font color="#003399">删除</font> </div>
</td>
<td width="46">
<div align="center"><a href="#"><img src="../public/images/print.gif" width="23" height="20" border="0"></a><br>
<font color="#003399">打印</font></div>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolor="#0099FF" align="center" bgcolor="#006699">
<tr bordercolor="#0099FF" bgcolor="#6699CC">
<td width="28" height="26">
<div align="center">
<input type="checkbox" name="SelAll" onclick ="SelAll_onclick()"value="checkbox">
</div>
</td>
<td width="33" height="26" align="center">
<div align="center">序号</div>
</td>
<td width="33" height="26" align="center">附件</td>
<td width="72" height="26" align="center">消息类别</td>
<td width="312" height="26">
<div align="center">消 息 标 题</div>
</td>
<td width="87" height="26">
<div align="center">发送日期</div>
</td>
<td width="108" height="26">
<div align="center">发送者</div>
</td>
<td width="45" height="26">
<div align="center">修改</div>
</td>
<td width="51" height="26">
<div align="center">删除</div>
</td>
</tr>
<%
if Request.QueryString("strsql")="" then Response.End
if objres.RecordCount >pagesize*curpage then thispagerecords=pagesize else thispagerecords=objres.RecordCount-pagesize*(curpage-1)
if curpage=0 then
recordcode=0
else recordcode=10*(curpage-1)
end if
if objres.RecordCount >0 then
if objres.RecordCount=1 then
objres.MoveFirst
else
objres.Move((curpage-1)*10)
end if
else
%>
<tr bgcolor="#FFFFFF">
<td colspan="9" height="26"> 对不起,没有符合要求的记录! </td>
</tr>
<%
Response.End
end if
for i=1 to thispagerecords
recordcode=recordcode+1
if not objres.EOF then
%>
<tr bgcolor="#FFFFFF">
<td width="28" height="26">
<div align="center">
<input type="checkbox" name="checkCon"onclick="checkCon_onclick()" value=<% =objres.Fields("消息题名").Value %>,<% =objres.Fields("附件号").Value %>>
</div>
</td>
<td width="33" align="center" height="26">
<% =recordcode%>
</td>
<td width="33" height="26" align="center">
<%if objres.fields("附件号").value<>"0" then %>
<img src="images/fj.gif" width="16" height="16" alt="修改附件" border="0">
<%end if%>
</td>
<td width="72" height="26" align="center">
<% = objres.Fields("发送类别").Value %>
</td>
<td width="312" height="26"> <a href="javascript:open1('<%=objres("消息题名")%>','<%=cstr(objres("发送日期"))%>')">
<% = objres.Fields("消息题名").Value %>
</a></td>
<td width="87" height="26">
<% = objres.Fields("发送日期").Value %>
</td>
<td width="108" height="26">
<% = objres.Fields("发送人姓名").Value %>
</td>
<td width="45" height="26">
<div align="center"><a href="../news/News_edit.asp?newstitle=<%=objres.Fields("消息题名").Value%>&SendDate=<% =Cstr(objres.Fields("发送日期").Value) %>&strsql=<%=server.URLEncode(strsql)%>&page=<%=curpage%>&edit=edit"><img src="../public/images/edit.gif" width="19" height="17" border="0" alt="修改"></a></div>
</td>
<td width="51" height="26">
<div align="center"><a href="vbscript:check_onclick(<%=i%>,<% =thispagerecords%>)"><img src="../public/images/del1.gif" width="19" height="17" border="0" alt="删除"></a></div>
</td>
</tr>
<%
objres.MoveNext
end if
next
%>
<tr bgcolor="#6699CC">
<td colspan="9" height="20">
<div align="right">
<%
if curpage>1 then Response.Write ("<a href="+"News_EditList.asp?ListType="&Request.QueryString("ListType")&"&page=1"+"&strsql="+server.URLEncode(strsql)+"> 首页</a>"+" | ") else Response.Write "首页 | "
if recordcode>pagesize then Response.Write ("<a href="+"News_EditList.asp?ListType="&Request.QueryString("ListType")&"&page="+cstr(curpage-1)+"&strsql="+server.URLEncode(strsql)+"> 上一页</a>"+" | ") else Response.Write "上一页 | "
if recordcode<objres.RecordCount then Response.Write ("<a href="+"News_EditList.asp?ListType="&Request.QueryString("ListType")&"&page="+cstr(curpage+1)+"&strsql="+server.URLEncode(strsql)+"> 下一页</a>"+" | ") else Response.Write "下一页 | "
if recordcode<objres.RecordCount then Response.Write ("<a href="+"News_EditList.asp?ListType="&Request.QueryString("ListType")&"&page="+cstr (pagesum)+"&strsql="+server.URLEncode(strsql)+"> 末页</a>"+" ") else Response.Write "末页 "
%>
第
<% =curpage %>
页/共
<% =pagesum %>
页/共
<% =objres.RecordCount %>
条记录 </div>
</td>
</tr>
</table>
</form>
</body>
</html>
</style>
<script language=javascript>
function open1(title,date)
{
window.open("news_ContentDisplay.asp?newstitle="+title+"&senddate="+date,"新闻内容","height=410,width=500,toolbar=no,menubar=no,scrollbar=yes,resizable=no,status=no,location=no")
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -