<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*,gbase.db.*" %>
<%@ include file="../checkLogin.jsp" %>
<SCRIPT language="JavaScript" src="../js/util.js"></SCRIPT>
<LINK href="../css/css.css" rel=stylesheet>
<SCRIPT language=JavaScript>
var tID=0;
function ShowTabs(ID){
  if(ID!=tID){
    TabTitle[tID].className='title5';
    TabTitle[ID].className='title6';
    Tabs[tID].style.display='none';
    Tabs[ID].style.display='';
    tID=ID;
  }
}
</SCRIPT>
<%
DBOperation theDBOperation = new DBOperation();

String id = request.getParameter("id") == null ? "" :request.getParameter("id");
String action = request.getParameter("action") == null ? "" :request.getParameter("action");
String itemname="";    
String bar_id="";    
String webname="";    
String listurl="";    
String web_encoding="0";    
String itemdoem="";    
String logintype="0";    
String loginurl="";    
String loginposturl="";    
String inputloginuser="";    
String loginuser="";    
String inputloginpass="";    
String loginpass="";    
String loginfalse="";    

if(action.equals("update") || action.equals("view"))
{
String sql = "select * from web_collection  where id="+id+"";
ResultSet rs =theDBOperation.getResultSet(sql);
if(rs.next())
{
itemname=rs.getString("itemname")==null?"":rs.getString("itemname");
bar_id=rs.getString("bar_id")==null?"":rs.getString("bar_id");
webname=rs.getString("webname")==null?"":rs.getString("webname");
listurl=rs.getString("listurl")==null?"":rs.getString("listurl");
web_encoding=rs.getString("web_encoding")==null?"0":rs.getString("web_encoding");
itemdoem=rs.getString("itemdoem")==null?"":rs.getString("itemdoem");
logintype=rs.getString("logintype")==null?"0":rs.getString("logintype");
loginurl=rs.getString("loginurl")==null?"":rs.getString("loginurl");
loginposturl=rs.getString("loginposturl")==null?"":rs.getString("loginposturl");
inputloginuser=rs.getString("inputloginuser")==null?"":rs.getString("inputloginuser");
loginuser=rs.getString("loginuser")==null?"":rs.getString("loginuser");
inputloginpass=rs.getString("inputloginpass")==null?"":rs.getString("inputloginpass");
loginpass=rs.getString("loginpass")==null?"":rs.getString("loginpass");
loginfalse=rs.getString("loginfalse")==null?"":rs.getString("loginfalse");
}
}
%>
<html>
<head>
<title>
采编项目管理
</title>
</head>
<body leftmargin="0" topmargin="0">

<!--导航-->
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
		<td width="100%" height="20"  bgcolor="#eeeeee" class="p2">您当前所在的位置>>采编项目管理</td>
	   </tr>
       <tr>
          <td width="100%" height="2"> <img border="0" src="../images/spacer.gif" width="1" height="3"></td>
       </tr>
    </table>
<!--标题-->
<BR>
&nbsp;&nbsp;采编项目设置步骤：
<%if(action.equals("update")){%> 
<A href="web_collection_content1.jsp?action=update&id=<%=id%>"><FONT color=red>基本设置</FONT></A> 
&gt;&gt; <A href="web_collection_content2.jsp?action=update&id=<%=id%>">列表设置</A> 
&gt;&gt; <A href="web_collection_content3.jsp?action=update&id=<%=id%>">正文设置</A> 
&gt;&gt; 采样测试 
<%} else {%>
<A href="web_collection_content1.jsp"><FONT color=red>基本设置</FONT></A> 
&gt;&gt; 列表设置 
&gt;&gt; 正文设置 
&gt;&gt; 采样测试 
<%}%>
&gt;&gt; 完成设置<BR><BR>

<div align="center">
   <table border="0" width="100%" cellspacing="0" cellpadding="0" height="28">
	<tr align=middle height=24>
	        <td valign="bottom" align="right" width="7"></td>
		<TD class=title6 id=TabTitle onclick=ShowTabs(0) width="60">基本设置</TD>
                <TD class=title5 id=TabTitle onclick=ShowTabs(1) width="60">登录设置</TD>
		<td valign="bottom" align="right"></td>
	</tr>
	<tr>
		<td bgcolor="#2C9CC4" colspan="4"><img border="0" src="../images/bline_3.gif" width="1" height="4"></td>
	</tr>
