<!--#include file="Item_Conn.asp"-->
<!--#include file="Item_Function.asp"-->
<html>
<head>
<title>采集系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../Skins/Admin_Style.Css" rel="stylesheet" type="text/css">
<script Language="JavaScript" src="../../Inc/Js/admin.js"></script>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<%
Dim Action
Action=Trim(Request("Action"))
Select Case Action
Case "Step2"
	Call Step2()
Case "Step3"
	Call Step3()
Case "Step4"
	Call Step4()
Case "Step5"
	Call Step5()
Case "Step6"
	Call Step6()
Case Else
	Call Main()
End Select
'关闭数据库链接

Footer
Call CloseConnItem()

Sub Main()
Call SetChannel%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center"><strong>采&nbsp;&nbsp;集&nbsp;&nbsp;系&nbsp;&nbsp;统&nbsp;&nbsp;项&nbsp;&nbsp;目&nbsp;&nbsp;管&nbsp;&nbsp;理</strong></td>
  </tr>
  <tr class="tdbg">
    <td height="30" width="65"><strong>管理导航：</strong></td>  
    <td height="30"><a href="Item_AddNew.asp">添加项目</a> >> <font color=red>基本设置</font> >> 列表设置 >> 链接设置 >> 正文设置 >> 采样测试 >> 属性设置 >> 完成</td>       
  </tr>         
</table>   

<br>         
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
<form method="post" action="Item_AddNew.asp" name="myform">
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><strong>添 加 新 
		项 目--基 本 设 置</strong></div></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong>项目名称：</strong></td>
      <td class="tdbg" width="75%">
		<input name="ItemName" type="text" size="27" maxlength="30">&nbsp;&nbsp;<font color=red>*</font>如：XXX新闻中心 既简单又明了
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong> 所属频道：</strong></td>
      <td class="tdbg" width="75%"><select ID="ChannelID" name="ChannelID" onChange="changelocation(document.myform.ChannelID.options[document.myform.ChannelID.selectedIndex].value)"><%call Admin_ShowChannel_Option(1)%></select>
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong> 所属栏目：</strong></td>
      <td class="tdbg" width="75%"><select ID="ClassID" name="ClassID"><%=ShowClass_Option(ChannelID,0,0,1)%></select>
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong> 所属专题：</strong></td>
      <td class="tdbg" width="75%"><select ID="SpecialID" name="SpecialID"><%=ShowSpecial_Option(ChannelID,0,1)%></select>
      </td>
    </tr>
    <tr>
      <td width="20%" class="tdbg"><strong> 网站名称：</strong></td>
      <td class="tdbg" width="75%">
		<input name="WebName" type="text" size="27" maxlength="30">
      </td>
    </tr>
    <tr>
      <td width="20%" class="tdbg"><strong> 网站网址：</strong></td>
      <td class="tdbg" width="75%"><input name="WebUrl" type="text" size="49" maxlength="150">
      </td>
    </tr>
   <tr class="tdbg"> 
      <td width="150" class="tdbg"><strong> 网站登录：</strong></td>
      <td class="tdbg">
		<input type="radio" value="0" name="LoginType" checked onClick="Login.style.display='none'">不需要登录<span lang="en-us">&nbsp;
		</span>
		<input type="radio" value="1" name="LoginType" onClick="Login.style.display=''">设置参数</td>
    </tr>
   <tr class="tdbg" id="Login" style="display:none"> 
      <td width="150" class="tdbg"><strong> 登录参数：</strong></td>
      <td class="tdbg">
        登录地址：<input name="LoginUrl" type="text" size="40" maxlength="150" value=""><br>
        提交地址：<input name="LoginPostUrl" type="text" size="40" maxlength="150" value=""><br>
        用户参数：<input name="LoginUser" type="text" size="30" maxlength="150" value=""><br>
        密码参数：<input name="LoginPass" type="text" size="30" maxlength="150" value=""><br> 
		失败信息：<input name="LoginFalse" type="text" size="30" maxlength="150" value=""></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong>项目备注：</strong></td>
      <td class="tdbg" width="75%"><textarea name="ItemDemo" cols="49" rows="5"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
		<input name="Action" type="hidden" id="Action" value="Step2">
        <input name="Cancel" type="button" id="Cancel" value=" 返&nbsp;&nbsp;回 " onClick="window.location.href='Item_Manage.asp'">
        &nbsp; 
        <input  type="submit" name="Submit" value="下&nbsp;一&nbsp;步"></td>
    </tr>
</form>
</table>
<%
End Sub

