<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*,gbase.db.*,gbase.init.*,org.apache.log4j.MDC" %>
<%@ include file="../checkLogin.jsp" %>
<SCRIPT language="JavaScript" src="../js/util.js"></SCRIPT>
<LINK href="../css/css.css" rel=stylesheet>
<%
WebConfig theWebConfig=WebConfig.getInstance();
String new_web_url=theWebConfig.getWeb_url();
String new_web_ip=theWebConfig.getIp();
DBOperation theDBOperation = new DBOperation();

String action = request.getParameter("action")==null?"":request.getParameter("action");
String web_id="";
String web_name="";
String web_url="";
String web_type="";
String web_keywords="";
String web_description="";
String web_user_type="";
String web_enterprise_name="";
String web_enterprise_address="";
String web_contacter_name="";
String web_contacter_telno="";
String web_contacter_email="";
String web_contacter_qq="";
String web_jive_flag="";
String web_jive_desc="";
String real_url="";

if(action.equals("update") || action.equals("view"))
{
String sql = "select * from web_info  where web_account='"+web_account+"'";
ResultSet rs =theDBOperation.getResultSet(sql);
if(rs.next())
{
web_id=rs.getString("web_id")==null?"":rs.getString("web_id");
web_name=rs.getString("web_name")==null?"":rs.getString("web_name");
System.out.println("web_name:"+web_name);
web_url=rs.getString("web_url")==null?"":rs.getString("web_url");
web_type=rs.getString("web_type")==null?"":rs.getString("web_type");
web_keywords=rs.getString("web_keywords")==null?"":rs.getString("web_keywords");
web_description=rs.getString("web_description")==null?"":rs.getString("web_description");
web_user_type=rs.getString("web_user_type")==null?"":rs.getString("web_user_type");
web_enterprise_name=rs.getString("web_enterprise_name")==null?"":rs.getString("web_enterprise_name");
web_enterprise_address=rs.getString("web_enterprise_address")==null?"":rs.getString("web_enterprise_address");
web_contacter_name=rs.getString("web_contacter_name")==null?"":rs.getString("web_contacter_name");
web_contacter_telno=rs.getString("web_contacter_telno")==null?"":rs.getString("web_contacter_telno");
web_contacter_email=rs.getString("web_contacter_email")==null?"":rs.getString("web_contacter_email");
web_contacter_qq=rs.getString("web_contacter_qq")==null?"":rs.getString("web_contacter_qq");
web_jive_flag=rs.getString("web_jive_flag")==null?"":rs.getString("web_jive_flag");
web_jive_desc=rs.getString("web_jive_desc")==null?"":rs.getString("web_jive_desc");
real_url=rs.getString("real_url")==null?"":rs.getString("real_url");
}
}
%>
<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>
<!--标题-->
  <div align="center">
   <table border="0" width="100%" cellspacing="0" cellpadding="0" height="34">
	<tr>
		<td width="159" background="../images/back_board2.gif" nowrap valign="bottom"><span class="title01">&nbsp;<span class="style1">新增/修改网站资料</span></span></td>
		<td valign="bottom" align="right" width="642"></td>
	</tr>
	<tr>
		<td bgcolor="#2C9CC4" colspan="2"><img border="0" src="../images/bline_3.gif" width="1" height="2"></td>
	</tr>
