<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
Dim SqlItem,RsItem,Rs,Sql
Dim Action,FoundErr,ErrMsg
Dim ItemID,ItemName,WebName,ChannelID,ClassID,SpecialID,ListStr,ListPaingType,ListPaingStr2,ListPaingID1,ListPaingID2,ListPaingStr3,Flag,ItemCollecDate
Dim ListUrl
Dim CurrentPage,AllPage,iItem,ItemNum
Const MaxPerPage=20

Call Main()
'关闭数据库链接
Call CloseConn()
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="../css/Admin_Style.css">
<style type="text/css">
.ButtonList {
	BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #ffffff 2px solid; BORDER-LEFT: #ffffff 2px solid; CURSOR: default; BORDER-BOTTOM: #999999 2px solid; BACKGROUND-COLOR: #e6e6e6
}
</style>
<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-6;i++){
            var e = thisform.elements[i];
            if (e.Name !="chkAll"&&e.disabled!=true)
                e.checked = thisform.chkAll.checked;
        }
    }
</script>
</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="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href=Admin_ItemStart.asp>管理首页</a> | <a href="Admin_ItemAddNew.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 class="border" border="0" cellspacing="1" width="100%" cellpadding="0">
<form name="myform" method="POST" action="Admin_ItemCollection.asp">
        <TR>
          <TD class=ButtonList width="6%" height=22 align=center>
            选择</DIV></TD>
          <TD class=ButtonList width="17%" height=22  align=center>
            项目名称</DIV></TD>
          <TD class=ButtonList width="15%" height=22  align=center>
            采集来源</DIV></TD>
          <TD class=ButtonList width="20%" height=22  align=center>
            所属频道</TD>
            <TD class=ButtonList width="22%" height=22  align=center>
            所属栏目</TD>
            <TD width="20%" height=22  align=center class=ButtonList>
            上次采集</TD>
           </TR>
<%
If Request("page")<>"" then
    CurrentPage=Cint(Request("Page"))
Else
    CurrentPage=1
End if      
set RsItem=server.createobject("adodb.recordset")         
SqlItem="select * from Item where Flag=True order by ItemID 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
           ChannelID=RsItem("ChannelID")
      If ChannelID="" Then
         ChannelID=1
      End If
      ClassID=RsItem("ClassID")
      SpecialID=RsItem("SpecialID")
      If ClassID="" Then
         ClassID=0
      End If             
      If SpecialID="" Then
         SpecialID=0
      End If          
      ItemID=RsItem("ItemID")
      ItemName=RsItem("ItemName")
      WebName=RsItem("WebName")
            ListPaingType=RsItem("ListPaingType")
            If  ListPaingType=0  Or ListPaingType=1  Then
            ListUrl=RsItem("ListStr")
      ElseIf  ListPaingType=2  Then
            ListUrl=Replace(RsItem("ListPaingStr2"),"{$ID}",CStr(RsItem("ListPaingID1")))
      ElseIf  ListPaingType=3  Then
            If  Instr(RsItem("ListPaingStr3"),"|")>0  Then
            ListUrl=Left(RsItem("ListPaingStr3"),Instr(RsItem("ListPaingStr3"),"|")-1)
         Else
               ListUrl=RsItem("ListPaingStr3")
         End  If
      Else
            ListUrl="异常"
      End  If
   %>
        <TR class="tdbg">
          <TD class="tdbg" style="WIDTH: 6%" align=center>
            <input type="checkbox" name="ItemID" value="<%=ItemID%>" onClick="unselectall(this.form)">
          </TD>
          <TD class="tdbg" align="center"><%=ItemName%>
          </TD>
          <TD class="tdbg"  align="center"><a href="<%=ListUrl%>" title="点击访问" target=_blank><%=WebName%></a>
          </TD>
          <TD class="tdbg" align="center"><%
if ChannelID=1 then
response.write"商业资讯"
elseif ChannelID=2 then
response.write"展会资讯"
else
response.write"未知"
end if
%>
          </TD>
          <TD class="tdbg" align="center"><%
if ChannelID=1 then
set rs5=server.CreateObject("adodb.recordset")
sql5="select typeid,type from Websen_newstype where typeid="&ClassID
rs5.open sql5,conn,1,1
if not rs5.eof then
response.write"商业资讯 >> "&rs5("type")&""
end if
elseif ChannelID=2 then
set rs51=server.CreateObject("adodb.recordset")
sql51="select id,type from Websen_expoinfotype where id="&ClassID
rs51.open sql51,conn,1,1
if not rs51.eof then 
response.write"展会资讯 >> "&rs51("type")&""
end if
else
response.write"未知"
end if
%>
          </TD>
          <TD class="tdbg" align="center">
          <%
           set rs=connItem.execute("select Top 1 CollecDate From  Websen_histroly Where ItemID=" & ItemID & " Order by HistrolyID Desc")
           If not rs.eof Then
              ItemCollecDate=rs("CollecDate")
           else
              ItemCollecDate=""
           end if
           Set rs=nothing
           if ItemCollecDate<>"" then
              Response.Write ItemCollecDate
           Else
              Response.Write "尚无记录"
           End If
          %>
          </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="Start">
        &nbsp;<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox" >全选
      </td>
    </tr>
    <tr class="tdbg"> 
      <td colspan=9 height="30">  
        &nbsp;&nbsp;&nbsp;采集模式：<input style="display:none" name="CollecType" type="radio" id="CollecType" value="1"  onClick="javascript:document.myform.Content_View.checked=false"> &nbsp;&nbsp;
        <input name="CollecType" type="radio" id="CollecType" value="0" onClick="javascript:document.myform.Content_View.checked=true" checked>稳定模式&nbsp;&nbsp;
        <input name="CollecType" type="radio" id="CollecType" value="2" disabled>筛选模式&nbsp;&nbsp;
        <input name="CollecTest" type="checkbox" id="CollecTest" value="yes" onClick="javascript:document.myform.Content_View.checked=true">采集测试&nbsp;&nbsp;<input name="Content_View" type="checkbox" id="Content_View" value="yes">正文预览&nbsp;&nbsp;<input type="submit" value="开始采集" name="StartMe" style="cursor: hand;background-color: #cccccc;">&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 ShowPage("Admin_ItemStart.asp",ItemNum,MaxPerPage,True,True," 个项目")
%>

      </td>
    </tr>
</table>
<!--#include file="Admin_ItemFoot.asp"-->
</body>
</html>
<%end sub%>