<%@language=vbscript codepage=936 %>
<%
'********************************************************
'章采集系统


%>
<%
option explicit
response.buffer=true
%>
<!--#include file="../include/Conn.jsp"-->
<!--#include file="../Article/inc/function.jsp"-->
<!--#include file="admin_islogin.jsp"-->
<%
Dim SqlItem,RsItem,FoundErr,ErrMsg

Dim ItemID,ItemName,WebName,WebUrl,ChannelID,ClassID,LoginType,LoginUrl,LoginPostUrl,LoginUser,LoginPass,LoginFalse,ItemDemo
ItemID=Trim(Request("ItemID"))
If ItemID="" Then
   FoundErr=True
   ErrMsg=ErrMsg & "<br><li>参数错误，项目ID不能为空！</li>"
Else
   ItemID=Clng(ItemID)
End If
If FoundErr<>True Then
   SqlItem ="select ItemID,ItemName,WebName,WebUrl,ChannelID,ClassID,LoginType,LoginUrl,LoginPostUrl,LoginUser,LoginPass,LoginFalse,ItemDemo from Item where ItemID=" & ItemID
   Set RsItem=Server.CreateObject("adodb.recordset")
   RsItem.Open SqlItem,ConnItem,1,1
   If RsItem.Eof And RsItem.Bof  Then
      FoundErr=True
      ErrMsg=ErrMsg & "<br><li>参数错误，没有找到该项目！</li>"
   Else
      ItemName=RsItem("ItemName")
      ItemDemo=RsItem("ItemDemo")
      WebName=RsItem("WebName")
      WebUrl=RsItem("WebUrl")
      ChannelID=RsItem("ChannelID")
      ClassID=RsItem("ClassID")
      LoginType=RsItem("LoginType")
      LoginUrl=RsItem("LoginUrl")
      LoginPostUrl=RsItem("LoginPostUrl")
      LoginUser=RsItem("LoginUser")
      LoginPass=RsItem("LoginPass")
      LoginFalse=RsItem("LoginFalse")
   End If
   RsItem.Close
   Set RsItem=Nothing
End If

If FoundErr=True Then
   Call WriteErrMsg(ErrMsg)
Else
   Call Main()
End If
'关闭数据库链接
Call CloseDatabase()
Call CloseConnItem()
%>
<%Sub Main%>
<html>
<head>
<title>采集系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<%Call SetChannel()%>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr> 
    <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="Admin_ItemModify.jsp?ItemID=<%=ItemID%>"><font color=red>基本设置</font></a> >> <a href="Admin_ItemModify2.jsp?ItemID=<%=ItemID%>">列表设置</a> >> <a href="Admin_ItemModify3.jsp?ItemID=<%=ItemID%>">链接设置</a> >> <a href="Admin_ItemModify4.jsp?ItemID=<%=ItemID%>">正文设置</a> >>  
	<a href="Admin_ItemModify5.jsp?ItemID=<%=ItemID%>">采样测试</a> >> <a href="Admin_ItemAttribute.jsp?ItemID=<%=ItemID%>">属性设置</a> >> 完成</td>         
  </tr>         
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
<form method="post" action="Admin_ItemModify2.jsp" 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" value="<%=ItemName%>">&nbsp;&nbsp;<font color=red>*</font>如：新浪网－新闻中心 既简单又明了 
      </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(ChannelID)%></select>
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="20%" class="tdbg"><strong> 所属栏目：</strong></td>
      <td class="tdbg" width="75%"><select name="ClassID" ID="ClassID"><%call Admin_ShowClass_Option(ChannelID,ClassID)%></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" value="<%=WebName%>">
      </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" value="<%=WebUrl%>">
      </td>
    </tr>
   <tr class="tdbg"> 
      <td width="150" class="tdbg"><strong> 网站登录：</strong></td>
      <td class="tdbg">
		<input type="radio" value="0" name="LoginType" <%if LoginType=0 Then Response.Write "checked"%> onClick="Login.style.display='none'">不需要登录<span lang="en-us">&nbsp;
		</span>
		<input type="radio" value="1" name="LoginType" <%if LoginType=1 Then Response.Write "checked"%> onClick="Login.style.display=''">设置参数

      </td>
    </tr>
   <tr class="tdbg" id="Login" style="<%If LoginType=0 Then Response.write "display:none"%>"> 
      <td width="150" class="tdbg"><strong> 登录参数：</strong></td>
      <td class="tdbg">
        登录地址：<input name="LoginUrl" type="text" size="40" maxlength="150" value="<%=LoginUrl%>"><br>
        提交地址：<input name="LoginPostUrl" type="text" size="40" maxlength="150" value="<%=LoginPostUrl%>"><br>
        用户参数：<input name="LoginUser" type="text" size="30" maxlength="150" value="<%=LoginUser%>"><br>
        密码参数：<input name="LoginPass" type="text" size="30" maxlength="150" value="<%=LoginPass%>"><br> 
		失败信息：<input name="LoginFalse" type="text" size="30" maxlength="150" value="<%=LoginFalse%>"></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"><%=ItemDemo%></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
        <input name="ItemID" type="hidden" id="ItemID" value="<%=ItemID%>">
        <input name="Action" type="hidden" id="Action" value="SaveEdit">
        <input name="Cancel" type="button" id="Cancel" value=" 返&nbsp;&nbsp;回 " onClick="window.location.href='Admin_ItemStart.jsp'" style="cursor: hand;background-color: #cccccc;">
        &nbsp; 
        <input  type="submit" name="Submit" value="下&nbsp;一&nbsp;步" style="cursor: hand;background-color: #cccccc;"></td>
    </tr>