Sub Step2()
	Dim SqlItem,RsItem
	Dim ItemID,ItemName,WebName,WebUrl,strChannelDir,ClassID,SpecialID,ItemDemo,LoginType,LoginUrl,LoginPostUrl,LoginUser,LoginPass,LoginFalse
	Dim tClass,tSpecial

	ItemName=Trim(Request.Form("ItemName"))
	WebName=Trim(Request.Form("WebName"))
	WebUrl=Trim(Request.Form("WebUrl"))
	ChannelID=Trim(Request.Form("ChannelID"))
	ClassID=Trim(Request.Form("ClassID"))
	SpecialID=Trim(Request.Form("SpecialID"))
	ItemDemo=Trim(Request.Form("ItemDemo"))
	LoginType=Request.Form("LoginType")
	LoginUrl=Trim(Request.Form("LoginUrl"))
	LoginPostUrl=Trim(Request.Form("LoginPostUrl"))
	LoginUser=Trim(Request.Form("LoginUser"))
	LoginPass=Trim(Request.Form("LoginPass"))
	LoginFalse=Trim(Request.Form("LoginFalse"))

	If ItemName="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>项目名称不能为空</li>"
	End If
	If WebName="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>网站名称不能为空</li>"
	End If
	If WebUrl="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>网站网址不能为空</li>" 
	End If
	If ChannelID="" or ChannelID=0 Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>未指定频道</li>"
	Else
	   ChannelID=Clng(ChannelID)
	End If
	If ClassID=""  Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>未指定栏目</li>"
	Else
	   ClassID=CLng(ClassID)
	   If ClassID<=0 then
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>指定的栏目有下属子栏目或者非法的栏目（外部栏目或不存在的栏目）</li>"
	   Else
		  set tClass=Cl.Execute("select C.Child,C.LinkUrl,D.ChannelDir From Cl_Class C inner join Cl_Channel D on C.ChannelID=D.ChannelID Where C.ChannelID="  & ChannelID & " and C.ClassID=" & ClassID)
		  If tClass.bof and tClass.eof then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>在本频道内找不到指定的栏目</li>"
		  Else
			 if tClass(0)>0 then
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>指定的栏目有下属子栏目</li>"
			 End if
			 If tClass(1)<>"" then
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>不能指定外部栏目</li>"
			 End if
			 strChannelDir=tClass(2)
		  End if
		  Set tClass=Nothing
	   End if
	End if

	if SpecialID="" then
	   SpecialID=0
	Else
	   SpecialID=CLng(SpecialID)
	   If SpecialID<>0 Then
		  set tSpecial=Cl.Execute("select SpecialID From Cl_Special Where ChannelID="  & ChannelID)
		  If tSpecial.bof and tSpecial.eof then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>在本频道内找不到指定的专题</li>"
		  End If
		  Set tSpecial=Nothing
	   End If
	End if
	If LoginType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请选择登录类型</li>"
	Else
	   LoginType=Clng(LoginType)
	   If LoginType=1 Then
			 If LoginUrl="" or LoginPostUrl="" or LoginUser="" or  LoginPass="" or  LoginFalse="" then
			 FoundErr=True
			 ErrMsg=ErrMsg& "<br><li>请将登录参数填写完整</li>"
		  End If
	   End If
	End If

	If FoundErr<>True Then
	   SqlItem="Select top 1 ItemID,ItemName,WebName,WebUrl,ChannelID,ChannelDir,ClassID,SpecialID,ItemDemo,LoginType,LoginUrl,LoginPostUrl,LoginUser,LoginPass,LoginFalse from Item"
	   Set RsItem=server.CreateObject("adodb.recordset")
	   RsItem.Open SqlItem,ConnItem,1,3
	   RsItem.AddNew
	   RsItem("ItemName")=ItemName
	   RsItem("WebName")=WebName
	   RsItem("WebUrl")=WebUrl
	   RsItem("ChannelID")=ChannelID
	   RsItem("ChannelDir")=strChannelDir
	   RsItem("ClassID")=ClassID
	   RsItem("SpecialID")=SpecialID
	   If ItemDemo<>"" then
		  RsItem("ItemDemo")=ItemDemo
	   End if
	   RsItem("LoginType")=LoginType
	   If LoginType=1 Then
		  RsItem("LoginUrl")=LoginUrl
		  RsItem("LoginPostUrl")=LoginPostUrl
		  RsItem("LoginUser")=LoginUser
		  RsItem("LoginPass")=LoginPass
		  RsItem("LoginFalse")=LoginFalse
	   End If
	   ItemID=RsItem("ItemID")
	   RsItem.UpDate
	   RsItem.Close
	   Set RsItem=Nothing
	End If

	If FoundErr=True Then Admin_ShowErr(ErrMsg)

%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center" class="topbg"><strong>采&nbsp;&nbsp;集&nbsp;&nbsp;系&nbsp;&nbsp;统&nbsp;&nbsp;项&nbsp;&nbsp;目&nbsp;&nbsp;管&nbsp;&nbsp;理</td>
  </tr>
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="Item_AddNew.asp">添加项目</a> >> <a href="Item_Modify.asp">基本设置</a> >> <font color=red>列表设置</font> >> 链接设置 >> 正文设置 >> 采样测试 >> 属性设置 >> 完成</td>         
  </tr>         
</table>
<br>         
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
<form method="post" action="Item_AddNew.asp" name="form1">
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><strong>添 加 新 
		项 目--列  表 设 置</strong></div></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong>列表索引页面：</strong></td>
      <td class="tdbg" width="75%">
		<input name="ListStr" type="text" size="58" maxlength="200"> 
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><strong>列表开始标记：</strong></td>
      <td class="tdbg" width="75%">
      <textarea name="LsString" cols="49" rows="7"></textarea><br>
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><strong>列表结束标记：</strong></td>
      <td class="tdbg" width="75%">
      <textarea name="LoString" cols="49" rows="7"></textarea><br>
      </td>
    </tr>
    <tr>
      <td width="20%" class="tdbg"><strong> 列表索引分页：</strong></td>
      <td class="tdbg" width="75%">
		<input type="radio" value="0" name="ListPaingType" checked onClick="ListPaing1.style.display='none';ListPaing12.style.display='none';ListPaing2.style.display='none';ListPaing3.style.display='none'">不作设置&nbsp;
		<input type="radio" value="1" name="ListPaingType" onClick="ListPaing1.style.display='';ListPaing12.style.display='';ListPaing2.style.display='none';ListPaing3.style.display='none'">设置标签&nbsp;
		<input type="radio" value="2" name="ListPaingType" onClick="ListPaing1.style.display='none';ListPaing12.style.display='none';ListPaing2.style.display='';ListPaing3.style.display='none'">批量生成&nbsp;
		<input type="radio" value="3" name="ListPaingType" onClick="ListPaing1.style.display='none';ListPaing12.style.display='none';ListPaing2.style.display='none';ListPaing3.style.display=''">手动添加
	   </td>
    </tr>
	<tr class="tdbg" id="ListPaing1" style="display:none">
      <td width="20%" class="tdbg"><strong><font color=blue>下页开始标记：</font></strong><p>　</p><p>　</p>
      <strong><font color=blue>下页结束标记：</font></strong>
      </td>
      <td class="tdbg" width="75%">
		<textarea name="LPsString" cols="49" rows="7"></textarea><br>
		<textarea name="LPoString" cols="49" rows="7"></textarea>
	   </td>
    </tr>
	<tr class="tdbg" id="ListPaing12" style="display:none">
      <td width="20%" class="tdbg"><strong><font color=blue>索引分页重定向：</font></strong>
      </td>
      <td class="tdbg" width="75%">
	<input name="ListPaingStr1" type="text" size="58" maxlength="200" value=""><br>
        格式：http://www.aspoo.cn/list.asp?page={$ID}  
	   </td>
    </tr>
    <tr class="tdbg" id="ListPaing2" style="display:none"> 
      <td width="20%" class="tdbg"><strong><font color=blue>批量生成：</font></strong></td>
      <td class="tdbg" width="75%">
        原字符串：<br>
		<input name="ListPaingStr2" type="text" size="58" maxlength="200" value=""><br>
                格式：http://www.aspoo.cn/list.asp?page={$ID}<br><br>
	    生成范围：<br>
		<input name="ListPaingID1" type="text" size="8" maxlength="200"><span lang="en-us"> To </span><input name="ListPaingID2" type="text" size="8" maxlength="200"><br>
                格式：只能是数字，可升序或者降序。
      </td>
    </tr>
    <tr class="tdbg" id="ListPaing3" style="display:none"> 
      <td width="20%" class="tdbg"><strong><font color=blue>手动添加：</font></strong>
      </td>
      <td class="tdbg" width="75%">
      <textarea name="ListPaingStr3" cols="49" rows="7"></textarea><br>
      格式：输入一个网址后按回车，再输入下一个。
       </td>
    </tr>
    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
		<input name="Action" type="hidden" id="Action" value="Step3">
        <input name="ItemID" type="hidden" value="<%=ItemID%>">
        <input  type="submit" name="Submit" value="下&nbsp;一&nbsp;步"></td>
    </tr>
</form>
</table>
<%
End Sub

Sub Step3()
	Dim SqlItem,RsItem,ItemID
	Dim ListStr,LsString,LoString,ListPaingType,LPsString,LPoString,ListPaingStr1,ListPaingStr2,ListPaingID1,ListPaingID2,ListPaingStr3
	Dim ListUrl,ListCode
	Dim LoginType,LoginUrl,LoginPostUrl,LoginUser,LoginPass,LoginFalse,LoginResult,LoginData
	Dim  ListPaingNext
	ItemID=Trim(Request.Form("ItemID"))
	ListStr=Trim(Request.Form("ListStr"))
	LsString=Request.Form("LsString")
	LoString=Request.Form("LoString")
	ListPaingType=Request.Form("ListPaingType")
	LPsString=Request.Form("LPsString")
	LPoString=Request.Form("LPoString")
	ListPaingStr1=Trim(Request.Form("ListPaingStr1"))
	ListPaingStr2=Trim(Request.Form("ListPaingStr2"))
	ListPaingID1=Trim(Request.Form("ListPaingID1"))
	ListPaingID2=Trim(Request.Form("ListPaingID2"))
	ListPaingStr3=Trim(Request.Form("ListPaingStr3"))
	FoundErr=False

	If ItemID=""  Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>"
	Else
	   ItemID=Clng(ItemID)
	End If
	If LsString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>列表开始标记不能为空</li>"
	End If
	If LoString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>列表结束标记不能为空</li>" 
	End If
	If ListPaingType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请选择列表索引分页类型</li>" 
	Else
	   ListPaingType=Clng(ListPaingType)
	   Select Case ListPaingType
	   Case 0,1
				If ListStr="" Then
				   FoundErr=True
				   ErrMsg=ErrMsg & "<br><li>列表索引页不能为空</li>"
				Else
				   ListStr=Trim(ListStr)
				End If
		  If  ListPaingType=1  Then
				If LPsString="" or LPoString="" Then
				   FoundErr=True
				   ErrMsg=ErrMsg & "<br><li>索引分页开始/结束标记不能为空</li>" 
				End If
				If ListPaingStr1<>"" and Len(ListPaingStr1)<15 Then
				   FoundErr=True
				   ErrMsg=ErrMsg & "<br><li>索引分页重定向设置不正确(至少15个字符)</li>" 
				End If
		  End  If
	   Case 2
		  If ListPaingStr2="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>批量生成字符不能为空</li>"
		  End If
		  If isNumeric(ListPaingID1)=False or isNumeric(ListPaingID2)=False Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>批量生成的范围只能是数字</li>"
		  Else
			 ListPaingID1=Clng(ListPaingID1)
			 ListPaingID2=Clng(ListPaingID2)
			 If ListPaingID1=0 And ListPaingID2=0 Then
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>批量生成范围设置不正确</li>"
			 End If
		  End If
	   Case 3
		  If ListPaingStr3="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>列表索引分页不能为空，请手动添加</li>"
		  Else
			 ListPaingStr3=Replace(ListPaingStr3,CHR(13),"|") 
		  End If
	   Case Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>请选择列表索引分页类型</li>" 
	   End Select
	End if

	If FoundErr<>True Then
	   SqlItem="Select * from Item Where ItemID=" & ItemID
	   Set RsItem=server.CreateObject("adodb.recordset")
	   RsItem.Open SqlItem,ConnItem,2,3

	   RsItem("LsString")=LsString
	   RsItem("LoString")=LoString
	   RsItem("ListPaingType")=ListPaingType
	   Select Case ListPaingType
	   Case 0,1
			 RsItem("ListStr")=ListStr
		  If ListPaingType=1  Then
				RsItem("LPsString")=LPsString
				RsItem("LPoString")=LPoString
				If ListPaingStr1<>"" Then
				   RsItem("ListPaingStr1")=ListPaingStr1
				End If
		  End  If
		  ListUrl=ListStr
	   Case 2
		  RsItem("ListPaingStr2")=ListPaingStr2
		  RsItem("ListPaingID1")=ListPaingID1
		  RsItem("ListPaingID2")=ListPaingID2
		  ListUrl=Replace(ListPaingStr2,"{$ID}",CStr(ListPaingID1))
	   Case 3
		  RsItem("ListPaingStr3")=ListPaingStr3
		  If  Instr(ListPaingStr3,"|")>0  Then
				ListUrl=Left(ListPaingStr3,Instr(ListPaingStr3,"|")-1)
		  Else
				ListUrl=ListPaingStr3
		  End  If
	   End Select
	   LoginType=RsItem("LoginType")
	   LoginUrl=RsItem("LoginUrl")
	   LoginPostUrl=RsItem("LoginPostUrl")
	   LoginUser=RsItem("LoginUser")
	   LoginPass=RsItem("LoginPass")
	   LoginFalse=RsItem("LoginFalse")
	   RsItem.UpDate
	   RsItem.Close
	   Set RsItem=Nothing

	   If LoginType=1 then
		  LoginData=UrlEncoding(LoginUser & "&" & LoginPass)
		  LoginResult=PostHttpPage(LoginUrl,LoginPostUrl,LoginData)
		  If Instr(LoginResult,LoginFalse)>0 Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>网站登录失败，请检查登录参数！</li>"
		  End If
	   End If
	   
	   If FoundErr<>True Then
		  ListCode=GetHttpPage(ListUrl)
		  If ListCode<>"$False$" Then
			 If ListPaingType=1  Then
				ListPaingNext=GetPaing(ListCode,LPsString,LPoString,False,False)
					  If ListPaingNext<>"$False$"  Then
						 If ListPaingStr1<>""  Then  
							ListPaingNext=Replace(ListPaingStr1,"{$ID}",ListPaingNext)
				   Else
							ListPaingNext=DefiniteUrl(ListPaingNext,ListUrl)
				   End  If
				End  If
			 End If
			 ListCode=GetBody(ListCode,LsString,Lostring,False,False)
			 If ListCode="$False$" Then
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>在截取:" & ListUrl & "新闻列表时发生错误</li>"
			 End If
		  Else
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>在获取:" & ListUrl & "网页源码时发生错误</li>"
		  End If
	   End If
	End If
	If FoundErr=True Then Admin_ShowErr(ErrMsg)
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center" class="topbg"><strong>采&nbsp;&nbsp;集&nbsp;&nbsp;系&nbsp;&nbsp;统&nbsp;&nbsp;项&nbsp;&nbsp;目&nbsp;&nbsp;管&nbsp;&nbsp;理</td>
  </tr>
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="Item_AddNew.asp">添加项目</a> >> <a href="Item_Modify.asp?ItemID=<%=ItemID%>">基本设置</a> >> <a href="Item_Modify.asp?Action=Step2&ItemID=<%=ItemID%>">列表设置</a> >> <font color=red>链接设置</font> >> 正文设置 >> 采样测试 >> 属性设置 >> 完成</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"><strong>添 加 新 
		项 目--列 表 截 取 测 试</strong></div></td>
    </tr>
  <tr class="tdbg"> 
    <td class="tdbg" colspan="2" align="center"><iframe marginwidth=0 marginheight=0 frameborder=0 name="url" width="800" height="300" src="<%=ListUrl%>"></iframe> </td>
  </tr>
  <tr> 
    <td height="22" colspan="2" class="title"> <div align="center"><strong> 项 目 编 辑--采集目标源码 </strong>      <Input type="radio" value="0" name="code" onClick="javascript:Content.style.height='1';" >不查看
      <Input type="radio" value="1" name="code" onClick="javascript:Content.style.height='300';" checked>查看源码