</table>
</div><br>

<FORM name=form1 action="web_collection_save1.jsp" method=post>
<input name="action" type="hidden" value="<%=action%>">
<input name="id" type="hidden" value="<%=id%>">
<table width="85%" class="p1" border="0" cellSpacing="1" cellPadding="3" align="center" bgColor="#cccccc">
        <TBODY id=Tabs>
        <TR>
          <TD align="right"  bgColor=#e9f0f4 width=120>项目名称：&nbsp;</TD>
          <TD onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
          <INPUT  maxLength=30 size=30  name=itemname value="<%=itemname%>">&nbsp;<FONT color=red>*</FONT></TD></TR>
        <tr>
	  <TD align="right"  bgColor=#e9f0f4 width=120>采编栏目：&nbsp;</TD>	
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
	             <%
	               DBOperation theSelectDBOperation = new DBOperation();
	               String select_sql = "select * from bar_menu where content_type='2' and web_account='"+web_account+"'";
                       ResultSet select_rs =theSelectDBOperation.getResultSet(select_sql);
	             %>
	             <select name="bar_id">
                        <option value="">--请选择--</option>
                        <%while(select_rs.next()){%>
	                <option value="<%=select_rs.getString("id")%>"><%=select_rs.getString("name")%></option>
	                <%}%>
	             </select>
                     <script>form1.bar_id.value='<%=bar_id%>';</script>
		</td>
	</tr>
        <TR>
          <TD align="right"  bgColor=#e9f0f4 width=120>网站名称：&nbsp;</TD>
          <TD onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
          <INPUT  maxLength=30 size=30 name=webname value="<%=webname%>"> &nbsp;<FONT color=red>*</FONT></TD></TR>
          <TR>
          <TD align="right"  bgColor=#e9f0f4 width=120>列表页URL：&nbsp;</TD>
          <TD onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
          <INPUT  maxLength=200 size=80 name=listurl value="<%=listurl%>"> &nbsp;
          <BR><FONT  color=blue>例如：http://www.powereasy.net/News/ShowClass.asp?ClassID=2</FONT></TD></TR>
        <TR>
          <TD align="right"  bgColor=#e9f0f4 width=120>网页编码：&nbsp;</TD>
          <TD onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
          <INPUT type=radio CHECKED value=GBK name=web_encoding> GBK 
          <INPUT type=radio value=UTF-8 name=web_encoding> UTF-8 
          <INPUT type=radio value=Big5  name=web_encoding> Big5&nbsp;
          <FONT color=red>*</FONT> </TD></TR>
        <TR>
          <TD align="right"  bgColor=#e9f0f4 width=120>项目备注：&nbsp;</TD>
          <TD  onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
          <TEXTAREA  name=itemdoem  rows=4 cols=70><%=itemdoem%></TEXTAREA> 
          </TD></TR></TBODY>
        <TBODY id=Tabs style="DISPLAY: none">
        <TR class=tdbg>
          <TD align="right"  bgColor=#e9f0f4 width=120>网站登录：</TD>
          <TD  onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
          <INPUT onclick="onChange_logintype(this.value)" type=radio  CHECKED value=0 name=logintype>不需要登录
          <INPUT  onclick="onChange_logintype(this.value)" type=radio value=1 name=logintype>设置参数 
          <FONT style="FONT-SIZE: 12px"  color=blue>（只有在对方网站没有开启登录验证码功能时，才能进行登录采集）</FONT> 
        </TD></TR>
        
              <TR id=Login1 style="DISPLAY: none">
                <TD align="right"  bgColor=#e9f0f4 width=120>登录地址：</TD>
                <TD onmouseover='vbscript:me.bgcolor="#F5F5F5"' onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
                <INPUT maxLength=150 size=40   name=loginurl></TD></TR>
              <TR id=Login2 style="DISPLAY: none">
                <TD align="right"  bgColor=#e9f0f4 width=120>提交地址：</TD>
                <TD  onmouseover='vbscript:me.bgcolor="#F5F5F5"' onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
                <INPUT maxLength=150 size=40  name=loginposturl></TD></TR>
              <TR id=Login3 style="DISPLAY: none">
                <TD align="right"  bgColor=#e9f0f4 width=120>用户参数：</TD>
                <TD  onmouseover='vbscript:me.bgcolor="#F5F5F5"' onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
                用户文本框名称：<INPUT maxLength=150 size=10   name=inputloginuser> 
                用户名称：<INPUT maxLength=150 size=10  name=loginuser></TD></TR>
              <TR id=Login4 style="DISPLAY: none">
                <TD align="right"  bgColor=#e9f0f4 width=120>密码参数：</TD>
                <TD  onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
                密码文本框名称：<INPUT maxLength=150 size=10  name=inputloginpass> 
                用户密码：<INPUT maxLength=150 size=10  name=loginpass> </TD></TR>
              <TR id=Login5 style="DISPLAY: none">
                <TD  align="right"  bgColor=#e9f0f4 width=120>失败信息：</TD>
                <TD  onmouseover='vbscript:me.bgcolor="#F5F5F5"' onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
                <INPUT maxLength=150 size=30  name=loginfalse></TD></TR>
            </TBODY></TABLE><BR>
