<!--#include file="Item_Conn.asp"-->
<!--#include file="Item_Function.asp"-->
<html>
<head>
<title>采集系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../Skins/Admin_Style.Css" rel="stylesheet" type="text/css">

<script language=javascript>
    function unselectall(thisform){
        if(thisform.chkAll.checked){
            thisform.chkAll.checked = thisform.chkAll.checked&0;
        }   
    }
    function CheckAll(thisform){
        for (var i=0;i<thisform.elements.length;i++){
            var e = thisform.elements[i];
            if (e.Name !="chkAll"&&e.disabled!=true)
                e.checked = thisform.chkAll.checked;
        }
    }
</script>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<%
Dim SqlItem,RsItem
Dim Action
Dim FilterID,ItemID,FilterName,FilterObject,FilterType,Flag,PublicTf,FlagName
Dim AllPage,iItem,ItemNum
Const MaxPerPage=20
Action=Request("Action")
If Action="SetFlag" Then
   Call SetFlag()
End If
If FoundErr=True Then
   Call Admin_ShowErr(ErrMsg)
Else
   Call Main()
End If
'关闭数据库链接
Call CloseAllObj()
Call CloseConnItem()
Sub Main%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title">
    <td height="22" colspan="2" align="center" ><strong>采 集 系 统 过 滤 管 理</strong></td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href=Item_Filters.asp>管理首页</a> | <a href="Item_FilterAdd.asp">添加新过滤</a></td>
  </tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><b>过&nbsp;滤&nbsp;管&nbsp;理</b></div></td>
    </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<form name="myform" method="POST" action="Item_Filters.asp">
        <TBODY>
        <tr class="title"> 
          <TD  width="5%" height=22>
            <DIV align=center>选择</DIV></TD>
          <TD  width="17%" height=22>
            <DIV align=center>过滤名称</DIV></TD>
          <TD  width="15%" height=22>
            <DIV align=center>所属项目</DIV></TD>
          <TD  width="12%" height=22>
            <DIV align=center>过滤对象</DIV></TD>
          <TD  width="12%" height=22>
            <DIV align=center>过滤类型</div></TD>
          <TD  width="15%" height=22>
            <DIV align=center>状态</div></TD>
          <TD  height=22>
            <DIV align=center>操作</div></TD>
           </TR>
<%
If Request("page")<>"" then
    CurrentPage=Cint(Request("Page"))
Else
    CurrentPage=1
End if      
set RsItem=server.createobject("adodb.recordset")         
SqlItem="select * from Filters order by FilterID DESC"         
RsItem.open SqlItem,ConnItem,1,1
If (Not RsItem.Eof) and (Not RsItem.Bof) Then

 RsItem.PageSize=MaxPerPage
 Allpage=RsItem.PageCount
 If CurrentPage>Allpage Then CurrentPage=1
 ItemNum=RsItem.RecordCount
 RsItem.MoveFirst
 RsItem.AbsolutePage=CurrentPage
 iItem=0
   Do while Not RsItem.Eof
      FilterID=RsItem("FilterID")
      ItemID=RsItem("ItemID")
      FilterName=RsItem("FilterName")
      FilterObject=RsItem("FilterObject")
      FilterType=RsItem("FilterType")
      Flag=RsItem("Flag")
      PublicTf=RsItem("PublicTf")
%>
        <TR class="tdbg">
          <TD class="tdbg" style="WIDTH: 6%" align=center>
            <input type="checkbox" name="FilterID" value="<%=FilterID%>" onclick="unselectall(this.form)">
          </TD>
          <TD class="tdbg" align="center"><%=FilterName%>
          </TD>
          <TD class="tdbg" align="center"><%Call Admin_ShowItem_Name(ItemID)%>
          </TD>
          <TD class="tdbg"  align="center">
          <%
          If FilterObject=1 Then
             Response.Write "标题过滤" 
          ElseIf FilterObject=2 Then 
             Response.Write "正文过滤" 
          Else
             Response.Write "<font color=red>没有选择！</font>" 
          End If
          %>           
          </TD>
          <TD class="tdbg" align="center">
          <%
          If FilterType=1 Then
             Response.Write "简单替换"
          ElseIf FilterType=2 Then
             Response.Write "高级过滤"
          Else
             Response.Write "<font color=red>没有选择！</font>"
          End If
          %>
          </TD>
          <TD class="tdbg" align="center">
          <%If Flag=True Then
               Response.Write "启用"
            Else
               Response.Write "<font color=red>禁用</font>"
            End If
          %>&nbsp;
          <%If PublicTf=False Then
               Response.Write "私有"
            Else
               Response.Write "<font color=red>公有</font>"
            End If
          %>
          </TD>
          <TD class="tdbg" align="center">
          <%Response.Write "<a href='Item_Filters.asp?Action=SetFlag&FlagName=Passed&FilterID=" & FilterID & "'>"
            If Flag=True Then
               Response.Write "禁用"
            Else
               Response.Write "启用"
            End If
            Response.Write "</a>"
           %>&nbsp;
          <%Response.Write "<a href='Item_Filters.asp?Action=SetFlag&FlagName=Public&FilterID=" & FilterID & "'>"
            If PublicTf=False Then
               Response.Write "公有"
            Else
               Response.Write "私有"
            End If
            Response.Write "</a>"
           %>&nbsp;
             <a href="Item_FilterModify.asp?FilterID=<%=RsItem("FilterID")%>">修改</a>
             &nbsp;<a href="Item_Filters.asp?Action=SetFlag&FlagName=Del&FilterID=<%=RsItem("FilterID")%>" onclick='return confirm("确定要删除此记录吗？");'>删除</a>
          </td>
          </TD>
        </TR>
<%    iItem=iItem+1
      If iItem>=MaxPerPage Then Exit Do
      RsItem.MoveNext
   Loop 
%>
    <tr class="tdbg"> 
      <td colspan=9 height="30">  
        <input name="Action" type="hidden"  value="SetFlag">
        &nbsp;<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox" >全选
      </td>
    </tr>
    <tr class="tdbg"> 
      <td colspan=9 height="30" align="center">  
        <input type="submit" value="删&nbsp;&nbsp;除" name="FlagName" onclick='return confirm("确定要执行删除操作吗？该操作不可恢复！");'>&nbsp;&nbsp;
        <input type="submit" value="启&nbsp;&nbsp;用" name="FlagName" onclick='return confirm("确定要启用所选择的项目吗？");'>&nbsp;&nbsp;
        <input type="submit" value="禁&nbsp;&nbsp;用" name="FlagName" onclick='return confirm("确定要禁用所选择的项目吗？");'>&nbsp;&nbsp;
        <input type="submit" value="公&nbsp;&nbsp;有" name="FlagName" onclick='return confirm("确定要将所选择的项目设为公有吗？");'>&nbsp;&nbsp;
        <input type="submit" value="私&nbsp;&nbsp;有" name="FlagName" onclick='return confirm("确定要将所选择的项目设为私有吗？");'>&nbsp;&nbsp;
      </td>
    </tr>
<%Else%>
<tr class="tdbg">
        <td colspan='9' class="tdbg" align="center"><br>系统中暂无过滤记录！</td>
</tr> 
<%End If
 RsItem.Close
Set RsItem=Nothing
%>
</form>  
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="tdbg">
<%
Response.Write Cl.ShowPage("Item_Filters.asp",ItemNum,MaxPerPage,"个","记录")
%>

      </td>
    </tr>
</table>
<%end sub

Sub SetFlag
   FilterID=Trim(Request("FilterID"))
   FlagName=Trim(Request("FlagName"))
   If FilterID<>"" Then
      FilterID=Replace(FilterID," ","")
   Else
      FoundErr=True
      ErrMsg=ErrMsg & "<br><li>请选择要执行操作的记录！</li>"
   End if
   If FoundErr<>True Then
      Select Case FlagName
      Case "Del","删&nbsp;&nbsp;除"
         SqlItem="delete * from [Filters] Where FilterID In(" & FilterID & ")"
      Case "Public"
         SqlItem="Update [Filters] set PublicTf=Not PublicTf Where FilterID In(" & FilterID & ")"
      Case "公&nbsp;&nbsp;有"
         SqlItem="Update [Filters] set PublicTf=True Where FilterID In(" & FilterID & ")"
      Case "私&nbsp;&nbsp;有"
         SqlItem="Update [Filters] set PublicTf=False Where FilterID In(" & FilterID & ")"
      Case "Passed"
         SqlItem="Update [Filters] set Flag=Not Flag Where FilterID In(" & FilterID & ")"
      Case "启&nbsp;&nbsp;用"
         SqlItem="Update [Filters] set Flag=True Where FilterID In(" & FilterID & ")"
      Case "禁&nbsp;&nbsp;用"
         SqlItem="Update [Filters] set Flag=False Where FilterID In(" & FilterID & ")"
      End Select
      ConnItem.Execute(SqlItem)
   End If
End  Sub
%>
</body>
</html>