</form>
</table>

</body>         
</html>
<%End  Sub%>
<%
Sub SetChannel
Dim Arr_Channel,i_Channel,i_Class,i_Special,tmpDepth,i,ArrShowLine(20)
Dim Rs,Sql,ClassID,ClassName,SpecialID,SpecialName
Set Rs=server.createobject("adodb.recordset")
Sql = "select F_ID from T_BigCategory order by F_Grade ASC"
Rs.Open Sql,Conn,1,1
If Not Rs.Eof Then
   Arr_Channel=Rs.GetRows()
End If
Rs.Close
Set Rs=Nothing

If Isarray(Arr_Channel)= True then
   i_Class=0
   i_Special=0
   For i=0 To Ubound(ArrShowLine)
      ArrShowLine(i)=False
   Next
%>
<script language = "JavaScript">
var count_class;
arr_class = new Array();
<%
   For i_Channel=0 To Ubound(Arr_Channel,2)
      Set Rs=server.createobject("adodb.recordset")
      Sql = "select * from T_SmallCategory where F_BigCategoryID=" & Arr_Channel(0,i_Channel) & ""
      Rs.Open Sql,Conn,1,1
%>
arr_class[<%=i_Class%>] = new Array("<%=Arr_Channel(0,i_Channel)%>","0","请选择栏目");
<%
      i_Class=i_Class+1
      If Not Rs.Eof Then
         Do While Not Rs.Eof
            ClassName="" 
			ClassID=Rs("F_ID")
			ClassName=ClassName & Rs("F_Value")
	%>
	arr_class[<%=i_Class%>] = new Array("<%=Arr_Channel(0,i_Channel)%>","<%=ClassID%>","<%=ClassName%>");
	<%
				i_Class = i_Class + 1
				Rs.MoveNext
         Loop
      End if
      Rs.Close
      Set Rs=Nothing

%>
<% 
   Next
%>
count_class=<%=i_Class%>;

function changelocation(locationid)
    {
    document.myform.ClassID.length = 0; 
    var locationid=locationid;
    var i;
    for (i=0;i < count_class; i++)
        {
            if (arr_class[i][0] == locationid)
            { 
                document.myform.ClassID.options[document.myform.ClassID.length] = new Option(arr_class[i][2], arr_class[i][1]);
            }        
        }
    }    
</script>
<%
End if
End sub
%>