<CENTER>
<INPUT id=ItemID type=hidden value=2 name=ItemID> 
<INPUT id=NeedSave type=hidden value=True name=NeedSave> 
<INPUT id=Action type=hidden value=Step2 name=Action> 
<input type="button" value="重  填" onclick = "document.form1.reset();">&nbsp;&nbsp; 
<INPUT type=button   value="下一步" name=next1 onclick = "javascript: if(check_validate(this.form)){this.form.submit();}"></TD> 
</CENTER>
</FORM>
</body>
<Script Language="javaScript">
    function  check_validate(theForm) {
        if (isSpace(theForm.itemname.value)) {
            alert("项目名称不能为空！");
            theForm.itemname.focus();
            return false;
        }
        if (isSpace(theForm.bar_id.value)) {
            alert("请选择所属栏目！");
            theForm.bar_id.focus();
            return false;
        }
        if (isSpace(theForm.listurl.value)) {
            alert("列表页URL不能为空！");
            theForm.listurl.focus();
            return false;
        }
        if(getRadioValue('logintype')=='1')
        {
          if (isSpace(theForm.loginurl.value)) {
            alert("登录地址不能为空！");
            theForm.loginurl.focus();
            return false;
          }
          if (isSpace(theForm.loginposturl.value)) {
            alert("提交地址不能为空！");
            theForm.loginposturl.focus();
            return false;
          }
          if (isSpace(theForm.inputloginuser.value)) {
            alert("用户参数的用户文本框名称不能为空！");
            theForm.inputloginuser.focus();
            return false;
          }
          if (isSpace(theForm.loginuser.value)) {
            alert("用户参数的用户名称不能为空！");
            theForm.loginuser.focus();
            return false;
          }
          if (isSpace(theForm.inputloginpass.value)) {
            alert("用户参数的密码文本框名称不能为空！");
            theForm.inputloginpass.focus();
            return false;
          }
          if (isSpace(theForm.loginpass.value)) {
            alert("用户参数的用户密码不能为空！");
            theForm.loginpass.focus();
            return false;
          }
        }
        return true;
    }
    function  onChange_logintype(logintype_value)
    { if(logintype_value=='0')
      {
      Login1.style.display='none';
      Login2.style.display='none';
      Login3.style.display='none';
      Login4.style.display='none';
      Login5.style.display='none';
      }
      else
      {
      Login1.style.display='';
      Login2.style.display='';
      Login3.style.display='';
      Login4.style.display='';
      Login5.style.display='';
      }
    }
    function  modify_init(web_encoding,logintype)
    { 
        RadioChecked('web_encoding',web_encoding);  
        RadioChecked('logintype',logintype);  
        onChange_logintype(logintype);
    }      
    modify_init('<%=web_encoding%>','<%=logintype%>');
    
</Script>
</html>