</div></td>
  </tr>
  <tr class="tdbg"> 
    <td class="tdbg" class="tdbg" colspan="2" align="center"><TEXTAREA NAME="Content" ROWS="" COLS="" style="width:800px;height:300px"><%=ListCode%></TEXTAREA></td>
  </tr>
</table>
<%If ListPaingNext<>"" And ListPaingNext<>"$False$" Then%>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr class="tdbg"> 
      <td height="22" colspan="2" class="tdbg" >
      <%Response.Write "<br>下一页列表：<a  href='" & ListPaingNext  &  "' target=_blank><font  color=red>"  &  ListPaingNext  &  "</font></a>"%>
      </td>
    </tr>
</table>
<%End If%>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
<form method="post" action="Item_AddNew.asp" name="form1">
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><strong>添 加 新 
		项 目--链 接 设 置</strong></div></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><strong>链接开始标记：</strong></td>
      <td class="tdbg" width="75%">
      <textarea name="HsString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><strong>链接结束标记：</strong></td>
      <td class="tdbg" width="75%">
      <textarea name="HoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr>
      <td width="20%" class="tdbg"><strong>链接处理类型：</strong></td>
      <td class="tdbg" width="75%">
		<input type="radio" value="0" name="HttpUrlType" checked onClick="HttpUrl1.style.display='none'">自动处理&nbsp;
		<input type="radio" value="1" name="HttpUrlType" onClick="HttpUrl1.style.display=''">重新定向
	   </td>
    </tr>
	<tr class="tdbg" id="HttpUrl1" style="display:none">
      <td width="20%" class="tdbg"><strong>重新定向链接字符：</strong></td>
      <td class="tdbg" width="75%">
	<input name="HttpUrlStr" type="text" size="49" maxlength="200" value=""><br>
        格式：http://www.aspoo.cn/Article/ArticleShow.asp?ID={$ID}
      </td>
    </tr>
    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
		<input name="Action" type="hidden" id="Action" value="Step4">
        <input name="ItemID" type="hidden" value="<%=ItemID%>">
        <input  type="button" name="button1" value="上&nbsp;一&nbsp;步" onClick="window.location.href='javascript:history.go(-1)'" >
        &nbsp;&nbsp;&nbsp;&nbsp; 
        <input  type="submit" name="Submit" value="下&nbsp;一&nbsp;步"></td>
    </tr>
</form>
</table>
<%
End Sub

Sub Step4()
	Dim ItemID
	Dim RsItem,SqlItem
	Dim ListStr,LsString,LoString
	Dim  ListPaingType,LPsString,LPoString,ListPaingStr1,ListPaingStr2,ListPaingID1,ListPaingID2,ListPaingStr3,HsString,HoString,HttpUrlType,HttpUrlStr
	Dim  ListUrl,ListCode,NewsArrayCode,NewsArray,UrlTest,NewsCode
	dim Testi
	ItemID=Trim(Request("ItemID"))
	HsString=Request.Form("HsString")
	HoString=Request.Form("HoString")
	HttpUrlType=Trim(Request.Form("HttpUrlType"))
	HttpUrlStr=Trim(Request.Form("HttpUrlStr"))


	If ItemID="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>"
	Else
	   ItemID=Clng(ItemID)
	End If
	If HsString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>链接开始标记不能为空</li>"
	End If
	If HoString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>链接结束标记不能为空</li>" 
	End If
	If HttpUrlType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请选择链接处理类型</li>"
	Else
	   HttpUrlType=Clng(HttpUrlType)
	   If HttpUrlType=1 Then
		  If HttpUrlStr="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>绝对链接字符设置不能为空</li>"
		  Else
				If  Len(HttpUrlStr)<15  Then
				   FoundErr=True
				   ErrMsg=ErrMsg & "<br><li>绝对链接字符设置不正确(15个字符以上)</li>"
				End  If      
		  End If
	   End If
	End If


	If FoundErr<>True Then
	   SqlItem="Select ListStr,LsString,LoString,ListPaingType,LPsString,LPoString,ListPaingStr1,ListPaingStr2,ListPaingID1,ListPaingID2,ListPaingStr3,HsString,HoString,HttpUrlType,HttpUrlStr from Item Where ItemID=" & ItemID
	   Set RsItem=server.CreateObject("adodb.recordset")
	   RsItem.Open SqlItem,ConnItem,2,3

	   RsItem("HsString")=HsString
	   RsItem("HoString")=HoString
	   RsItem("HttpUrlType")=HttpUrlType
	   If HttpUrlType=1 Then
		  RsItem("HttpUrlStr")=HttpUrlStr
	   End If
	   ListStr=RsItem("ListStr")
	   LsString=RsItem("LsString")
	   LoString=RsItem("LoString")
	   ListPaingType=RsItem("ListPaingType")
	   LPsString=RsItem("LPsString")
	   ListPaingStr1=RsItem("ListPaingStr1")
	   ListPaingStr2=RsItem("ListPaingStr2")
	   ListPaingID1=RsItem("ListPaingID1")
	   ListPaingID2=RsItem("ListPaingID2")
	   ListPaingStr3=RsItem("ListPaingStr3")

	   RsItem.UpDate
	   RsItem.Close
	   Set RsItem=Nothing
	   
	   Select  Case  ListPaingType
	   Case  0,1
			 ListUrl=ListStr
	   Case  2
			 ListUrl=Replace(ListPaingStr2,"{$ID}",CStr(ListPaingID1))
	   Case  3
			 If  Instr(ListPaingStr3,"|")>0  Then
			 ListUrl=Left(ListPaingStr3,Instr(ListPaingStr3,"|")-1)
		  Else
			 ListUrl=ListPaingStr3
		  End  If
	   End  Select

	   ListCode=GetHttpPage(ListUrl)
	   If ListCode<>"$False$" Then
		  ListCode=GetBody(ListCode,LsString,LoString,False,False)
		  If ListCode<>"$False$" Then 
			 NewsArrayCode=GetArray(ListCode,HsString,HoString,False,False)
			 If NewsArrayCode<>"$False$" Then
				   NewsArray=Split(NewsArrayCode,"$Array$")
				   For Testi=0 To Ubound(NewsArray)
					  If HttpUrlType=1 Then
						 NewsArray(Testi)=Replace(HttpUrlStr,"{$ID}",NewsArray(Testi))
					  Else
						 NewsArray(Testi)=DefiniteUrl(NewsArray(Testi),ListUrl)
					  End If
				   Next
				   UrlTest=NewsArray(0)
				   NewsCode=GetHttpPage(UrlTest)
			 Else
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>在获取链接列表时出错。</li>"
			 End If   
		  Else
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>在截取列表时发生错误。</li>"
		  End If
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>在获取:" & ListUrl & "网页源码时发生错误。</li>"
	   End If
	End If

	If FoundErr=True Then Admin_ShowErr(ErrMsg)
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center" class="topbg"><strong>采&nbsp;&nbsp;集&nbsp;&nbsp;系&nbsp;&nbsp;统&nbsp;&nbsp;项&nbsp;&nbsp;目&nbsp;&nbsp;管&nbsp;&nbsp;理</td>
  </tr>
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="Item_AddNew.asp">添加项目</a> >> <a href="Item_Modify.asp?ItemID=<%=ItemID%>">基本设置</a> >> <a href="Item_Modify.asp?Action=Step2&ItemID=<%=ItemID%>">列表设置</a> >> <a href="Item_Modify.asp?Action=Step3&ItemID=<%=ItemID%>">链接设置</a> >> <font color=red>正文设置</font> >> 采样测试 >> 属性设置 >> 完成</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"><strong>添 加 新 
		项 目--列 表 新 闻 链 接 测 试</strong></div></td>
    </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="tdbg">以下是分析后所得到的新闻绝对链接地址，请查看是否正确。<br>
<%
For Testi=0 To Ubound(NewsArray)
   Response.Write "<a href='" & NewsArray(Testi) & "' target=_blank>" & NewsArray(Testi) & "</a><br>"
Next
%>
<br>
下一步将抽取第一条新闻进行测试，在填写以下标记时尽量不要使用第一条新闻。
      </td>
    </tr>
</table>
<form method="post" action="Item_AddNew.asp" name="form1">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><strong>添 加 新 
		项 目--正 文 设 置</strong></div>
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><strong>标题开始标记：</strong><p>　</p><p>　</p>
      <strong>标题结束标记：</strong></td>
      <td class="tdbg" width="75%">
      <textarea name="TsString" cols="49" rows="7"></textarea><br>
      <textarea name="ToString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><strong>正文开始标记：</strong><p>　</p><p>　</p>
      <strong>正文结束标记：</strong></td>
      <td class="tdbg" width="75%">
      <textarea name="CsString" cols="49" rows="7"></textarea><br>
      <textarea name="CoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><b>时<span lang="en-us">&nbsp; </span>间<span lang="en-us">&nbsp;
		</span>设<span lang="en-us">&nbsp; </span>置：</b></td>
      <td class="tdbg" width="75%">
      	<input type="radio" value="0" name="DateType" checked onClick="Date1.style.display='none'">不作设置&nbsp;
		<input type="radio" value="1" name="DateType" onClick="Date1.style.display=''">设置标签&nbsp;
    </tr>
    <tr class="tdbg" id="Date1" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>时间开始标记：</font></strong><p>　</p>
		<p>　</p>
      <strong><font color=blue>时间结束标记：</font></strong></td>
      <td class="tdbg" width="75%">
      <textarea name="DsString" cols="49" rows="7"></textarea><br>
      <textarea name="DoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><b>作<span lang="en-us">&nbsp; </span>者<span lang="en-us">&nbsp;
		</span>设<span lang="en-us">&nbsp; </span>置：</b></td>
      <td class="tdbg" width="75%">
      	<input type="radio" value="0" name="AuthorType" checked onClick="Author1.style.display='none';Author2.style.display='none'">不作设置&nbsp;
		<input type="radio" value="1" name="AuthorType" onClick="Author1.style.display='';Author2.style.display='none'">设置标签&nbsp;
		<input type="radio" value="2" name="AuthorType" onClick="Author1.style.display='none';Author2.style.display=''">指定作者</td>
    </tr>
    <tr class="tdbg" id="Author1" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>作者开始标记：</font></strong><p>　</p>
		<p>　</p>
      <strong><font color=blue>作者结束标记：</font></strong></td>
      <td class="tdbg" width="75%">
      <textarea name="AsString" cols="49" rows="7"></textarea><br>
      <textarea name="AoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg" id="Author2" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>请指定作者：</font></strong></td>
      <td class="tdbg" width="75%">
      <input name="AuthorStr" type="text" id="AuthorStr" value="">
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><b>来&nbsp; 源&nbsp;
		设&nbsp; 置：</b></td>
      <td class="tdbg" width="75%">
      	<input type="radio" value="0" name="CopyFromType" checked onClick="CopyFrom1.style.display='none';CopyFrom2.style.display='none'">不作设置&nbsp;
		<input type="radio" value="1" name="CopyFromType" onClick="CopyFrom1.style.display='';CopyFrom2.style.display='none'">设置标签&nbsp;
		<input type="radio" value="2" name="CopyFromType" onClick="CopyFrom1.style.display='none';CopyFrom2.style.display=''">指定来源</td>
    </tr>
    <tr class="tdbg" id="CopyFrom1" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>来源开始标记：</font></strong><p>　</p>
		<p>　</p>
      <strong><font color=blue>来源结束标记：</font></strong></td>
      <td class="tdbg" width="75%">
      <textarea name="FsString" cols="49" rows="7"></textarea><br>
      <textarea name="FoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg" id="CopyFrom2" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>请指定来源：</font></strong></td>
      <td class="tdbg" width="75%">
      <input name="CopyFromStr" type="text" id="CopyFromStr" value="">
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg" ><b>关键字词设置：</b></td>
      <td class="tdbg" width="75%">
      	<input type="radio" value="0" name="KeyType" checked onClick="Key1.style.display='none';Key2.style.display='none'">标题生成&nbsp;
		<input type="radio" value="1" name="KeyType" onClick="Key1.style.display='';Key2.style.display='none'">标签生成&nbsp;
		<input type="radio" value="2" name="KeyType" onClick="Key1.style.display='none';Key2.style.display=''">自定义关键字</td>
    </tr>
    <tr class="tdbg" id="Key1" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>关键词开始标记：</font></strong><p>　</p>
		<p>　</p>
      <strong><font color=blue>关键词结束标记：</font></strong></td>
      <td class="tdbg" width="75%">
      <textarea name="KsString" cols="49" rows="7"></textarea><br>
      <textarea name="KoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg" id="Key2" style="display:none"> 
      <td width="20%" class="tdbg" ><strong><font color=blue>请指定关键：</font></strong></td>
      <td class="tdbg" width="75%">
      <input name="KeyStr" type="text" id="KeyStr" value=""><br>
      格式：关键字之间用<font color=red>|</font>分隔，如：新闻|IT
      </td>
    </tr>
    <tr>
      <td width="20%" class="tdbg"><strong>正文分页设置：</strong></td>
      <td class="tdbg" width="75%">
		<input type="radio" value="0" name="NewsPaingType" checked onClick="NewsPaing1.style.display='none';NewsPaing12.style.display='none';NewsPaing13.style.display='none';NewsPaing2.style.display='none'">不作设置&nbsp;
		<input type="radio" value="1" name="NewsPaingType" onClick="NewsPaing1.style.display='';NewsPaing12.style.display='';NewsPaing13.style.display='';NewsPaing2.style.display='none'">设置标签&nbsp;
		<input type="radio" value="2" name="NewsPaingType" onClick="NewsPaing1.style.display='none';NewsPaing12.style.display='none';NewsPaing13.style.display='none';NewsPaing2.style.display=''">智能设置
	   </td>
    </tr>
	<tr class="tdbg" id="NewsPaing1" style="display:none">
      <td width="20%" class="tdbg"><strong><font color=blue>下页开始标记：</font></strong><p>　</p><p>　</p>
      <strong><font color=blue>下页结束标记：</font></strong></td>
      <td class="tdbg" width="75%">
		<textarea name="NPsString" cols="49" rows="7"></textarea><br>
		<textarea name="NPoString" cols="49" rows="7"></textarea></td>
    </tr>
    <tr class="tdbg" class="tdbg" id="NewsPaing12" style="display:none"> 
      <td width="20%" class="tdbg"><b><font color="#0000FF">分页绝对链接：</font></b></td>
      <td class="tdbg" width="75%">
		<input name="NewsPaingStr" type="text" size="58"><br>
		格式：http://www.aspoo.cn/Article/ArticleShow.asp?ID=1&Page={$ID}
    </tr>
    <tr class="tdbg" class="tdbg" id="NewsPaing13" style="display:'none'"> 
      <td width="20%" class="tdbg"><b><font color="#0000FF">分页链接字符：</font></b></td>
      <td class="tdbg" width="75%">
		<input name="NewsPaingHtml" type="text" size="58" value=""></td>
    </tr>
    <tr class="tdbg" class="tdbg" id="NewsPaing2" style="display:none"> 
      <td width="20%" class="tdbg"><strong><font color=blue>智&nbsp; 能&nbsp; 设&nbsp; 置：</font></strong></td>
      <td class="tdbg" width="75%">
		<input name="NewsPaingStr2" type="text" value="预留功能" size="51">
      </td>
    </tr>

    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
		<input name="Action" type="hidden" id="Action" value="Step5">
        <input name="ItemID" type="hidden" value="<%=ItemID%>"> 
        <input  type="button" name="button1" value="上&nbsp;一&nbsp;步" onClick="window.location.href='javascript:history.go(-1)'" >
        &nbsp;&nbsp;&nbsp;&nbsp; 
        <input  type="submit" name="Submit" value="下&nbsp;一&nbsp;步"></td>
        <input type="hidden" name="UrlTest" id="UrlTest" value="<%=UrlTest%>">
    </tr>
</table>
</form>
<%
End Sub

