📄 news_class.asp
字号:
<!--#include file="../../inc/conn.asp" -->
<!--#include file="../category/category_class.asp" -->
<!--#include file="../../inc/function.asp" -->
<!--#include file="../webconfig/webcon.asp" -->
<%
addr0=request.servervariables("server_name")
if request.servervariables("server_port")<>"80" then addr0=addr0 & ":" & request.servervariables("server_port")
addr1=request.servervariables("url")
addr1=replace(addr1,"news_js.asp","")
addr1=replace(addr1,"news_more.asp","")
addr1=replace(addr1,"news_show.asp","")
url="http://"&addr0&addr1
Class Lbnews
Public Id
Public Title
Public Categoryid
Public CategoryName
Public Titlestyle
Public Titleurl
Public Content
Public Writer
Public Source
Public Keyword
Public Attribute
Public Text
Public Username
Public Template
Public Dateandtime
Public Pass
Public Orderid
Public Hits
Public Categorytype
Public Pic
Public CtID
Public Actionconn
Public Version
'Lbnews的私有属性
Private ct
Private action
Private idd
'构造函数
Private Sub Class_initialize
Set Actionconn=Conn
Set ct=new LBCategory
ct.categorytype="新闻"
Reset()
End Sub
'解析函数
Private Sub Class_terminate
Reset()
ActionConn.close
Set ActionConn=Nothing
Set ct=Nothing
End Sub
'重置属性
Public Sub Reset()
Version="Lbnow Create @ 2004-03-09 And Last Update @ 2004-4-19"
Id=0
Title=""
Categoryid=Request.QueryString("categoryid")
Titlestyle=",,"
Titleurl=""
Content=""
Writer=""
Source=""
Keyword=""
Attribute=",,"
Text=""
Username=session("adminname")
Dateandtime=Now()
Template=0
Pass=False
Orderid=0
Hits=0
Categorytype="新闻"
pic=""
action=Request.QueryString("action")
End Sub
'# ----------------------------------------------------------------------------
'# 函数:pagehtmlForm
'# 描述:显示表单页面
'# 参数: -
'# 返回:html代码
'# 作者:雷の龙
'# 日期:2004-04-09
'#-----------------------------------------------------------------------------
Private Function PageHtmlForm()
%>
<form method="post" action="?action=<%=action%>&id=<%=Id%>" name="form1">
<input type="hidden" name="attribute" value="">
<div align="center">
<table width=100% border=1 class="table" cellpadding=0 cellspacing=0>
<tr>
<td align="center" class="lefttd" width="100">文章标题</td>
<td class="righttd" height="25">
<input type="text" name="title" class="text" value="<%=Title%>" size=30>
颜色
<select name="titlestyle" style="font-size:12px" size="1">
<option style="background-color:000000;color:000000" value="#000000" selected>黑色</option>
<option style="background-color:red;color:red" value="red">红色</option>
<option style="background-color:0088FF;color:0088FF" value="#0088FF"<%If InStr(LCase(TitleStyle),"#0088ff")<>0 Then Response.Write " selected"%>>海蓝</option>
<option style="background-color:0000FF;color:0000FF" value="#0000FF"<%If InStr(LCase(TitleStyle),"#0000ff")<>0 Then Response.Write " selected"%>>亮蓝</option>
<option style="background-color:000088;color:000088" value="#000088"<%If InStr(LCase(TitleStyle),"#000088")<>0 Then Response.Write " selected"%>>深蓝</option>
<option style="background-color:888800;color:888800" value="#888800"<%If InStr(LCase(TitleStyle),"#888800")<>0 Then Response.Write " selected"%>>黄绿</option>
<option style="background-color:008888;color:008888" value="#008888"<%If InStr(LCase(TitleStyle),"#008888")<>0 Then Response.Write " selected"%>>蓝绿</option>
<option style="background-color:008800;color:008800" value="#008800"<%If InStr(LCase(TitleStyle),"#008800")<>0 Then Response.Write " selected"%>>橄榄</option>
<option style="background-color:8888FF;color:8888FF" value="#8888FF"<%If InStr(LCase(TitleStyle),"#8888ff")<>0 Then Response.Write " selected"%>>淡紫</option>
<option style="background-color:AA00CC;color:AA00CC" value="#AA00CC"<%If InStr(LCase(TitleStyle),"#aa00cc")<>0 Then Response.Write " selected"%>>紫色</option>
<option style="background-color:8800FF;color:8800FF" value="#8800FF"<%If InStr(LCase(TitleStyle),"#8800ff")<>0 Then Response.Write " selected"%>>蓝紫</option>
<option style="background-color:888888;color:888888" value="#888888"<%If InStr(LCase(TitleStyle),"#888888")<>0 Then Response.Write " selected"%>>灰色</option>
<option style="background-color:CCAA00;color:CCAA00" value="#CCAA00"<%If InStr(LCase(TitleStyle),"#ccaa00")<>0 Then Response.Write " selected"%>>土黄</option>
<option style="background-color:FF8800;color:FF8800" value="#FF8800"<%If InStr(LCase(TitleStyle),"#ff8800")<>0 Then Response.Write " selected"%>>金黄</option>
<option style="background-color:CC3366;color:CC3366" value="#CC3366"<%If InStr(LCase(TitleStyle),"#cc3366")<>0 Then Response.Write " selected"%>>暗红</option>
<option style="background-color:FF00FF;color:FF00FF" value="#FF00FF"<%If InStr(LCase(TitleStyle),"#ff00ff")<>0 Then Response.Write " selected"%>>紫红</option>
<option style="background-color:3366CC;color:3366CC" value="#3366CC"<%If InStr(LCase(TitleStyle),"#3366cc")<>0 Then Response.Write " selected"%>>蓝黑</option>
</select>
</td>
</tr>
<tr>
<td align="center" class="lefttd" width="100">所属栏目</td>
<td class="righttd" height="25">
<select class="select" name="categoryid" size="1">
<%
Dim c
If session("AdminPower")=10 Then
c="10"
Else
c=session("ct")
End If
ct.newsdownlistselected "-1",Categoryid,c
%>
</select></td>
</tr>
<tr>
<td align="center" class="lefttd" width="100">文章内容</td>
<td class="righttd" height="25">
<INPUT type="hidden" name="content1" value="<%=inhtml(Content)%>"><IFRAME ID="eWebEditor1" SRC="../htmledit/ewebeditor.asp?id=content1&style=standard_light" FRAMEBORDER="0" SCROLLING="no" WIDTH="550" HEIGHT="350"></IFRAME></td>
</tr>
<tr>
<td align="center" class="lefttd" width="100">文章属性</td>
<td class="righttd" height="25">
<SCRIPT LANGUAGE="JavaScript">
<!--
function showpicset()
{
if(document.form1.attribute[0].checked)
{
picset.style.display="";
}
else
{
picset.style.display="none";
}
}
//-->
</SCRIPT>
<input type="checkbox" class="checkbox" name="attribute" value="top"<%If InStr(LCase(Attribute),"top")<>0 Then Response.Write " checked"%>>置顶
</td>
</tr>
<tr>
<td align="center" class="lefttd" width="100">来源源</td>
<td class="righttd" height="25">
<input type="text" name="source" class="text" size=30 value="<%=Source%>"></td>
</tr>
<tr>
<td align="center" class="lefttd" width="100">作者</td>
<td class="righttd" height="25">
<input type="text" name="writer" class="text" size=30 value="<%=Writer%>"></td>
</tr>
<%
If CInt(session("AdminPower"))=10 Then
%>
<tr>
<td class="lefttd" width=100 align="center">审核</td>
<td class="righttd"><input type="radio" class="radio" name="pass" value="1" <%If pass Then Response.Write " checked"%>>通过审核 <input type="radio" class="radio" name="pass" value="0" <%If Pass=false Then Response.Write " checked"%>>未通过审核</td>
</tr>
<%
End If
%>
</table>
<BR>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="center"><input type="button" onclick="fsub();" name="B1" class="button" value=
<%If action="add" Then
Response.Write "添加新闻"
ElseIf action="modify" Then
Response.Write "修改新闻"
End if
%>
>
<input type="reset" name="b2" class="button" value="取消">
<input type="button" name="b2" onclick="fview();" class="button" value="预览">
<input type="button" name="b3" class="button" value="返回列表" onclick="location.href='?action=list';"></td>
</tr>
<SCRIPT LANGUAGE="JavaScript">
<!--
function fsub()
{
form1.action="?action=<%=action%>&id=<%=Id%>";
form1.target="_self";
form1.submit();
}
function fview()
{
form1.action="news_view.asp";
form1.target="_blank";
form1.submit();
}
//-->
</SCRIPT>
</table>
</div>
</form>
<%
End Function
'# ----------------------------------------------------------------------------
'# 函数:TemplateView
'# 描述:模板预览
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Public Function TemplateView(tcode)
Id=0
Title="这里显示的是标题"
Categoryid="000000"
Titlestyle="b,i,#000000"
Titleurl=""
Content="这里显示的是文章内容<br>谢谢大家对蓝滨的支持"
Writer="作者"
Source="来源"
Keyword="关键字"
Attribute="置顶,picnews,commend"
Text="文章的简介"
Username="雷の龙"
Dateandtime=Now()
Template=0
Pass=False
Orderid=0
Hits=0
Categorytype="新闻"
pic="../images/lblogo.gif"
Response.Write TemplateCode(tcode)
End Function
'# ----------------------------------------------------------------------------
'# 函数:PageHtmlList
'# 描述:新闻列表页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Private Function PageHtmlList
Dim key,fw,orderby,category
key=Request("key")
fw=Request("fw")
orderby=Request("orderby")
If orderby="" Then
orderby="orderid"
End If
category=Request.QueryString("category")
%>
<div align="center">
<form method="post" action="?action=list" 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="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=list&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="submit" class="button" value="删除" name="b1"></td>
</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"><%showpage totalcount,pagecount,nowpage,"?action=list&fw="&fw&"&key="&key&"&category="&category&""%></td>
</tr>
</table>
</div>
</form>
<%
End Function
'# ----------------------------------------------------------------------------
'# 函数:PagePassList
'# 描述:审核新闻列表页面
'# 参数: -
'# 返回:
'# 作者:雷の龙
'# 日期:2004
'#-----------------------------------------------------------------------------
Public Function PagePassList()
Dim key,fw,orderby,category
key=Request("key")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -