<%@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 Action,FoundErr,ErrMsg
Dim SqlItem,RsItem,Flag,Action2
Dim HistrolyID,NewsUrl,Result,ClassID,Title,HistrolyNewsID,ItemID,SoftID,NewsCollecDate,MaxPerPage
MaxPerPage=Clng(Trim(Request("MaxPerPage")))
if MaxPerPage="" then
	MaxPerPage=20
End if
Dim CurrentPage,allPage,HistrolyN
FoundErr=False

Action=Request("Action")
Action2=Request("Action2")

If Action="Del" Then
   Call Del()
End If
If FoundErr=True Then
   Call WriteErrMsg()
Else
   Call Main()
End If
'关闭数据库链接
Call CloseConn()
Call CloseConn_User()
Call CloseConnItem()
%>

<%Sub Main
If request("page")<>"" then
    currentPage=cint(request("page"))
Else
    currentPage=1
End if
HistrolyN=0
%>
<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_Histroly.asp">管理首页</a> | <a href="Admin_ST_Collectino.asp">添加新项目</a></td>
  </tr>
</table><br>        
<%                             
set RsItem=server.createobject("adodb.recordset")         
SqlItem="select * from HistrolyNews order by HistrolyNewsID 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_Histroly.asp" onsubmit="return confirm('确定要删除选定的记录吗？');">         
     <tr class="title" style="padding: 0px 2px;">
      <td width="30" height="22" align="center"><strong>选择</strong></td>        
      <td width="120" align="center"><strong>项目名称</strong></td>
      <td width="250" align="center"><strong>新闻标题</strong></td>
      <td width="100" height="22" align="center"><strong>所属频道</strong></td>
      <td width="100" height="22" align="center"><strong>所属栏目</strong></td>     
      <td width="60" align="center"><strong>采集页面</strong></td>        
      <td width="40" align="center"><strong>结    果</strong></td>
      <td width="40" height="22" align="center"><strong>操作</strong></td>
     </tr>      
<%
   RsItem.pagesize=MaxPerPage
   allpage=RsItem.pagecount
   RsItem.movefirst
   RsItem.absolutepage=currentPage       
   Do While Not RsItem.Eof 
      HistrolyNewsID=RsItem("HistrolyNewsID")
      HistrolyID=RsItem("HistrolyID")
      SoftID=RsItem("SoftID")
      Title=RsItem("Title")
      NewsCollecDate=RsItem("NewsCollecDate")
      NewsUrl=RsItem("NewsUrl")
      Result=RsItem("Result") 
      ItemID=RsItem("ItemID")
      ClassID=RsItem("ClassID")
      ChannelID=RsItem("ChannelID")
%>         
    <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'" style="padding: 0px 2px;">          
      <td width="30" align="center">          
        <input type="checkbox" value=<%=HistrolyNewsID%> name="HistrolyID" onclick="unselectall(this.form)">         
      </td>               
      <td width="120" align="center">          
        <%Call ShowItemName(ItemID)%>         
      </td>         
      <td align="left">
      <%
      If Title="" or IsNull(Title) then 
         Response.Write "出错"
      Else
         Response.Write "<a href=Admin_Soft.asp?Action=Show&ChannelID="&ChannelID&"&SoftID=" & SoftID & " title='采集时间：" & NewsCollecdate & "'>" & title & "</a>"
      End If
      %>
      </td>  
      <td align="center"><%Call ShowName(1,ChannelID)%></td>
      <td align="center"><%Call ShowName(2,ClassID)%></td>
      <td align="center"><a href="<%=NewsUrl%>" target=_blank title=<%=NewsUrl%>>点击访问</a></td>     
      <td align="center">
      <%If Result=True Then
           Response.write "成功"
        ElseIf Result=False Then
           Response.Write "<font color=red>失败</font>"
        Else
           Response.Write "<font color=red>异常</font>"
        End If
      %>
      </td>
      <td align="center">                           
      <a href="Admin_ST_Histroly.asp?Action=Del&HistrolyID=<%=HistrolyNewsID%>" onclick='return confirm("确定要删除此记录吗？");'>删除</a>                 
      </td>         
    </tr>         
<%         
HistrolyN=HistrolyN+1
If HistrolyN >= MaxPerPage Then Exit Do
   RsItem.Movenext         
   Loop         