Sub Step5()
	Dim ItemID
	Dim RsItem,SqlItem
	Dim UrlTest,TsString,ToString,CsString,CoString
	Dim DateType,DsString,DoString,UpDateTime
	Dim AuthorType,AsString,AoString,AuthorStr
	Dim CopyFromType,FsString,FoString,CopyFromStr
	Dim KeyType,KsString,KoString,KeyStr
	Dim NewsPaingType,NPsString,NPoString,NewsPaingStr,NewsPaingHtml
	Dim NewsPaingNext,NewsPaingNextCode,ContentTemp
	Dim NewsUrl,NewsCode
	Dim Title,ConTent,Author,CopyFrom,Key
	Dim UploadFiles,strInstallDir,strChannelDir

	strInstallDir=Trim(request.ServerVariables("SCRIPT_NAME"))
	strInstallDir=left(strInstallDir,instrrev(lcase(strInstallDir),"/")-1)
	strInstallDir=left(strInstallDir,instrrev(lcase(strInstallDir),"/"))
	strChannelDir="Test"

	ItemID=Trim(Request.Form("ItemID"))
	UrlTest=Trim(Request.Form("UrlTest"))
	TsString=Request.Form("TsString")
	ToString=Request.Form("ToString")
	CsString=Request.Form("CsString")
	CoString=Request.Form("CoString")

	DateType=Trim(Request.Form("DateType"))
	DsString=Request.Form("DsString")
	DoString=Request.Form("DoString")

	AuthorType=Trim(Request.Form("AuthorType"))
	AsString=Request.Form("AsString")
	AoString=Request.Form("AoString")
	AuthorStr=Trim(Request.Form("AuthorStr"))

	CopyFromType=Trim(Request.Form("CopyFromType"))
	FsString=Request.Form("FsString")
	FoString=Request.Form("FoString")
	CopyFromStr=Trim(Request.Form("CopyFromStr"))

	KeyType=Trim(Request.Form("KeyType"))
	KsString=Request.Form("KsString")
	KoString=Request.Form("KoString")
	KeyStr=Trim(Request.Form("KeyStr"))

	NewsPaingType=Trim(Request.Form("NewsPaingType"))
	NPsString=Request.Form("NPsString")
	NPoString=Request.Form("NPoString")
	NewsPaingStr=Trim(Request.Form("NewsPaingStr"))
	NewsPaingHtml=Request.Form("NewsPaingHtml")


	If ItemID="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>"
	Else
	   ItemID=Clng(ItemID)
	End If
	If UrlTest="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>参数错误，数据传递时发生错误</li>"
	Else
	   NewsUrl=UrlTest
	End If
	If TsString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>标题开始标记不能为空</li>"
	End If
	If ToString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>标题结束标记不能为空</li>" 
	End If
	If CsString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>正文开始标记不能为空</li>"
	End If
	If CoString="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>正文结束标记不能为空</li>" 
	End If

	If DateType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请设置时间类型</li>" 
	Else
	   DateType=Clng(DateType)
	   If DateType=0 Then
	   ElseIf DateType=1 Then
		  If DsString="" or DoString="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>请将时间的开始/结束标记填写完整</li>" 
		  End If
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>" 
	   End If
	End If

	If AuthorType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请设置作者类型</li>" 
	Else
	   AuthorType=Clng(AuthorType)
	   If AuthorType=0 Then
	   ElseIf AuthorType=1 Then
		  If AsString="" or AoString="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>请将作者的开始/结束标记填写完整</li>" 
		  End If
	   ElseIf AuthorType=2 Then
		  If AuthorStr="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>请指定作者</li>" 
		  End If
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>" 
	   End If 
	End If

	If CopyFromType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请设置来源类型</li>" 
	Else
	   CopyFromType=Clng(CopyFromType)
	   If CopyFromType=0 Then
	   ElseIf CopyFromType=1 Then
		  If FsString="" or FoString="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>请将来源的开始/结束标记填写完整！</li>" 
		  End If
	   ElseIf CopyFromType=2 Then
		  If CopyFromStr="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>请指定来源</li>" 
		  End If
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>" 
	   End If 
	End If

	If KeyType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请设置关键字类型</li>" 
	Else
	   KeyType=Clng(KeyType)
	   If KeyType=0 Then
	   ElseIf KeyType=1 Then
		  If KsString="" or KoString="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>关键字的开始/结束标记不能为空</li>" 
		  End If
	   ElseIf KeyType=2 Then
		  If KeyStr="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>请指定关键字</li>" 
		  End If
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>" 
	   End If
	End If

	If NewsPaingType="" Then
	   FoundErr=True
	   ErrMsg=ErrMsg & "<br><li>请设置新闻分页类型</li>"
	Else
	   NewsPaingType=Clng(NewsPaingType)
	   If NewsPaingType=0 Then
	   ElseIf NewsPaingType=1 Then
		  If NPsString="" or NPoString="" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>分页开始/结束标记不能为空</li>" 
		  End If
		  If NewsPaingStr<>""  And  Len(NewsPaingStr)<15  Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>分页绝对链接设置不正确(留空或者至少15个字符)</li>" 
		  End  If            
	   ElseIf NewsPaingType=2 Then
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>暂不支持手动设置分页类型</li>" 
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>参数错误，请从有效链接进入</li>" 
	   End If
	End If

	If FoundErr<>True Then
	   SqlItem="Select * from Item Where ItemID=" & ItemID
	   Set RsItem=server.CreateObject("adodb.recordset")
	   RsItem.Open SqlItem,ConnItem,2,3

	   RsItem("TsString")=TsString
	   RsItem("ToString")=ToString
	   RsItem("CsString")=CsString
	   RsItem("CoString")=CoString

	   RsItem("DateType")=DateType
	   If DateType=1 Then
		  RsItem("DsString")=DsString
		  RsItem("DoString")=DoString
	   End If

	   RsItem("AuthorType")=AuthorType
	   If AuthorType=1 Then
		  RsItem("AsString")=AsString
		  RsItem("AoString")=AoString
	   ElseIf AuthorType=2 Then
		  RsItem("AuthorStr")=AuthorStr
	   End If

	   RsItem("CopyFromType")=CopyFromType
	   If CopyFromType=1 Then
		  RsItem("FsString")=FsString
		  RsItem("FoString")=FoString
	   ElseIf CopyFromType=2 Then
		  RsItem("CopyFromStr")=CopyFromStr
	   End If

	   RsItem("KeyType")=KeyType
	   If KeyType=1 Then
		  RsItem("KsString")=KsString
		  RsItem("KoString")=KoString
	   ElseIf KeyType=2 Then
		  RsItem("KeyStr")=KeyStr
	   End If

	   RsItem("NewsPaingType")=NewsPaingType
	   If NewsPaingType=1 Then
		  RsItem("NPsString")=NPsString
		  RsItem("NPoString")=NPoString
		  If NewsPaingStr<>"" Then
			 RsItem("NewsPaingStr")=NewsPaingStr
		  End If
		  RsItem("NewsPaingHtml")=NewsPaingHtml       
	   End If
	   RsItem.UpDate
	   RsItem.Close
	   Set RsItem=Nothing
	End If


	If FoundErr<>True Then
	   NewsCode=GetHttpPage(NewsUrl)
	   If NewsCode<>"$False$" Then
		  Title=GetBody(NewsCode,TsString,ToString,False,False)
		  Content=GetBody(NewsCode,CsString,CoString,False,False)
		  If Title="$False$" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>在截取标题的时候发生错误：" & NewsUrl & "</li>"
		  Else
			 Title=HtmlEnCode(Title)
		  End If

		  If Content="$False$" Then
			 FoundErr=True
			 ErrMsg=ErrMsg & "<br><li>在截取正文的时候发生错误：" & NewsUrl & "</li>"
		  Else
			 '新闻分页
			 If NewsPaingType=1 Then
				NewsPaingNext=GetPaing(NewsCode,NPsString,NPoString,False,False)
				Do While NewsPaingNext<>"$False$"
				   If NewsPaingStr="" or Isnull(NewsPaingStr)=True Then
					  NewsPaingNext=DefiniteUrl(NewsPaingNext,NewsUrl)
				   Else
					  NewsPaingNext=Replace(NewsPaingStr,"{$ID}",NewsPaingNext)
				   End If
				   If NewsPaingNext="" or NewsPaingNext="$False$" Then Exit Do
				   NewsPaingNextCode=GetHttpPage(NewsPaingNext)                  
				   ContentTemp=GetBody(NewsPaingNextCode,CsString,CoString,False,False)
				   If ContentTemp="$False$" Then
					  Exit Do
				   Else
					  Content=Content & NewsPaingHtml & ContentTemp
					  NewsPaingNext=GetPaing(NewsPaingNextCode,NPsString,NPoString,False,False)
				   End If
				Loop
			 End If
		  End If
	   Else
		  FoundErr=True
		  ErrMsg=ErrMsg & "<br><li>在获取源码时发生错误："& NewsUrl &"</li>"
	   End If 
	End If

	If FoundErr<>True Then
		  If DateType=0 then
			 UpDateTime=Now()
		  Else
			 UpDateTime=GetBody(NewsCode,DsString,DoString,False,False)
			 UpDateTime=HtmlEnCode(UpDateTime)
			 UpDateTime=Trim(Replace(UpDateTime,"&nbsp;"," "))
			 If IsDate(UpDateTime)=True Then
				UpDateTime=CDate(UpDateTime)
			 Else
				UpDateTime=Now()
			 End If
		  End If

		  If AuthorType=1 Then
			 Author=GetBody(NewsCode,AsString,AoString,False,False)
		  ElseIf AuthorType=2 Then
			 Author=AuthorStr
		  End If
		  If Author="$False$" Or Trim(Author)="" Then
			 Author="佚名"
		  Else
			 Author=HtmlEnCode(Author)
		  End If

		  If CopyFromType=1 Then
			 CopyFrom=GetBody(NewsCode,FsString,FoString,False,False)
		  ElseIf CopyFromType=2 Then
			 CopyFrom=CopyFromStr
		  End If
		  If CopyFrom="$False$" Or Trim(CopyFrom)="" Then
			 CopyFrom="不详"
		  Else
			 CopyFrom=HtmlEnCode(CopyFrom)
		  End If

		  If KeyType=0 Then
			 Key=Title
			 Key=CreateKeyWord(Key,2)
		  ElseIf KeyType=1 Then
			 Key=GetBody(NewsCode,KsString,KoString,False,False)
			 Key=HtmlEnCode(Key)
			 Key=CreateKeyWord(Key,2)
		  ElseIf KeyType=2 Then
			 Key=KeyStr
			 Key=HtmlEnCode(Key)
		  End If
		  If Key="$False$" Or Trim(Key)="" Then
			 Key="创力"
		  End If
	End If

	If FoundErr<>True Then
	   Content=ReplaceSaveRemoteFile(Content,strInstallDir,strChannelDir,False,NewsUrl)
	End If

	If FoundErr=True Then Admin_ShowErr(ErrMsg)
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center" class="topbg"><strong>采&nbsp;&nbsp;集&nbsp;&nbsp;系&nbsp;&nbsp;统&nbsp;&nbsp;项&nbsp;&nbsp;目&nbsp;&nbsp;管&nbsp;&nbsp;理</td>
  </tr>
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="Item_AddNew.asp">添加项目</a> >> <a href="Item_Modify.asp?ItemID=<%=ItemID%>">基本设置</a> >> <a href="Item_Modify.asp?Action=Step2&ItemID=<%=ItemID%>">列表设置</a> >> <a href="Item_Modify.asp?Action=Step3&ItemID=<%=ItemID%>">链接设置</a> >> <a href="Item_Modify.asp?Action=Step4&ItemID=<%=ItemID%>">正文设置</a> >> <font color=red>采样测试</font> >> 属性设置 >> 完成</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"><strong>添 加 新 
		项 目--采 样 测 试</strong></div></td>
    </tr>
</table>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
  <tr align="center" class="tdbg"> 
    <td height="40" colspan="2" valign="bottom"><span lang="zh-cn">
	<font size="5"><%=Title%></span></font></td>
  </tr>
  <tr align="center" class="tdbg">
    <td colspan="2">
        作者：<%=Author%>&nbsp;&nbsp;来源：<%=CopyFrom%>&nbsp;&nbsp;更新时间：<%=UpDateTime%>
    </td>
  </tr>
  <tr class="tdbg">
    <td colspan="2">
      <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="5">
        <tr>
          <td height="200" valign="top"><p><span lang="zh-cn"><%=Content%></span></p><br>
          <b>关键字：<%=key%></b>
          </td>
        </tr>
      </table>
    </td>
  </tr>
<form method="post" action="Item_Attribute.asp" name="form1">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
        <input name="ItemID" type="hidden" value="<%=ItemID%>">
        <input name="button1" type="button" id="Cancel" value=" 上&nbsp;一&nbsp;步 " onClick="window.location.href='javascript:history.go(-1)'">
        &nbsp; 
        <input  type="submit" name="Submit" value="  下&nbsp;一&nbsp;步 "></td>
    </tr>
</table>
</form>
<%
End Sub
%>

