📄 news_class.asp
字号:
fw=Request("fw")
orderby=Request("orderby")
If orderby="" Then
orderby="orderid"
End If
category=Request.QueryString("category")
%>
<div align="center">
<form method="get" action="?action=pass" name="form2">
<table width=100% style="border:0px" class="table" cellpadding=0 cellspacing=0>
<tr>
<td class="td">
<select class="select" name="fw" size="1">
<option value="title">标题</option>
<option value="content">文章内容</option>
</select>
<input type="hidden" name="action" value="pass">
<input type="text" name="key" class="text" value="">
<input type="submit" class="button" value="搜索">
</td>
<td class="td">
<select class="select" name="cl" size="" onchange="location.href='?action=pass&fw=<%=fw%>&key=<%=key%>&category='+cl.value;">
<option value="">所有栏目的文章</option>
<%
ct.newsdownlistselected "-1",category,session("ct")
%>
</select>
</td>
</tr>
</table>
</form>
</div>
<form method="post" action="?action=delete" name="form1">
<div align="center">
<table width=100% border=1 class="table" cellpadding=0 cellspacing=0>
<tr class="headtr">
<td class="td" height="28" align="center">新闻标题</td>
<td class="td" height="28" align="center" width="100">所属栏目</td>
<td class="td" height="28" align="center" width="130">添加日期</td>
<td class="td" height="28" align="center" width="130">文章属性</td>
<td class="td" height="28" align="center" width="100">管理 <input type="button" class="button" value="删除" onclick="del()"></td>
<SCRIPT LANGUAGE="JavaScript">
<!--
function del()
{
form1.action="?action=delete";
form1.submit();
}
//-->
</SCRIPT>
</tr>
<%
Dim sql,rs
Set rs=Server.CreateObject("adodb.recordset")
sql="select id,title,(select categoryname from category where categoryid=news.categoryid and categorytype=news.categorytype) as categoryname,dateandtime,attribute from news where categorytype='"&categorytype&"' and pass=0 "
If category<>"" Then
sql=sql&" and left(categoryid,"&len(category)&")='"&category&"'"
End If
If key<>"" Then
sql=sql&" and "&fw&" like '%"&key&"%'"
End If
sql=sql&"order by cbool(instr(attribute,'top')) asc,"&orderby&" desc"
rs.open sql,ActionConn,3,1
Dim totalcount,count,pagecount,nowpage,a
totalcount=rs.recordcount
'***********************************分页
count=30
if count<=0 then
count=30
end if
if not rs.eof then
rs.pagesize=count
pagecount=rs.pagecount
if request.querystring("page")="" then
nowpage=1
else
nowpage=int(request.querystring("page"))
end if
if nowpage>=rs.pagecount then
nowpage=rs.pagecount
elseif nowpage<=1 then
nowpage=1
end if
rs.absolutepage=nowpage
else
pagecount=1
nowpage=1
end if
a=1
do while not rs.eof and a<=count
Id=rs(0)
Title=rs(1)
CategoryName=rs(2)
DateAndTime=rs(3)
Attribute=rs(4)
%>
<tr>
<td class="lefttd" height="20" align="center"><A HREF="
news_show.asp?id=<%=ID%>" target="_Blank"><font color=black><%=Title%></font></A></td>
<td class="lefttd" height="20" align="center"><%=CategoryName%></td>
<td class="lefttd" height="20" align="center"><%=DateAndTime%></td>
<td class="lefttd" height="20" align="center">
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td class="td" align="center"><%showattribute "top","置顶"%></td>
</tr>
</table>
</td>
<td class="lefttd" height="20" align="center">
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td class="td" align="center"><a title="" href="?action=modify&id=<%=Id%>">修改</a></td>
<td class="td" align="center"><input type="checkbox" class="checkbox" name="idd" value="<%=Id%>"></td>
</tr>
</table>
</td>
</tr>
<%
a=a+1
rs.movenext
loop
rs.Close
Set rs = Nothing
%>
</table>
<BR>
<table width=100% style="border:0px"; cellpadding=0 cellspacing=0 class="table">
<tr>
<td class="td" align="right"><input type="button" class="button" value="通过审核" onclick="pass()">
</td>
<SCRIPT LANGUAGE="JavaScript">
<!--
function pass()
{
form1.action="?action=pass";
form1.submit();
}
//-->
</SCRIPT>
</tr>
<tr>
<td class="td"><%showpage totalcount,pagecount,nowpage,"?action=list&fw="&fw&"&key="&key&"&category="&category&""%></td>
</tr>
</table>
</div>
</form>
<%
End Function
'# ----------------------------------------------------------------------------
'# 函数:Pass()
'# 描述:通过审核
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Public Function NewsPass()
Dim Sql
RequestForm()
If Id="-1" Then
Sql="update News set pass=1 Where Categorytype='"&CategoryType&"'"
ElseIf Id<>"" And id<>"0" Then
Sql="update News set pass=1 Where Id="&Id
ElseIf idd<>"" Then
Sql="update News set pass=1 where Id in ("&idd&")"
Else
Call ShowError("没有通过任何新闻审核")
End If
Actionconn.Execute(Sql)
If Err Then
Call ShowError("新闻审核失败")
Else
Call ShowSuccess("新闻审核成功","?action=pass")
End If
End Function
'# ----------------------------------------------------------------------------
'# 函数:showattribute
'# 描述:列表显示文章属性
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Private Function ShowAttribute(atb,showtext)
If InStr(LCase(Attribute),atb)<>0 Then
Response.Write "<a href='?action=set&op="&atb&"&id="&Id&"'><font color='#000000'>"&_
""&showtext&""&_
"</font></a>"
Else
Response.Write "<a href='?action=set&op="&atb&"&id="&Id&"'><font color='#C0C0C0'>"&_
""&showtext&""&_
"</font></a>"
End If
End Function
'# ----------------------------------------------------------------------------
'# 函数:setattribute
'# 描述:设置文章属性
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Private Function SetAttribute(sid,atb)
Dim rs
Dim satb
Set rs=ActionConn.execute("select attribute from news where id="&sid)
If Not rs.eof Then
satb=rs(0)
If InStr(satb,atb)<>0 Then
satb=Replace(satb,atb,"")
Else
satb=satb&","&atb
End If
End If
rs.Close
Set rs = Nothing
ActionConn.execute("update news set attribute='"&satb&"' where id="&sid)
Response.Write "<Script>location.href='?action=list';</script>"
End Function
'# ----------------------------------------------------------------------------
'# 函数:RequestForm
'# 描述:取得传递信息
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Private Function RequestForm()
action=indb(Request.QueryString("action"))
idd=indb(Request.Form("idd"))
Id=indb(Request.QueryString("id"))
Title=indb(Request.Form("title"))
Categoryid=indb(Request.Form("categoryid"))
Titlestyle=indb(Request.Form("titlestyle"))
Titleurl=indb(Request.Form("titleurl"))
Dim i
Content=""
For i = 1 To Request.Form("content1").Count
Content = Content & Request.Form("content1")(i)
Next
Content=indb(Content)
Writer=indb(Request.Form("writer"))
Source=indb(Request.Form("source"))
Keyword=indb(Request.Form("keyword"))
Attribute=indb(Request.Form("attribute"))
Text=indb(Request.Form("text"))
Username=indb(session("adminname"))
Dateandtime=Now()
Template=0
Pass=Request.Form("pass")
If IsNull(Pass) Or Pass="" Then
Pass=0
End If
Orderid=Id
pic=indb(Request.Form("pic"))
Hits=0
End Function
'# ----------------------------------------------------------------------------
'# 函数:NewsView()
'# 描述:
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Public Function NewsView()
RequestForm()
Set rs=ActionConn.execute("select code from template where id="&ctemplate)
Dim showcode
showcode=rs(0)
Response.Write TemplateCode(showcode)
End Function
'# ----------------------------------------------------------------------------
'# 函数:Addpage
'# 描述:添加新闻页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Public Function AddPage()
If LCase(Request.ServerVariables("request_method"))="post" Then
RequestForm()
pagination()
Else
Source=csource
Writer=cwriter
PageHtmlForm()
End If
End Function
'# ----------------------------------------------------------------------------
'# 函数:Pagination
'# 描述:内容分页的实现
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Private Function Pagination()
Dim c
c=Split(LCase(Content),"[page]")
Dim t
t=Title
Dim cnum
cnum=UBound(c)
If cnum<1 Then
Add()
Else
Content=""
Title=""
For i= 0 To cnum
Content=c(i)
Title=t&"("&i+1&")"
Add()
Content=""
Title=""
Next
End If
If Err Then
Call ShowError("新闻添加失败")
Else
Call ShowSuccess("新闻添加成功","?action=add&categoryid="&Categoryid&"")
End If
End Function
'# ----------------------------------------------------------------------------
'# 函数:Modifypage
'# 描述:添加新闻页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Public Function ModifyPage()
requestform()
If Id="" Or IsNumeric(Id)=false Then
Response.Write "错误的参数"
exit function
End If
If LCase(Request.ServerVariables("request_method"))="post" Then
RequestForm()
Modify()
Else
GetNews(Id)
PageHtmlForm()
End If
End Function
'# ----------------------------------------------------------------------------
'# 函数:listpage
'# 描述:新闻列表页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Public Function ListPage()
PageHtmlList()
End Function
'# ----------------------------------------------------------------------------
'# 函数:setpage
'# 描述:新闻列表页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-4-12
'#-----------------------------------------------------------------------------
Public Function SetPage()
Dim op
requestform()
op=Request.QueryString("op")
If op="" Or Id="" Or action="" Then
Response.Write "错误的参数"
exit function
End If
SetAttribute Id,op
End Function
'# ----------------------------------------------------------------------------
'# 函数:Deletepage
'# 描述:删除新闻页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Public Function DeletePage()
If LCase(Request.ServerVariables("request_method"))="post" Then
RequestForm()
Delete()
Else
PageHtmlList()
End If
End Function
'# ----------------------------------------------------------------------------
'# 函数:add
'# 描述:添加新闻
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Private Function Add()
Dim Rs,Sql
Set Rs=Actionconn.Execute("Select Max(Id) From News")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -