<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p09")
'''''''''''''''''''''''''''''''''''''''''''''''
BeginTime=Timer
dim taskid
if not isempty(request("taskid")) then 
	taskid=Cint(request("taskid"))
else
	taskid=0
end if
%>
<html>
<head>
<title>信息采集</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #D4D0C8;
}
input{ font-size:12px;}
form{margin:0;}
-->
</style>
<link href="../admin/cs.css" rel="stylesheet" type="text/css">
<style type="text/css">
body{font-size:12px;}
<!--
.style1 {color: #FF0000}
.style2 {color: #CCCCCC}
.style3 {color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<%
dim first,classid
classid=0
dim i
set rs=server.CreateObject("adodb.recordset")
sql="select id,title from catalogs where parentid="&classid&" order by id asc"
rs.open sql,conn,3,1
if not rs.eof then
	first=rs.GetRows()
else
	response.Write("暂时没有分类!请先<a href=""tree.asp"">添加</a>栏目分类.")
	response.End()
end if
rs.close
set rs=nothing

Function getcatalogs(parentid,str)
	Dim Sql,rstemp,TemptempStr,tempStr	
	tempStr=str&"&nbsp;"
	sql="select id,title from catalogs where parentid="&parentid
	Set rstemp = Conn.Execute(Sql)
	do while Not rstemp.Eof
		getcatalogs = getcatalogs &"<option value="&rstemp(0)&">│"&tempStr&"└"&rstemp(1)&"</option>"&Chr(10)
		getcatalogs = getcatalogs & getcatalogs(rstemp(0),tempStr)
		rstemp.MoveNext
	loop
	rstemp.close
	Set rstemp = Nothing
End Function
Function getcatalogoption()
	dim ret
	ret=""
	for i=0 to ubound(first,2)
		ret=ret&"<option value="&first(0,i)&">├"&first(1,i)&"</option>"&Chr(10)
    	ret=ret&getcatalogs(first(0,i),"")
	next
	getcatalogoption=ret
end Function
%>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td width="100%" height="22"><div align="center"><span class="style3">◆ 信息采集 ◆</span></div></td>
  </tr>
</table>
<fieldset style="margin:5px 50px 5px 50px; border-top:1px solid #ffffff; border-right:1px solid #000000;border-bottom:1px solid #000000;border-left:1px solid #ffffff;">
<%
if(taskid>=1) then
	set rs=server.CreateObject("adodb.recordset") 
	rs.open "select top 1 * from collect where id="&taskid,conn,3,3
	if not rs.eof then
%>
	<form name="form1" method="post" action="collect2.asp">
	  <legend>第一步建立新任务</legend>
	<table width="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="34%"><div align="right">任务名称：</div></td>
    <td width="66%"><div align="left">
      
        <input name="taskname" type="text" id="taskname" value="<%=rs("TaskName")%>">
      
    </div></td>
    </tr>
  <tr>
    <td><div align="right">任务描述：</div></td>
    <td><div align="left">
      <input name="taskdes" type="text" id="taskdes" size="30" value="<%=rs("Taskdes")%>">
    </div></td>
  </tr>
  <tr>
    <td><div align="right">采集地址：</div></td>
    <td><div align="left">
      <input name="collecturl" type="text" id="collecturl" value="<%=rs("CollectUrl")%>">
    例：http://www.tot.name</div></td>
  </tr>
  <tr>
    <td><div align="right">设置编码：</div></td>
    <td><div align="left">
      <input name="encode" type="text" id="encode" size="20" value="<%=rs("Encode")%>">
    (常见的有：UTF-8,ISO-8859-1,GBK,GB2312)</div></td>
  </tr>
  <tr>
    <td><div align="right">是否需要登录：</div></td>
    <td><input name="IfLogin" type="radio" onClick="LoginAbs.style.display='none'" value="0" <%if(rs("IfLogin")=0) then response.Write("checked")%>> 
      否
        <input name="IfLogin" type="radio" onClick="LoginAbs.style.display='block'" value="1" <%if(rs("IfLogin")=1) then response.Write("checked")%>> 
        是<br>
	<div id="LoginAbs" <%if(rs("IfLogin")=0) then response.Write("style=""display:none; """)%>>设置登录需要的参数：<br>
      登录地址：
        <input name="LoginUrl" type="text" id="LoginUrl" value="<%=rs("LoginUrl")%>" size="30">
        <br>
        登录提交地址：
        <input name="LoginActUrl" type="text" id="LoginActUrl" value="<%=rs("LoginActUrl")%>" size="30">
	    <br>
	    发送的数据：
	    <input name="PostData" type="text" id="PostData" value="<%=rs("PostData")%>" size="30">
		<br>
	    登录失败信息：
	    <input name="LoginFailMsg" type="text" id="LoginFailMsg" value="<%=rs("LoginFailMsg")%>" size="30">
		</div></td>
  </tr>
  <tr>
    <td><div align="right">采集到(哪个栏目)：</div></td>
    <td><div align="left">
      <select name="catalogid">
        <%
	catalogcache=application(CachePrefix&"_catalogoption_"&classid)
	if(catalogcache="" or isempty(catalogcache) or len(catalogcache)<1) then
  		application.Lock()
		application(CachePrefix&"_catalogoption_"&classid)=getcatalogoption()
		application.UnLock()
		response.Write(application(CachePrefix&"_catalogoption_"&classid))
	else
		response.Write(catalogcache)
	end if
	%>
      </select>
    </div></td>
  </tr>
  <tr>
    <td><div align="right"></div></td>
    <td height="50"><div align="left">
	<input type="hidden" name="taskid" value="<%=taskid%>">
      <input type="submit" name="Submit" value="下一步">
    </div></td>
  </tr>
</table>
</form>
<%
	end if
	rs.close
	set rs=nothing
else
%>
	<form name="form1" method="post" action="collect2.asp">
	  <legend>第一步建立新任务</legend>
	<table width="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="34%"><div align="right">任务名称：</div></td>
    <td width="66%"><div align="left">
      
        <input name="taskname" type="text" id="taskname">
      
    </div></td>
    </tr>
  <tr>
    <td><div align="right">任务描述：</div></td>
    <td><div align="left">
      <input name="taskdes" type="text" id="taskdes" size="30">
    </div></td>
  </tr>
  <tr>
    <td><div align="right">采集地址：</div></td>
    <td><div align="left">
      <input name="collecturl" type="text" id="collecturl">
    例：http://www.tot.name</div></td>
  </tr>
  <tr>
    <td><div align="right">设置编码：</div></td>
    <td><div align="left">
      <input name="encode" type="text" id="encode" value="GB2312" size="20">
    (常见的有：UTF-8,ISO-8859-1,GBK,GB2312)</div></td>
  </tr>
  <tr>
    <td><div align="right">是否需要登录：</div></td>
    <td><input name="IfLogin" type="radio" onClick="LoginAbs.style.display='none'" value="0" checked> 
      否
        <input name="IfLogin" type="radio" onClick="LoginAbs.style.display='block'" value="1"> 
        是<br>
	<div id="LoginAbs" style="display:none; ">设置登录需要的参数：<br>
      登录地址：
        <input name="LoginUrl" type="text" id="LoginUrl"  size="30">
        <br>
        登录提交地址：
        <input name="LoginActUrl" type="text" id="LoginActUrl" size="30">
	    <br>
	    发送的数据：
	    <input name="PostData" type="text" id="PostData"  size="30">例：username=test&password=test
		<br>
	    登录失败信息：
	    <input name="LoginFailMsg" type="text" id="LoginFailMsg" size="30">
		</div></td>
  </tr>
  <tr>
    <td><div align="right">采集到(哪个栏目)：</div></td>
    <td><div align="left">
      <select name="catalogid">
        <%
	catalogcache=application(CachePrefix&"_catalogoption_"&classid)
	if(catalogcache="" or isempty(catalogcache) or len(catalogcache)<1) then
  		application.Lock()
		application(CachePrefix&"_catalogoption_"&classid)=getcatalogoption()
		application.UnLock()
		response.Write(application(CachePrefix&"_catalogoption_"&classid))
	else
		response.Write(catalogcache)
	end if
	%>
      </select>
    </div></td>
  </tr>
  <tr>
    <td><div align="right"></div></td>
    <td height="50"><div align="left">
      <input type="submit" name="Submit" value="下一步">
    </div></td>
  </tr>
</table>
</form>
<%end if%>
<div>注：采集文章时会自动绑定设定的文章模板，默认绑定ID为1的文章模板，如需要修改，<a href="config.asp">点击此处</a>，或手工编辑inc/config.asp中GatherTempletId变量</div>
</fieldset>
<!--开始采集规则-->
<!--开如数据设置规则-->
<p align="center"><%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%></p>
</body>
</html>
<%
call connclose()
%>
