Rule.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:10k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <!--#include file="../../FS_Inc/Const.asp" -->
  2. <!--#include file="../../FS_Inc/Function.asp"-->
  3. <!--#include file="inc/Function.asp"-->
  4. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  5. <%
  6. Dim Conn,CollectConn
  7. MF_Default_Conn
  8. MF_Collect_Conn
  9. MF_Session_TF
  10. if Request("action") = "Del" then
  11. if Request("id") <> "" then CollectConn.Execute("Delete from FS_Rule where id in (" & Replace(Request("id"),"***",",") & ") and SiteID in(select id from fs_site)")
  12. Response.Redirect("Rule.asp")
  13. Response.End
  14. end if
  15. if Request.Form("Result") = "add" then
  16. if Request.Form("SiteId")="" then 
  17. Response.Write("<script>alert('请选择规则应用站点');history.back();</script>")
  18. Response.End
  19. end if
  20. if Request.Form("RuleName")="" then 
  21. Response.Write("<script>alert('请填写规则名称');history.back();</script>")
  22. Response.End
  23. end if
  24.     Dim Sql,RsEditObj
  25. Set RsEditObj = Server.CreateObject ("ADODB.RecordSet")
  26. Sql = "Select * from FS_Rule"
  27. RsEditObj.Open Sql,CollectConn,1,3
  28. RsEditObj.AddNew
  29. RsEditObj("RuleName") = Request.Form("RuleName")
  30. RsEditObj("SiteId") = Request.Form("SiteId")
  31. Dim KeywordSetting
  32. If InStr(Request.Form("KeywordSetting"),"[过滤字符串]")<>0 then
  33. KeywordSetting = Split(Request.Form("KeywordSetting"),"[过滤字符串]",-1,1)
  34. RsEditObj("HeadSeting") = KeywordSetting(0)
  35. RsEditObj("FootSeting") = KeywordSetting(1)
  36. Else
  37. RsEditObj("HeadSeting") = ""
  38. RsEditObj("FootSeting") = ""
  39. End If
  40. RsEditObj("ReContent") = Request.Form("ReContent")
  41. RsEditObj("AddDate") = Now()
  42. RsEditObj.update
  43. RsEditObj.close
  44. Set RsEditObj = Nothing
  45. Response.Redirect("Rule.asp")
  46. Response.End
  47. end if
  48. %>
  49. <html>
  50. <head>
  51. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  52. <title>修改新闻</title>
  53. </head>
  54. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  55. <script language="JavaScript" src="js/PublicJS.js"></script>
  56. <body leftmargin="2" topmargin="2" onselectstart="return false;">
  57. <%
  58. if Request("action") = "AddRule" then
  59. Call Add()
  60. else
  61. Call Main()
  62. end if
  63. Sub Main()
  64. %>
  65. <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  66.   <tr class="hback"> 
  67.     <td height="26" colspan="5" valign="middle">
  68.       <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
  69.         <tr>
  70.           <td width="35" align="center" alt="添加" style="cursor:hand;" onClick="location='?Action=AddRule';" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">新建</td>
  71. <td width=2 class="Gray">|</td>
  72.   <td width="35" align="center" alt="后退" style="cursor:hand;" onClick="history.back();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">后退</td>
  73.           <td>&nbsp;</td>
  74.         </tr>
  75.       </table>
  76.     </td>
  77.   </tr>
  78. </table>
  79. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  80.   <tr class="xingmu"> 
  81.     <td width="19%" height="26" class="xingmu"> <div align="center">规则名称</div></td>
  82.     <td width="20%" height="20" class="xingmu"> <div align="center">应用站点</div></td>
  83.     <td width="20%" class="xingmu"><div align="center">时间</div></td>
  84.     <td width="20%" height="20" class="xingmu"> <div align="center">操作</div></td>
  85.   </tr>
  86.   <%
  87. Dim RsSite,Sitesql,CheckInfo,StrPage,Select_Count,Select_PageCount,i,ApplyStation,RsTempObj
  88. Set RsSite = Server.CreateObject ("ADODB.RecordSet")
  89. SiteSql = "select * from FS_Rule where SiteID in(select id from fs_site) order by id desc"
  90. RsSite.Open SiteSql,CollectConn,1,1
  91. if Not RsSite.Eof then
  92. StrPage = Request.QueryString("Page")
  93. if StrPage <= 1 or StrPage = "" then 
  94. StrPage = 1
  95. else 
  96. StrPage = CInt(StrPage)
  97. end if
  98. RsSite.PageSize = 12
  99. Select_Count = RsSite.RecordCount
  100. Select_PageCount = RsSite.PageCount
  101. if StrPage > Select_PageCount then StrPage = Select_PageCount
  102. RsSite.AbsolutePage = CInt(StrPage)
  103. for i=1 to RsSite.PageSize
  104. if RsSite.Eof then Exit For
  105. if Not ISNull(RsSite("Siteid")) then
  106. Sql = "Select ID,SiteName from FS_Site where ID=" & RsSite("Siteid")
  107. Set RsTempObj = CollectConn.Execute(Sql)
  108. if Not RsTempObj.Eof then
  109. ApplyStation = RsTempObj("SiteName")
  110. else
  111. ApplyStation = "站点不存在"
  112. end if
  113. Set RsTempObj = Nothing
  114. else
  115. ApplyStation = "站点不存在"
  116. end if
  117. %>
  118.   <tr class="hback"> 
  119.     <td><table border="0" cellspacing="0" cellpadding="0">
  120.         <tr> 
  121.           <td><img src="images/folder.gif" width="16" height="16"></td>
  122.           <td><span class="TempletItem" RuleID="<% = RsSite("ID") %>"> 
  123.             <% = RsSite("RuleName") %>
  124.             </span></td>
  125.         </tr>
  126.       </table></td>
  127.     <td> <div align="center"> 
  128.         <% = ApplyStation %>
  129.       </div></td>
  130.     <td> <div align="center">
  131.         <% = RsSite("AddDate") %>
  132.       </div></td>
  133.     <td> <div align="center"><span style="cursor:hand;" onClick="if (confirm('确定要修改吗?')){location='Rulemodify.asp?RuleId=<% = RsSite("ID") %>';}">属性</span>&nbsp;&nbsp;<span style="cursor:hand;" onClick="if (confirm('确定要删除吗?')){location='?action=Del&Id=<% = RsSite("ID") %>';}">删除</span></div></td>
  134.   </tr>
  135.   <%
  136. RsSite.MoveNext
  137. next
  138.   %>
  139.   <tr class="hback"> 
  140.     <td colspan="4"> <table  width="100%" border="0" cellpadding="5" cellspacing="0">
  141.         <tr> 
  142.           <td height="30"> <div align="right"> 
  143.               <%
  144. Response.Write"&nbsp;共<b>" & Select_PageCount & "</b>页<b>" & Select_Count & "</b>条记录,每页<b>" & RsSite.pagesize & "</b>条,本页是第<b>" & StrPage &"</b>页"
  145. if Int(StrPage)>1 then
  146. Response.Write "&nbsp;<a href=?Page=1>第一页</a>&nbsp;"
  147. Response.Write "&nbsp;<a href=?Page=" & CStr(CInt(StrPage) - 1) & ">上一页</a>&nbsp;"
  148. end if
  149. if Int(StrPage) < Select_PageCount then
  150. Response.Write "&nbsp;<a href=?Page=" & CStr(CInt(StrPage) + 1 ) & ">下一页</a>"
  151. Response.Write "&nbsp;<a href=?Page="& Select_PageCount &">最后一页</a>&nbsp;"
  152. end if
  153. Response.Write"<br>"
  154. RsSite.close
  155. Set RsSite = Nothing
  156. %>
  157.             </div></td>
  158.         </tr>
  159.       </table></td>
  160.   </tr>
  161.   <% 
  162. end if
  163. %>
  164. </table>
  165. <%End Sub%>
  166. <%
  167. Sub Add()
  168. Dim SiteList,RsSiteObj
  169. Set RsSiteObj = CollectConn.Execute("Select ID,SiteName from FS_Site where 1=1 order by id desc")
  170. do while Not RsSiteObj.Eof
  171. SiteList = SiteList & "<option value=" & RsSiteObj("ID") & "" & ">" & RsSiteObj("SiteName") & "</option><br>"
  172. RsSiteObj.MoveNext
  173. loop
  174. Set RsSiteObj = Nothing
  175. %>
  176. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  177.   <form name="form1" method="post" action="" id="form1">
  178.     <tr class="hback"> 
  179.       <td height="25" colspan="5" valign="middle"> 
  180.         <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
  181.           <tr> 
  182.             <td width="35" align="center" alt="保存" style="cursor:hand;" onClick="document.form1.submit();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">保存</td>
  183. <td width=2 class="Gray">|</td>
  184.     <td width="35" align="center" alt="后退" style="cursor:hand;" onClick="history.back();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">后退</td>
  185.             <td>&nbsp; <input name="Result" type="hidden" id="Result" value="add"></td>
  186.           </tr>
  187.         </table></td>
  188.     </tr>
  189.     <tr class="hback"> 
  190.       <td width="100" height="34"> 
  191.         <div align="center">规则名称</div></td>
  192.       <td> 
  193.         <input style="width:100%;" name="RuleName" type="text" id="RuleName"> 
  194.         <div align="right"></div></td>
  195.     </tr>
  196.     <tr  class="hback"> 
  197.       <td height="34"> 
  198.         <div align="center">应用到</div></td>
  199.       <td> 
  200.         <select style="width:100%;" name="SiteId" id="select">
  201.           <% = SiteList %>
  202.         </select></td>
  203.     </tr>
  204.     <tr  class="hback"> 
  205.       <td height="110"> 
  206.         <div align="center">过滤字符串</div></td>
  207.       <td> &nbsp;&nbsp;输入区域: <span onClick="if(document.Form1.KeywordSetting.rows>2)document.Form1.KeywordSetting.rows-=1" style='cursor:hand'><b>缩小</b></span> 
  208.         <span onClick="document.Form1.KeywordSetting.rows+=1" style='cursor:hand'><b>扩大</b></span> 
  209.         &nbsp;&nbsp;可用标签:<font onClick="addTag('[过滤字符串]')" style="CURSOR: hand"><b>[过滤字符串]</b></font> 
  210.         &nbsp;&nbsp;&nbsp;<font onClick="addTag('[变量]')" style="CURSOR: hand"><b>[变量]</b></font><br>
  211.         <br>
  212.   <textarea name="KeywordSetting" onFocus="getActiveText(this)" onClick="getActiveText(this)"  onchange="getActiveText(this)" rows="5" id="textarea2" style="width:100%;"></textarea> 
  213.         <div align="right"></div></td>
  214.     </tr>
  215.     <tr class="hback"> 
  216.       <td> 
  217.         <div align="center">替换为</div></td>
  218.       <td> 
  219.         <textarea name="ReContent" rows="5" style="width:100%;"></textarea></td>
  220.     </tr>
  221.   </form>
  222. </table>
  223. <%End Sub%>
  224. </body>
  225. </html>
  226. <%
  227. Set CollectConn = Nothing
  228. Set Conn = Nothing
  229. %>
  230. <script language="JavaScript">
  231. currObj = "uuuu";
  232. function getActiveText(obj)
  233. {
  234. currObj = obj;
  235. }
  236. function addTag(code)
  237. {
  238. addText(code);
  239. }
  240. function addText(ibTag)
  241. {
  242. var isClose = false;
  243. var obj_ta = currObj;
  244. if (obj_ta.isTextEdit)
  245. {
  246. obj_ta.focus();
  247. var sel = document.selection;
  248. var rng = sel.createRange();
  249. rng.colapse;
  250. if((sel.type == "Text" || sel.type == "None") && rng != null)
  251. {
  252. rng.text = ibTag;
  253. }
  254. obj_ta.focus();
  255. return isClose;
  256. }
  257. else return false;
  258. }
  259. -->
  260. </script>