📄 site.asp
字号:
<% Option Explicit %>
<!--#include file="inc/Cls_DB.asp" -->
<!--#include file="Inc/Const.asp" -->
<%
Dim DBC,Conn,CollectConn
Set DBC = New DataBaseClass
Set CollectConn = DBC.OpenConnection()
DBC.ConnStr = "DBQ=" + Server.MapPath(DataBaseConnectStr) + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'判断权限
%>
<%
'判断权限结束
Dim Rs
if Request("Action") = "Del" then
CollectConn.Execute("delete from Site where ID=" & Request("id"))
Response.Redirect("site.asp")
Response.End
end if
if Request.Form("vs")="add" then
if Request.Form("SiteName")="" Or Request.Form("SysTemplet")="" or Request.Form("SiteUrl")="" or Request.Form("objURL")="" or Request.Form("SiteClass")="" or Request.Form("SysClass")="" then
Response.write"<script>alert(""请填写完整!"");location.href=""javascript:history.back()"";</script>"
Response.end
end if
Dim Sql
Set Rs = Server.CreateObject ("ADODB.RecordSet")
Sql = "Select * from Site where 1=0"
Rs.Open Sql,CollectConn,1,3
Rs.AddNew
Rs("SiteName") = Request.Form("SiteName")
Rs("SysTemplet") = Request.Form("SysTemplet")
Rs("SiteUrl") = Request.Form("SiteUrl")
Rs("objURL") = Request.Form("objURL")
Rs("SiteClass") = Request.Form("SiteClass")
Rs("SysClass") = Request.Form("SysClass")
Rs("demoid") = Request.Form("demoid")
if Request.Form("IsAuto")<>"" then
Rs("IsAuto") = true
else
Rs("IsAuto") = false
end if
Rs.UpDate
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
Set CollectConn = Nothing
Response.Redirect("Site.asp")
Response.end
elseif Request("vs")="Copy" then
Dim SiteID,RsCopySourceObj,RsCopyObjectObj,FiledObj
SiteID = Request("SiteID")
if SiteID <> "" then
Set RsCopySourceObj = CollectConn.Execute("Select * from Site where ID=" & SiteID)
if Not RsCopySourceObj.Eof then
Set RsCopyObjectObj = Server.CreateObject("ADODB.RecordSet")
RsCopyObjectObj.Open "Select * from Site where 1=0",CollectConn,3,3
RsCopyObjectObj.AddNew
For Each FiledObj In RsCopyObjectObj.Fields
if LCase(FiledObj.name) <> "id" then
RsCopyObjectObj(FiledObj.name) = RsCopySourceObj(FiledObj.name)
end if
Next
end if
RsCopyObjectObj.Update
Set RsCopySourceObj = Nothing
Set RsCopyObjectObj = Nothing
end if
Set Conn = Nothing
Set CollectConn = Nothing
Response.Redirect("Site.asp")
Response.end
end if
if Request("Action") = "Addsite" then
Call Add()
else
Call Main()
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>自动新闻采集—站点设置</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<link href="Inc/Collect.css" rel="stylesheet">
<body leftmargin="0" topmargin="0">
<%
Sub Main()
Dim RsSite,SiteSql,CheckInfo,StrPage,Select_Count,Select_PageCount,i
StrPage = request.querystring("Page")
if StrPage <= 1 or StrPage = "" then StrPage = 1
Set RsSite = Server.CreateObject ("ADODB.RecordSet")
SiteSql="Select * from Site order by id desc"
RsSite.Open SiteSql,CollectConn,1,1
if RsSite.eof then
RsSite.close
Set RsSite = Nothing
CollectConn.Close
Set CollectConn = Nothing
Response.Write"没有新闻采集站点,请<a href=?Action=Addsite>添加</a>。"
Response.End
end if
RsSite.PageSize = 12
RsSite.AbsolutePage = Cint(StrPage)
Select_Count = RsSite.recordcount
Select_PageCount = RsSite.PageCount
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="9%" height="30" nowrap bgcolor="#FFFFFF" class="ButtonList">
<div align="center">状态</div></td>
<td width="19%" height="30" nowrap bgcolor="#FFFFFF" class="ButtonList">
<div align="center">站点名称</div></td>
<td width="20%" height="30" nowrap bgcolor="#FFFFFF" class="ButtonList">
<div align="center">站点类别</div></td>
<td width="9%" height="30" bgcolor="#FFFFFF" class="ButtonList" nowrap>
<div align="center">采集对象页</div></td>
<td width="20%" height="30" nowrap bgcolor="#FFFFFF" class="ButtonList">
<div align="center">采集到栏目</div></td>
<td width="11%" height="30" nowrap class="ButtonList">
<div align="center">操作</div></td>
<td width="12%" height="30" nowrap class="ButtonList">
<div align="center">开始手工采集</div></td>
</tr>
<%
for i=1 to RsSite.pagesize
if RsSite.Eof then Exit For
Dim IsCollect,SysClassCName,RsTempObj,CollectPromptInfo
if RsSite("ListHeadSetting") <> "" And RsSite("ListFootSetting") <> "" And RsSite("LinkHeadSetting") <> "" And RsSite("LinkFootSetting") <> "" And RsSite("PagebodyHeadSetting") <> "" And RsSite("PagebodyFootSetting") <> "" And RsSite("PageTitleHeadSetting") <> "" And RsSite("PageTitleFootSetting") <> "" then
if RsSite("IsLock") = True then
IsCollect = False
CollectPromptInfo = "站点已经被锁定,不能采集"
else
IsCollect = True
CollectPromptInfo = "可以采集,请检查是否设置正确,否则不能进行采集"
end if
else
IsCollect = False
CollectPromptInfo = "不能采集,请把匹配规则设置完整"
end if
Set RsTempObj = Conn.Execute("Select boardname from [board] where boardID=" & RsSite("SysClass") & "")
if Not RsTempObj.Eof then
SysClassCName = RsTempObj("boardName")
else
SysClassCName = "栏目不存在"
IsCollect = False
CollectPromptInfo = "目标栏目不存在,不能采集"
end if
Set RsTempObj = Nothing
%>
<tr bgcolor="#FFFFFF" title="<% = CollectPromptInfo %>" onMouseOver="this.style.backgroundColor='#EFEFEF'" onMouseOut="this.style.backgroundColor=''">
<td height="26" nowrap>
<div align="center">
<%
if RsSite("IsLock") = True then
Response.Write("锁定")
else
Response.Write("有效")
end if
%>
</div></td>
<td nowrap>
<div align="center"><% = RsSite("SiteName") %>
</div></td>
<td nowrap>
<div align="center"><% = RsSite("SiteClass") %>
</div></td>
<td nowrap>
<div align="center"><a href="<% = RsSite("objURL") %>" target="_blank"><img src="Images/objpage.gif" alt="点击访问" width="20" height="20" border="0"></a></div></td>
<td nowrap>
<div align="center"> <% = SysClassCName %>
</div></td>
<td nowrap>
<div align="center"><span class="SpanStyle" title="修改属性" onClick="window.location='SitemodifyOne.asp?SiteID=<% = RsSite("Id") %>';">属性</span>
| <span class="SpanStyle" title="修改属性向导" onClick="window.location='Sitemodify.asp?SiteID=<% = RsSite("Id") %>';">向导</span>
| <span class="SpanStyle" title="删除" onClick="if (confirm('确定要删除吗?')==true) window.location='?action=Del&Id=<% = RsSite("Id") %>';">
删除</span> | <span class="SpanStyle" title="复制站点" onClick="window.location='Site.asp?vs=Copy&SiteID=<% = RsSite("Id") %>';">复制</span></div></td>
<td nowrap>
<div align="center">
<% if IsCollect = true then %>
<div align="center"><a href="Collect.asp?SiteID=<% = RsSite("Id") %>"><img src="Images/collect.gif" width="20" height="20" border="0"></a></div>
<% else %>
<div align="center"><img src="Images/uncollect.gif" width="20" height="20" border="0"></div>
<% end if %>
</div></td>
</tr>
<%
RsSite.MoveNext
next
%>
<tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#EFEFEF'" onMouseOut="this.style.backgroundColor=''">
<td height="26" colspan="7"><table width="100%" border="0" cellpadding="5" cellspacing="0" background="images/Collect_bg.gif">
<tr>
<td width="17%" height="30">
<div align="left"><a href="?Action=Addsite"><strong><font color="#FF0000">增加采集站点</font></strong></a></div></td>
<td width="83%" height="30">
<div align="right">
<%
Response.Write" 共<b>"& Select_PageCount & "</b>页<b>" & Select_Count & "</b>条记录,每页<b>" & RsSite.pagesize & "</b>条,本页是第<b>"& StrPage &"</b>页"
if Int(StrPage) > 1 then
Response.Write" <a href=?Page=1>首页</a> "
Response.Write" <a href=?Page=" & Cstr(cint(StrPage)-1) & ">上页</a> "
end if
if Int(StrPage) < Select_PageCount then
Response.Write" <a href=?Page=" & Cstr(Cint(StrPage)+1) & ">下页</a>"
Response.Write" <a href=?Page=" & Select_PageCount & ">末页</a> "
end if
Response.Write"<br>"
RsSite.close
Set RsSite = Nothing
%>
</div></td>
</tr>
</table></td>
</tr>
</table>
<br>
<font color="#FF0000">注意:增加采集站点后,请设置采集的新闻列表匹配规则、新闻浏览页面的采集匹配规则,否则将不能进行采集。</font>
<%end sub%>
<%
Sub Add()
Dim ClassList
Set Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Source = "Select * from [board] order by boardid desc"
Rs.Open Rs.Source,Conn,1,3
do while Not Rs.Eof
ClassList = ClassList & "<option value=" & Rs("boardID") & "" & ">" & Rs("boardName") & "</option><br>"
Rs.MoveNext
loop
Rs.Close
Set Rs = Nothing
%>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<form name="form1" method="post" action="">
<tr bgcolor="#FFFFFF">
<td height="30" colspan="4" background="images/Collect_bg.gif"><strong><font color="#FF0000">增加采集站点</font></strong></td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="19%"> <div align="right">
<input name="vs" type="hidden" id="vs2" value="add">
采集站点名称</div></td>
<td width="31%"> <input name="SiteName" style="width:100%;" type="text" id="SiteName2"></td>
<td width="15%"> <div align="right">采集站点分类</div></td>
<td width="35%"> <input name="SiteClass" style="width:100%;" type="text" id="SiteClass"></td>
</tr>
<tr bgcolor="#F3F3F3">
<td> <div align="right">采集站地址</div></td>
<td><input name="SiteUrl" style="width:100%;" type="text" id="SiteUrl" value="http://"></td>
<td> <div align="right">目标栏目</div></td>
<td> <select name="SysClass" style="width:100%;" id="SysClass">
<% =ClassList %>
</select></td>
</tr>
<tr bgcolor="#F3F3F3">
<td bgcolor="#F3F3F3"><div align="right">采集对象页</div></td>
<td colspan="3" bgcolor="#F3F3F3"><input style="width:100%;" name="objURL" type="text" id="objURL" value="http://"></td>
</tr>
<tr bgcolor="#F3F3F3">
<td bgcolor="#F3F3F3"><div align="right">新闻模板</div></td>
<td colspan="3" bgcolor="#F3F3F3"><input name="demoid" type="text" id="demoid" style="width:20%;">
新闻采用的模板,打开数据库查看demo表的demoid,如<span class="style1"> 122 </span></td>
</tr>
<tr bgcolor="#F3F3F3">
<td bgcolor="#F3F3F3"><div align="right">是否自动审核</div></td>
<td colspan="3" bgcolor="#F3F3F3"><input name="SysTemplet" type="text" id="SysTemplet" style="width:20%;">
<span class="style1">参数</span>:1 自动审核 0 手动审核 默认为0 <div align="right"></div></td>
</tr>
<tr bgcolor="#F3F3F3">
<td height="50" colspan="4"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"> <div align="center">
<input type="submit" name="Submit" value=" 增 加 ">
</div></td>
<td><div align="center">
<input type="reset" name="Submit2" value=" 重 填 ">
</div></td>
</tr>
</table></td>
</tr>
</form>
</table>
<% End Sub %>
</body>
</html>
<%
Set Conn = Nothing
Set CollectConn = Nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -