<%@language=vbscript codepage=936 %>
<%
'|-----------------------------------------------------------------------|
'|---------飞越软件信息采集器v1.0 for 动易网站管理系统2005/2006 ---------|
'|-------------------------- 作者:科技创造自由 --------------------------|
'|------------------ 飞越快乐家园  http://www.fy66.net/ -----------------|
'|--动易版主Top在本插件的编写过程中给予了大力支持,特此表示诚恳的感谢!----|
'|------ 本插件多处代码参考了SNA新闻采集系统for动易4.03,特此声明! -------|
'|----- 转载请保留版权信息,手下留情,留下的是对别人的尊重,谢谢! ----------|
'|-----------------------------------------------------------------------|
option explicit
response.buffer=true	
Const PurviewLevel=1
%>
<!--#include file="../Conn.asp"-->
<!--#include file="../inc/Function.asp"-->
<!--#include file="Admin_ChkPurview.asp"-->
<!--#include file="Admin_ST_Conn.asp"-->
<!--#include file="Admin_ST_Function.asp"-->
<%
Dim SqlItem,RsItem,SqlF,RsF,ItemName,sType
Dim stAction,stFoundErr,stErrMsg
Dim FilterID,ItemID,FilterName,FilterObject,FilterType,MaxPerPage
stAction=Trim(Request("Action"))
sType=Trim(Request("Type"))
MaxPerPage=Clng(Trim(Request("MaxPerPage")))
if MaxPerPage="" then
	MaxPerPage=20
End if
dim CurrentPage,allPage,iItem
if request("page")<>"" then
    currentPage=cint(request("page"))
else
    currentPage=1
end if

If stAction="Del" Then
	Call Del()
Elseif sType="Setflag" then
	Call SetFlag(Trim(Request("FilterID")))
End If
If stFoundErr=True Then
   Call WriteErrMsg()
Else
   Call Main()
End If
iItem=0

'关闭数据库链接
Call CloseConn()
Call CloseConn_User()
Call CloseConnItem()
%>
<%Sub Main%>
<html>
<head>
<title>软件采集系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="Admin_Style.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;
    }
}
function ConfirmDel(thisform)
{
	if(thisform.Action.value=="Del")
	{
		if(confirm("确定要删除选中的记录吗？"))
		    return true;
		else
			return false;
	}
}
function showsetting(thisform)
{
	for (var j=0;j<6;j++)
	{
		var tab = eval("document.all.settable"+j);
		if(thisform.ADType.selectedIndex==j)
			tab.style.display = "";
		else
			tab.style.display = "none";
	}
	if(thisform.ADType.selectedIndex==6)
	{
		nocodead.style.display = "none";
		iscodead.style.display = "";
	}
	else
	{
		nocodead.style.display = "";
		iscodead.style.display = "none";
	}
}
</script>
<style type="text/css">
<!--
.style1 {color: #555555}
-->
</style>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr class='topbg'> 
    <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="70" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="Admin_ST_Filters.asp">管理首页</a> | <a href="Admin_ST_FilterAdd.asp">添加新项目</a></td>
  </tr>
</table><br>        
<%                             
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 

%>
  <table class="border" border="0" cellspacing="1" width="100%" cellpadding="0">         
   <form name="form1" method="POST" ACTION="Admin_ST_Filters.asp?action=Del" onsubmit="return confirm('确定要删除选定的项目吗？');">         
   <tr class="title" style="padding: 0px 2px;">
     <td width="30" height="22" align="center"><strong>选择</strong></td>
     <td width="250" height="22" align="center"><strong>所属项目</strong></td>
     <td width="120" align="center"><strong>过滤名称</strong></td>
     <td width="80" align="center"><strong>过滤类型</strong></td>
     <td width="80" height="22" align="center"><strong>过滤属性</strong></td>
     <td width="40" align="center"><strong>状态</strong></td>
     <td width="90" height="22" align="center"><strong>操作</strong></td>
   </tr>        
<%
   RsItem.pagesize=MaxPerPage
   allpage=RsItem.pagecount
   RsItem.movefirst
   RsItem.absolutepage=currentPage            
   Do While Not RsItem.Eof
           
%>         
    <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'" style="padding: 0px 2px;">          
      <td align="center">          
        <input type="checkbox" value=<%=RsItem("FilterID")%> name="FilterID" onclick="unselectall(this.form)">         
      </td>         
      <td align="center"><%Call ShowItemName(Clng(RsItem("ItemID")))%></td>         
      <td align="center">
      <%=RsItem("FilterName")%>
      </td>
      <td align="center">          
      <%
      If RsItem("FilterObject")=1 Then
         Response.Write "标题过滤" 
      ElseIf RsItem("FilterObject")=2 Then 
         Response.Write "正文过滤" 
      Else
         Response.Write "请选择！" 
      End If
      %>              
      </td>  
            <td align="center">          
      <%
      If RsItem("FilterType")=1 Then
         Response.Write "简单替换" 
      ElseIf RsItem("FilterType")=2 Then 
         Response.Write "高级过滤" 
      Else
         Response.Write "请选择！" 
      End If
      %>              
      </td>        
      <td align="center">      <%
      If RsItem("Flag")=True Then
         Response.Write "<b>√</b>" 
      Else 
         Response.Write "<font color='red'><b>×</b></font>" 
      End If
      %></td>       
      <td align="center"><a href="Admin_ST_Filters.asp?Type=Setflag&FilterID=<%=RsItem("FilterID")%>"><%
      If RsItem("Flag")=True Then
         Response.Write "禁用" 
      Else 
         Response.Write "启用" 
      End If
      %></a>&nbsp;<a href="Admin_ST_FilterAdd.asp?Type=modify&FilterID=<%=RsItem("FilterID")%>">修改</a>&nbsp;<a href="Admin_ST_Filters.asp?Action=Del&FilterID=<%=RsItem("FilterID")%>" onclick='return confirm("确定要删除此项目吗？");'>删除</a></td>         
    </tr>         
<%         
iItem=iItem+1
If iItem >= MaxPerPage Then Exit Do
   RsItem.Movenext         
   Loop         
%>         

    <tr class="tdbg">          
      <td colspan=7 height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">选中所有项目           　　  
将选定的项目：          
        <input type="submit" value=" 删&nbsp;&nbsp;除 " name="submit" onClick='return ConfirmDel(this.form);'>&nbsp;&nbsp;  
      </td>         
    </tr>  
</form>         <tr class="tdbg">          
      <td colspan=7 height="30" align="center">          
               
        &nbsp;&nbsp;&nbsp;&nbsp;共
       

 <b><%=RsItem.recordcount%></b> 个过滤记录&nbsp;&nbsp;<a href="Admin_ST_Filters.asp">首页</a>&nbsp;<%if currentPage>1 then %><a href="Admin_ST_Filters.asp?MaxPerPage=<%=MaxPerPage%>&page=<%=currentPage-1%>">上一页</a><%else%>上一页<%end if%>&nbsp;<%if currentPage<allpage then%><a href="Admin_ST_Filters.asp?MaxPerPage=<%=MaxPerPage%>&page=<%=currentPage+1%>">下一页</a><%else%>下一页<%end if%> <a href="Admin_ST_Filters.asp?MaxPerPage=<%=MaxPerPage%>&page=<%=allPage%>">尾页</a>&nbsp;&nbsp;页次：<b><font color=red><%=currentPage%></font>/<%=allpage%></b> &nbsp;&nbsp;<input type='text' name='MaxPerPage' size='3' maxlength='4' value='<%=MaxPerPage%>' onKeyPress="if (event.keyCode==13) window.location='Admin_ST_Filters.asp?Admin_ST_Filters.asp?page=<%=currentPage%>&MaxPerPage='+this.value;"> 个过滤项目记录/页                                                 
转到第 <select onchange="window.location='Admin_ST_Filters.asp?MaxPerPage=<%=MaxPerPage%>&page='+this.value" name="gopage">                                                        
<%
For iItem=1 to allpage%>
<option <%if iItem=currentPage then%>selected<%end if%> value="<%=iItem%>"><%=iItem%></option>
<%next%> </select>      
      </td>         
    </tr>                
        
</table>
<%else%>
  <table class="border" border="0" cellspacing="1" width="100%" cellpadding="0">
          <tr class="tdbg"> 
            <td align="center">无任何记录!</td>
          </tr>
  </table>
<%end if%>         
<%         
RsItem.Close         
Set RsItem=nothing           
%>  
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="border" >
  <tr>
   <td colspan='2' height="20" align="center"><a href='http://www.fy66.net/' target=_blank style='color:#449AE8'>插件作者:飞越快乐家园站长-科技创造自由</a></td>
  </tr>
</table>        
</body>         
</html>
<%End Sub%>

<%Sub Del
FilterID=Trim(Request("FilterID"))
If FilterID="" Then
   stFoundErr=True
   stErrMsg=stErrMsg & "<br><li>请选择要删除的项目！</li>"
Else
      If Instr(FilterID,",")>0 Then
         FilterID=Replace(FilterID," ","")   
         ConnItem.Execute("Delete From [Filters] Where FilterID In(" & FilterID & ")")
      Else
         ConnItem.Execute("Delete From [Filters] Where FilterID=" & FilterID)
      End If
End If
End Sub

Sub SetFlag(FilterID)
Dim SqlItem,RsItem
If FilterID="" Then
   stFoundErr=True
   stErrMsg=stErrMsg & "<br><li>请选择要禁止/启用的项目！</li>"
Else
	SqlItem="Select * from Filters Where FilterID=" & FilterID
	Set RsItem=server.CreateObject("adodb.recordset")
	RsItem.Open SqlItem,ConnItem,2,3
	if RsItem("Flag")=True Then
		RsItem("Flag")=False
	Else
		RsItem("Flag")=True
	End if
	RsItem.UpDate
	RsItem.Close
	Set RsItem=Nothing
End If
End Sub
%>