%>         
    <tr class="tdbg">          
      <td colspan=8 height="30">       
        <input name="Action" type="hidden" id="Action" value="Del">   
        <input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">选中所有项目
        &nbsp;&nbsp;&nbsp;&nbsp;将选定的项目：          
        <input type="submit" value=" 删&nbsp;&nbsp;除 " name="submit" onClick='return ConfirmDel(this.form);'>&nbsp;&nbsp;         
        <input type="submit" value="清空所有记录" name="DelAll" onClick='return ConfirmDel(this.form);'>&nbsp;&nbsp;         
        <input type="submit" value="清除失败记录" name="DelAllFail" onClick='return ConfirmDel(this.form);'>&nbsp;&nbsp;   
        <input TYPE='button' value='返回上一步' onCLICK='history.back(-1)'>      
      </td>         
    </tr>
    <tr class="tdbg">          
      <td colspan=8 height="30" align=right>       
<select name='SelectHistoryItemID'>
<%Call ShowItemList(0)%>

</select>        <input type="submit" value="删除选择项目记录" name="DelItem" onClick='return ConfirmDel(this.form);' >    
      </td>         
    </tr> 
</form> 
   <tr class="tdbg">          
      <td colspan=8 height="30" align="center">          
共 <b><%=RsItem.recordcount%></b> 个历史记录&nbsp;<a href="Admin_ST_Histroly.asp">首页</a>&nbsp;<%if currentPage>1 then %><a href="Admin_ST_Histroly.asp?MaxPerPage=<%=MaxPerPage%>&page=<%=currentPage-1%>">上一页</a><%else%>上一页<%end if%>&nbsp;<%if currentPage<allpage then%><a href="Admin_ST_Histroly.asp?MaxPerPage=<%=MaxPerPage%>&page=<%=currentPage+1%>">下一页</a><%else%>下一页<%end if%> <a href="Admin_ST_Histroly.asp?MaxPerPage=<%=MaxPerPage%>&page=<%=allPage%>">尾页</a> 
页次：<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_Histroly.asp?page=<%=currentPage%>&MaxPerPage='+this.value;">个历史记录/页　
转到： <select onchange="window.location='Admin_ST_Histroly.asp?MaxPerPage=<%=MaxPerPage%>&page='+this.value" name="gopage">                                                        
<%
for HistrolyN=1 to allpage%>
<option <%if HistrolyN=currentPage then%>selected<%end if%> value="<%=HistrolyN%>">第<%=HistrolyN%>页</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
HistrolyID=Trim(Request("HistrolyID"))

If Trim(Request("DelAll"))="清空所有记录" Then
   ConnItem.Execute("Delete From HistrolyNews")
Elseif Trim(Request("DelItem"))="删除选择项目记录" Then
   ConnItem.Execute("Delete From HistrolyNews Where ItemID="&Trim(Request("SelectHistoryItemID")))
Elseif Trim(Request("DelAllFail"))="清除失败记录" Then
   ConnItem.Execute("Delete From HistrolyNews Where Result=False")
Else
   If HistrolyID="" Then
      FoundErr=True
      ErrMsg=ErrMsg & "<br><li>请选择要删除的记录！</li>"
   Else
      If Instr(HistrolyID,",")>0 Then
         HistrolyID=Replace(HistrolyID," ","")   
         ConnItem.Execute("Delete From [HistrolyNews] Where HistrolyNewsID In(" & HistrolyID & ")")
      Else
         HistrolyID=Clng(HistrolyID)
         ConnItem.Execute("Delete From [HistrolyNews] Where HistrolyNewsID=" & HistrolyID)
      End If
   End If
End If
If Action2<>"" Then
  Response.Write "<html><title>删除历史记录</title><body>"
  Response.write "<link href='style.css' rel='stylesheet' type='text/css'><br>"
  Response.write "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>"
  Response.write "<tr align='center' class='title'><td height='22'><strong>删除信息</strong></td></tr>"
  Response.Write "<tr class='tdbg'><td height='100' valign='top'><b>历史记录删除成功</b></td></tr>"
  Response.write "<tr align='center' class='tdbg'><td>[<a href='#' onclick='self.close()'>关闭窗口</a>]</td></tr>"
  Response.Write "</table></body></html>"
  Response.End
End If
End Sub
%>