</table>
</div><br>
<form name="form1" method="post" action="web_info_save.jsp">
<input name="action" type="hidden" value="<%=action%>">
<input name="web_account" type="hidden" value="<%=web_account%>">
<input name="old_web_url" type="hidden" value="<%=web_account%>">
<table width="92%" class="p1" border="0" cellSpacing="1" cellPadding="3" align="center" bgColor="#cccccc">
        <tr>
		<td align="right"  bgColor=#e9f0f4 width=121">网站帐号：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<%=web_account%>
                </td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>网站名称：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_name" type="text" size="50" maxlength="25" value=<%=web_name%>>&nbsp;
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>首页网页标题：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_enterprise_name" type="text" size="50" maxlength="25" value="<%=web_enterprise_name%>">&nbsp;
		</td>
	</tr>
        <tr>
		<td align="right"  bgColor=#e9f0f4 width=150">网站域名：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_url" type="text" size="50" maxlength="50" value="<%=web_url%>">&nbsp;如：http://www.java114.com<BR>
			&nbsp;&nbsp;如果你还没域名,网站域名可以为空，采用免费的二级域名访问(二级域名为：http://网站帐号<%=new_web_url%>)；如果是采用自己的域名时，请把域名解析到ip:<%=new_web_ip%>
                </td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>网站logo：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
		   <input id="real_url" name="real_url" size=50 readonly="true" value="<%=real_url%>">&nbsp;<input type=button value='从本地上传' onclick="javascript: openWin('../htmledit/html/upload_pic2.htm','450','150');">&nbsp;
		   <BR>&nbsp;&nbsp;如果为空时，系统将采用默认的logo图片。
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>网站类型：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
		     <%
	               DBOperation theSelectDBOperation = new DBOperation();
	               String select_sql = "select * from web_type ";
                       ResultSet select_rs =theSelectDBOperation.getResultSet(select_sql);
	             %>
	             <select name="web_type">
                        <option value="">--请选择--</option>
                        <%while(select_rs.next()){%>
	                <option value="<%=select_rs.getString("type_id")%>"><%=select_rs.getString("type_name")%></option>
	                <%}%>
	             </select>
	             <script>form1.web_type.value='<%=web_type%>';</script>
                </td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>网站META关键词：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_keywords" type="text" size="100" maxlength="200" value="<%=web_keywords%>">&nbsp;<BR>
			&nbsp;&nbsp;针对搜索引擎设置的关键词,例如：网站,门户,新闻;快讯多个关键词请用,号分隔,不能带"与'号。
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>网站META网页描述：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_description" type="text" size="100" maxlength="100" value="<%=web_description%>">&nbsp;<BR>
			&nbsp;&nbsp;针对搜索引擎设置的网页描述,例如：网站,门户,新闻;快讯多个关键词请用,号分隔,不能带"与'号。
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>论坛标志：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
		    &nbsp;<input type="radio" value="0"  name="web_jive_flag" onclick="web_jive_flag_change(this.value)">不创建论坛 
		    &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="1"  name="web_jive_flag" onclick="web_jive_flag_change(this.value)">创建论坛
		    <script>RadioChecked('web_jive_flag','<%=web_jive_flag%>')</script>
		</td>
	</tr>
	<tr id="web_jive_desc" style="display:none">
		<td align="right"  bgColor=#e9f0f4>论坛描述：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_jive_desc" type="text" size="100" maxlength="200" value="<%=web_jive_desc%>">&nbsp;
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>联系人：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_contacter_name" type="text" size="50" maxlength="25" value="<%=web_contacter_name%>">&nbsp;
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>联系人电话：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_contacter_telno" type="text" size="50" maxlength="25" value="<%=web_contacter_telno%>">&nbsp;
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>联系人Email：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_contacter_email" type="text" size="50" maxlength="25" value="<%=web_contacter_email%>"><BR>&nbsp;<BR>&nbsp;请留真实Email，以便忘记密码时使用Email取回密码；或者有最新信息时，网站能及时联系到你。
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>联系人QQ：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<input name="web_contacter_qq" type="text" size="50" maxlength="25" value="<%=web_contacter_qq%>">&nbsp;
		</td>
	</tr>
</table>

<table border="0" cellpadding="3" class="p1" width="90%" bordercolor="#D7D7D7" style="border-collapse: collapse" cellspacing="0">
	<tr>
		<td width="30%" align="right">　</td>
		<td width="70%" height="0">
		        <%if(!action.equals("view")){%>
			<img border="0" src="../images/btn/confirm.gif"  onclick = "check_validate(document.form1)" style="cursor:hand">
			<A href="javascript:document.form1.reset();"><IMG src="../images/btn/reset.gif" border=0></A>
			<%}%>
			<A href="javascript:history.back();"><IMG src="../images/btn/back.gif"  border=0></A>
		</td>
	</tr>
</table>

</form>
</body>
<Script Language="javaScript">
    function  web_jive_flag_change(theValue) {
        if (theValue==1)
           {
           document.getElementById("web_jive_desc").style.display="block";
           }
        else
           {
           document.getElementById("web_jive_desc").style.display="none";
           }
        }
    web_jive_flag_change('<%=web_jive_flag%>');      
    function  check_validate(theForm) {
        if (isSpace(theForm.web_name.value)) {
            alert("网站名称不能为空！");
            theForm.web_name.focus();
            return false;
        }
        if (isSpace(theForm.web_url.value)) {
        }
        else
        {
        url=theForm.web_url.value.replace("http://","")
	re = /^([a-zA-Z0-9-]+\.)+(com|cn|net|biz|name|info|tv|org|cc|net.cn|com.cn|org.cn|ch|us|de|hk|com.hk|)$/
        if(!re.test(url)){
          alert('网站域名不是域名!'); 
          return false
        }
        }
        if (isSpace(theForm.web_type.value)) {
            alert("请选择网站类型！");
            theForm.web_type.focus();
            return false;
        }
        if (isSpace(getRadioValue('web_jive_flag'))) {
            alert("请选择论坛标志！");
            //theForm.web_jive_flag.focus();
            return false;
        }
        if (isSpace(theForm.web_contacter_email.value)) {
            alert("联系人Email不能为空！");
            theForm.web_contacter_email.focus();
            return false;
        }
        theForm.submit();
    }
    
</Script>
<script language="javascript">
function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
function openWin (path ,w ,h) {
	var feature = "" ;
	var winWidth = 300;
	var winHeight =200 ;
	if ( w != "" ){
		winWidth = w ;
	}
	if ( h != "" ){
		winHeight = h ;	
	}
	var left = (window.screen.width - winWidth )/2;
	var top = (window.screen.height - winHeight)/2;
	feature += "height=";
	feature += winHeight ;
	feature += ",width=";
	feature += winWidth;
	feature += ",left=";
	feature += left ;
	feature += ",top=";
	feature += top;
	window.open (path,"",feature);
}
</script>
</html>
