<% Option Explicit %>
<!--#include file="inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<%
'==============================================================================
'软件名称：风讯新闻采集系统V1.0
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
Dim SiteID
SiteID = Request("SiteID")
Session("SessionCollectIndex") = -1
Session("SessionAlreadySaveNum") = 0
Session("SessionSaveRemotePicNumber") = 0
Session("SessionResponseInfoStr") = ""
Session("SessionTitleAndLinkList") = ""
Dim DBC,Conn,CollectConn
Set DBC = New DataBaseClass
Set CollectConn = DBC.OpenConnection()
DBC.ConnStr = "DBQ=" + Server.MapPath(DataBaseConnectStr) + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'判断权限
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P1407") then Call ReturnError1()
'判断权限结束
Dim RsSiteObj,Sql
Sql = "Select * from Site"
Set RsSiteObj = CollectConn.Execute(Sql)

Function CheckCollectTF(RsSite)
	Dim RsTempObj
	if RsSite("ListHeadSetting") <> "" And  RsSite("ListFootSetting") <> "" And  RsSite("LinkHeadSetting") <> "" And  RsSite("LinkFootSetting") <> "" And  RsSite("PagebodyHeadSetting") <> "" And  RsSite("PagebodyFootSetting") <> "" And  RsSite("PageTitleHeadSetting") <> "" And  RsSite("PageTitleFootSetting") <> "" then
		if RsSite("IsLock") = True then
			CheckCollectTF = False
		else
			CheckCollectTF = True
		end if
	else
		CheckCollectTF = False
	end if
	if CheckCollectTF = True then
		Set RsTempObj = Conn.Execute("Select ClassID from NewsClass where ClassID='" & RsSite("SysClass") & "'")
		if RsTempObj.Eof then
			CheckCollectTF = False
		end if
		Set RsTempObj = Nothing
	end if
End Function
%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>新闻采集</TITLE>
<style type="text/css">
<!--
.ProcessBar {
	border-top-width: 2px;
	border-right-width: 2px;
	border-bottom-width: 2px;
	border-left-width: 2px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #000000;
	border-right-color: #CCCCCC;
	border-bottom-color: #CCCCCC;
	border-left-color: #000000;
}
-->
</style>
</HEAD>

<link href="Inc/Collect.css" rel="stylesheet">
<script language="JavaScript" src="JS/Public.js"></script>
<BODY topmargin="0" leftmargin="0" oncontextmenu="return false;" scroll=no>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr bgcolor="#FFFFFF"> 
    <td height="30" colspan="4" background="images/Collect_bg.gif" bgcolor="#FFFFFF"><strong><font color="#FF0000">采集站点</font></strong></td>
  </tr>
  <tr bgcolor="#F3F3F3"> 
    <td height="30" colspan="4" bgcolor="#F3F3F3">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
        <tr bgcolor="#F3F3F3"> 
    <td width="15%" height="30"> <div align="right">采集数量 </div></td>
    <td width="35%" height="30"> <input name="CollectCount" onBlur="CheckNumber(this,'采集数量');" style="width:100%;" type="text" id="CollectCount" value="10"> 
    </td>
    <td width="15%" height="30"> <div align="right">采集站点</div></td>
    <td height="30"> <select id="SiteID" style="width:100%;" name="SiteID">
        <%
		  do while Not RsSiteObj.Eof
		      if CheckCollectTF(RsSiteObj) = True then
		  %>
        <option <% if SiteID = CStr(RsSiteObj("ID")) then Response.Write("selected") %> value="<% = RsSiteObj("ID") %>"> 
        <% = RsSiteObj("SiteName") %>
        </option>
        <%
		  	  end if
		  	  RsSiteObj.MoveNext
		  loop
		  %>
      </select> </td>
  </tr>
  <tr bgcolor="#F3F3F3"> 
    <td height="30"> <div align="right">重名保存</div></td>
    <td height="30" bgcolor="#F3F3F3"> <input name="AllowNewsSameName" type="checkbox" id="AllowNewsSameName" value="1"> 
    </td>
    <td height="30"> <div align="right">纯文本</div></td>
    <td height="30" nowrap> <input name="OnlyText" type="checkbox" id="OnlyText3" value="1"></td>
  </tr>
  <tr bgcolor="#F3F3F3"> 
    <td height="30"> <div align="right">保存远程图片</div></td>
    <td height="30"> <input name="SaveRemoteImage" type="checkbox" id="SaveRemoteImage" value="1"></td>
    <td height="30"> <div align="right">超时设置</div></td>
    <td height="30" nowrap> <input onBlur="CheckNumber(this,'超时设置');" type="text" value="10000" name="ServerScriptTimeout" style="width:93%;">
      秒 </td>
  </tr>
  <tr id="CollectParaSet" bgcolor="#F3F3F3"> 
    <td height="30" colspan="4"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="50%"> <div align="center"> 
              <input name="BtnCollect" onClick="StartCollect();" type="button" id="Submit" value=" 采 集 ">
            </div></td>
          <td><div align="center"> 
              <input type="button" disabled name="BtnStop" onClick="location.href='Collect.asp';" value=" 停 止 ">
            </div></td>
        </tr>
      </table></td>
  </tr>
  <tr id="ProcessBarParent" style="display:none;" bgcolor="#F3F3F3"> 
          <td height="20" colspan="4"> 
            <table id="ProcessBarTable" border="0" width="0" cellpadding="0" cellspacing="0" bgcolor="#FF0000">
        <tr> 
          <td height="10" valign="bottom" nowrap id="ProcessBar">&nbsp;</td>
        </tr>
      </table>
          </td>
  </tr>
      </table></td>
  </tr>
  <tr id="CollecterSet"> 
    <td> 
      <iframe id="Collecter" scrolling="yes" frameborder="0" src="Collecting.asp" width="100%" height="100%"></iframe></td>
  </tr>
</table>
</BODY>
</HTML>
<%
Set CollectConn = Nothing
Set Conn = Nothing
Set RsSiteObj = Nothing
%>
<script language="JavaScript">
function StartCollect()
{
	var ParaList=GetParaList();
	document.all.BtnStop.disabled=true;
	document.all.BtnCollect.disabled=true;
	frames["Collecter"].location='Collecting.asp'+ParaList;
}
function GetParaList()
{
	var TempStr='';
	for (var i=0;i<document.all.length;i++)
	{
		var CurrObj=document.all(i);
		if (CurrObj.tagName.toLowerCase()=='input')
		{
			if (CurrObj.type.toLowerCase()=='text') TempStr=TempStr+'&'+CurrObj.name+'='+CurrObj.value;
			if (CurrObj.type.toLowerCase()=='checkbox')
			{
				if (CurrObj.checked==true) TempStr=TempStr+'&'+CurrObj.name+'=1';
			}
		}
		if (CurrObj.tagName.toLowerCase()=='select') TempStr=TempStr+'&'+CurrObj.name+'='+CurrObj.value;
	}
	if (TempStr.substr(0,1)=='&') TempStr=TempStr.replace('&','?');
	return TempStr;
}
function SetProcessBar(MaxLength,CurrIndex)
{
	document.all.BtnStop.disabled=false;
	window.setTimeout('document.all.BtnStop.disabled=true;',1000)
	if (CurrIndex==0) return;
	var UpDateNum=parseInt(MaxLength/100),TableDecimal='';
	document.all.ProcessBarParent.style.display='';
	var OperateObj=document.all.ProcessBarTable;
	if (UpDateNum>1)
	{
		if (CurrIndex/MaxLength*100>1)
		{
			TableDecimal=(CurrIndex/MaxLength*100).toString()+'%';
			OperateObj.width=TableDecimal;
		}
	}
	else
	{
		TableDecimal=(CurrIndex/MaxLength*100).toString()+'%';
		OperateObj.width=TableDecimal;
	}
}
function InitialProcessBar()
{
	document.all.BtnStop.disabled=true;
	document.all.ProcessBarParent.style.display='none';
}
</script>