<% Option Explicit %>
<!--#include file="inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<%
'==============================================================================
'软件名称：风讯新闻采集系统V1.0
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
Dim DBC,CollectConn,Conn
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
'判断权限
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P1402") then Call ReturnError1()
'判断权限结束
Dim RuleID
RuleID = Request("RuleID")
if Request.Form("Result")="Edit" then
    Dim Sql,RsEditObj
	if RuleID <> "" then
		Set RsEditObj = Server.CreateObject ("ADODB.RecordSet")
		Sql = "Select * from Rule where id=" & RuleID
		RsEditObj.Open Sql,CollectConn,1,3
		if RsEditObj.Eof then
			Response.Write"<script>alert(""没有修改规则"");location.href=""javascript:history.back()"";</script>"
			Response.End
		end if
		RsEditObj("RuleName") = Request.Form("RuleName")
		RsEditObj("SiteId") = Request.Form("SiteId")
		RsEditObj("HeadSeting") = Request.Form("HeadSeting")
		RsEditObj("FootSeting") = Request.Form("FootSeting")
		RsEditObj("ReContent") = Request.Form("ReContent")
		RsEditObj.UpDate
		RsEditObj.Close
		Set RsEditObj = Nothing
	else
		Response.Write"<script>alert(""参数传递错误"");location.href=""javascript:history.back()"";</script>"
		Response.End
	end if
	Response.Redirect("Rule.asp")
	Response.End
end if

Dim RsRuleObj
if RuleID <> "" then
	Set RsRuleObj = Server.CreateObject ("ADODB.RecordSet")
	Sql = "Select * from Rule where id=" & RuleID
	RsRuleObj.Open Sql,CollectConn,1,3
	if RsRuleObj.Eof then
		Response.Write"<script>alert(""没有修改规则"");location.href=""javascript:history.back()"";</script>"
		Response.End
	end if
else
	Response.Write"<script>alert(""参数传递错误"");location.href=""javascript:history.back()"";</script>"
	Response.End
end if
	
Dim SiteList,RsSiteObj
Set RsSiteObj = Server.CreateObject("Adodb.RecordSet")
RsSiteObj.Source = "Select ID,SiteName from Site order by id desc"
RsSiteObj.open RsSiteObj.Source,CollectConn,1,3
do while Not RsSiteObj.Eof
	if RsRuleObj("SiteID") = RsSiteObj("ID") then
		SiteList = SiteList & "<option selected value=" & RsSiteObj("ID") & "" & ">" & RsSiteObj("SiteName") & "</option><br>"
	else
		SiteList = SiteList & "<option value=" & RsSiteObj("ID") & "" & ">" & RsSiteObj("SiteName") & "</option><br>"
	end if
	RsSiteObj.MoveNext	
loop
RsSiteObj.Close
Set RsSiteObj = Nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>自动新闻采集—站点设置</title>
</head>
<link href="Inc/Collect.css" rel="stylesheet">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body leftmargin="0" topmargin="0">
  
<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="10%"> <div align="right"> 规则名称</div></td>
      <td width="40%"> <input name="RuleName" style="width:100%;" type="text" id="RuleName" value="<% = RsRuleObj("RuleName") %>"> 
      </td>
      <td width="10%"> <div align="right">应用到</div></td>
      <td> <select name="SiteId" style="width:100%;" id="SiteId">
          <% =SiteList %>
        </select> </td>
    </tr>
    <tr bgcolor="#F3F3F3"> 
      <td><div align="right">开始标记</div></td>
      <td><textarea name="HeadSeting" style="width:100%;" cols="30" rows="5" id="textarea"><% = RsRuleObj("HeadSeting") %></textarea></td>
      <td><div align="right">结束标记</div></td>
      <td><textarea name="FootSeting" style="width:100%;" cols="30" rows="5" id="textarea2"><% = RsRuleObj("FootSeting") %></textarea></td>
    </tr>
    <tr bgcolor="#F3F3F3"> 
      <td bgcolor="#F3F3F3"><div align="right"> 
          <input name="Result" type="hidden" id="Result4" value="Edit">
          <input name="id" type="hidden" id="id2" value="<% = RuleID %>">
          替换为</div></td>
      <td colspan="3" bgcolor="#F3F3F3"><textarea style="width:100%;" name="ReContent" cols="30" rows="5" id="ReContent"><% = RsRuleObj("ReContent") %></textarea></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>
</body>
</html>
<%
Set CollectConn = Nothing
Set RsRuleObj = Nothing
%>