📄 admin_newslist.asp
字号:
<!--#include file = "../inc/dbclass.inc.asp" -->
<!--#include file = "../inc/syslogincheck.inc.asp" -->
<%
' =============================================================
' made by xiasp & 智多网络 http://www.cq18.com/ qq群:12403617
' =============================================================
%>
<%
response.expires = 0
response.expiresabsolute = now() - 1
response.addheader "pragma","no-cache"
response.addheader "cache-control","private"
response.cachecontrol = "no-cache"
%>
<%
call header("新闻列表")
call content()
call footer()
' 开始写入内容
sub content()
dim s_keyword, s_cataid
s_keyword = getsafestr(trim(request("keyword")))
s_cataid = getsafestr(trim(request("cataid")))
dim pmcount,pageno
'//设置新闻显示数量
pmcount = news_back_count
%>
<!--#include file = "admin_index_top.asp" -->
<br>
<script language="javascript">
<!--
function checkselect()
{
var count=0;
for(i=0;i<document.delnews.elements.length;i++)
{
if(document.delnews.elements[i].name=="newsid")
{
if(document.delnews.elements[i].checked==true)
{
count++;
}
}
}
if(count<=0)
{
alert("请选择一条要操作的信息!");
return false;
}
return true;
}
function cdel()
{
if(checkselect()==false)
{
return false;
}
if (confirm("你确定要删除这些新闻吗?不可恢复!")){
document.delnews.action.value = "del";
document.delnews.submit();
}
}
function ccheck()
{
if(checkselect()==false)
{
return false;
}
if (confirm("你确定要审核这些信息吗?")){
document.delnews.action.value = "check";
document.delnews.submit();
}
}
function cuncheck()
{
if(checkselect()==false)
{
return false;
}
if (confirm("你确定要撤销这些信息吗?浏览者将看不到这些信息!")){
document.delnews.action.value = "uncheck";
document.delnews.submit();
}
}
function view(newsfile) {
var gt = unescape('%3e');
var popup = null;
var over = "launch pop-up navigator";
popup = window.open('', 'popupnav', 'width=300,height=160,left=200,top=200,,resizable=no,scrollbars=no');
if (popup != null) {
if (popup.opener == null) {
popup.opener = self;
}
popup.location.href = newsfile;
}
}
function selectcheckbox()
{
for(i=0;i<document.delnews.elements.length;i++)
{
if(document.all("selectcheck").checked == true)
{
document.delnews.elements[i].checked = true;
}
else
{
document.delnews.elements[i].checked = false;
}
}
}
//-->
</script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25"><b><%=homepage_title%> - <font color="#ff0000">新闻列表</font></b></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#799ae1">
<tr>
<form action="admin_newslist.asp" method="post" name="togetnewslist" id="form1">
<td height="30" align=left> 搜索:
<input name="keyword" type=text value="<%=s_keyword%>" class="button1">
<select name="cataid" size="1" style="height:18" onchange="javascript:document.togetnewslist.submit();" id="select1">
<option value="">-->>新闻类别<<--</option>
<%
'开始读取数据库中已经定义的新闻类别
'其实这么写,感觉太没有效率了,应该定义一个子程序
dim crs, csql, j, tempcatastr
set crs = server.createobject( "adodb.recordset" )
csql = "select * from newscata order by c_rootid"
crs.open csql, oconn, 1, 3
do while not crs.eof
tempcatastr = "<option value='"&trim(crs("c_rootid"))&"'"
if trim(crs("c_rootid")) = s_cataid then tempcatastr = tempcatastr&" selected"
tempcatastr = tempcatastr&">"
tempcatastr = tempcatastr&" |"
for j =1 to int(len(trim(crs("c_rootid")))/4)
tempcatastr = tempcatastr&" |"
next
tempcatastr = tempcatastr&"_"&trim(crs("c_title"))&"</option>"
response.write tempcatastr
crs.movenext
loop
crs.close
set crs = nothing
%>
</select>
<input type="submit" name="submit" value=" 搜 索 " class="button2">
</td>
<td align=right>
<div align="center">
<input name=reloadpage type=button value=" 刷 新 " id="reloadpage" onclick="javascript:window.location.reload();" class="button2">
</div></td>
</form>
</tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolordark="#ffffff" bordercolorlight="#cccccc">
<tr bgcolor="#799ae1">
<td width="6%"><div align='center'><font color="#ffffff">选定</font></div></td>
<td width="7%" height="20" bgcolor="#799ae1"><div align="center"><font color="#ffffff">序号</font></div></td>
<td height="20" bgcolor="#799ae1"><div align="center"><font color="#ffffff">标 题</font></div></td>
<td width="22%" height="20"><div align="center"><font color="#ffffff">发布时间</font></div></td>
<%if news_check = 1 then%>
<td width="7%"><div align="center"><font color="#ffffff">状态</font></div></td>
<%end if%>
<td width="7%"><div align="center"><font color="#ffffff">修改</font></div></td>
</tr>
<form name="delnews" action="admin_newsdelete.asp" method=post>
<input name="action" type="hidden" value="" id="action">
<%
if s_cataid = "" then
if s_keyword <> "" then
ssql = "select * from newsdata where d_title like '%"&s_keyword&"%' order by d_sortid desc"
else
ssql = "select * from newsdata order by d_sortid desc"
end if
else
if s_keyword <> "" then
ssql = "select * from newsdata where d_cataid like '"&s_cataid&"%' and d_title like '%"&s_keyword&"%' order by d_sortid desc"
else
ssql = "select * from newsdata where d_cataid like '"&s_cataid&"%' order by d_sortid desc"
end if
end if
ors.open ssql, oconn, 1, 1
dim rcount, loopno, mpage, i
rcount = ors.recordcount
if pmcount="" or isempty(pmcount) or pmcount<1 then
pmcount=20
end if
ors.pagesize = pmcount '设置每页数
mpage = ors.pagecount '得到总页数
pageno = getsafeint(clng(request("pageno")),1)
if cint(pageno) < 1 then pageno = 1
if cint(pageno) > mpage then pageno = mpage
if ors.bof and ors.eof then
response.write "<tr><td colspan='6'> 暂时没有任何新闻!</td></tr>"
else
ors.absolutepage = pageno '将指针移至指定页的第一条记录
loopno = pmcount
i=1
do while not ors.eof and loopno > 0
%>
<tr>
<td width="6%"><div align="center"><input type="checkbox" name="newsid" value="<%=trim(ors("d_id"))%>"></div></td>
<td width="7%" height="22"><div align="center"><%=( (pageno-1) * ors.pagesize) + i%> <a href="javascript:view('admin_news_sort_set.asp?newsid=<%=ors("d_id")%>');" alt="调整位置" class="tt2">=></a></div></td>
<td height="22" style="word-break:break-all;">
<% if ors("d_special") = 1 then
response.write "●"
else
response.write "○"
end if
response.write "<a href='../show.asp?id="& ors("d_id") &"' class='tt4' target='_blank'>"
if len(ors("d_title"))>30 then
response.write left(ors("d_title"),30)&"....</a>"
else
response.write ors("d_title")&"</a>"
end if
if ors("d_savefilename") <> "" then
response.write " <img src='../images/news.gif' border=0>"
end if
%>
</a></td>
<td width="22%" height="22"> <div align="center"><%=ors("d_addtime")%></div></td>
<%if news_check = 1 then%>
<td width="7%" height="22">
<%
if ors("d_num") = 1 then
response.write"<div align='center'>已审</div>"
else
response.write"<div align='center'><font color='#ff0000'>待审</font></div>"
end if
%>
</td>
<%end if%>
<td width="7%"><div align='center'><a href="admin_newsmodify.asp?id=<%=ors("d_id")%>" class="tt2">修改</a></div></td>
</tr>
<%
ors.movenext
loopno=loopno-1
i=i+1
loop
ors.close
set ors=nothing
end if
%>
</form>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form name="pageform" method="post" action="admin_newslist.asp">
<tr>
<td width="6%" height="25">
<div align="center">
<input type='checkbox' name='selectcheck' id=selectcheck2 onclick="selectcheckbox()">
</div></td>
<td width="33%">全部选中
<input name="delbtn" value="删除" type="button" class="button2" onclick="cdel();">
<%if news_check = 1 then%>
<input name="delbtn" value="审核" type="button" class="button2" onclick="ccheck();">
<input name="delbtn" value="撤销" type="button" class="button2" onclick="cuncheck();">
<%end if%>
</td>
<td>
<div align="right">
共<%=cstr(rcount)%>条新闻 当前为:<font color="#ff0000"><%=cstr(pageno)&"</font>/"&cstr(mpage)%>页
<%if cint(pageno)>1 then%>
<font face="webdings" color="#ff0000">7</font> <a href='admin_newslist.asp?cataid=<%=s_cataid%>&keyword=<%=s_keyword%>&pageno=<%=pageno-1%>' class="tt5">上一页</a>
<%end if
if cint(pageno) < cint(mpage) then
%>
<font face="webdings" color="#ff0000">8</font> <a href='admin_newslist.asp?cataid=<%=s_cataid%>&keyword=<%=s_keyword%>&pageno=<%=pageno+1%>' class="tt5">下一页</a>
<%end if%>
跳到第 <input type=text size=3 name="pageno" value="<%=pageno%>" class="button1"> 页
<input type="hidden" name="cataid" value="<%=s_cataid%>">
<input type="hidden" name="keyword" value="<%=s_keyword%>">
<input name="imagefield" type="image" src="../images/go.gif" border="0" align="absmiddle">
</div></td>
</tr>
</form>
</table></td>
</tr>
</table>
<p> </p>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -