<%@ 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 rel="stylesheet" href="../js/calendar.css" type="text/css">
<SCRIPT Language="JavaScript" src="../js/simpleCalendar.js"></SCRIPT>
<LINK href="../css/css.css" rel=stylesheet>
<%
DBOperation theDBOperation = new DBOperation();

String id = request.getParameter("id") == null ? "" :request.getParameter("id");
String action = request.getParameter("action") == null ? "" :request.getParameter("action");
String link_name="";
String link_url="";
String link_desc="";
String start_date="";
String end_date="";
String link_order="1";
String open_method="";
String dis_location="";
String link_state="";
String create_date="";
if(action.equals("update") || action.equals("view"))
{
String sql = "select * from web_link  where id="+id+"";
ResultSet rs =theDBOperation.getResultSet(sql);
if(rs.next())
{
link_name=rs.getString("link_name")==null?"":rs.getString("link_name");
link_url=rs.getString("link_url")==null?"":rs.getString("link_url");
link_desc=rs.getString("link_desc")==null?"":rs.getString("link_desc");
start_date=rs.getString("start_date")==null?"":rs.getString("start_date");
end_date=rs.getString("end_date")==null?"":rs.getString("end_date");
link_order=rs.getString("link_order")==null?"":rs.getString("link_order");
open_method=rs.getString("open_method")==null?"":rs.getString("open_method");
dis_location=rs.getString("dis_location")==null?"":rs.getString("dis_location");
link_state=rs.getString("link_state")==null?"":rs.getString("link_state");
create_date=rs.getString("create_date")==null?"":rs.getString("create_date");
}
}
%>
<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_link_save.jsp">
<input name="action" type="hidden" value="<%=action%>">
<input name="id" type="hidden" value="<%=id%>">
<div align="center">
<table width="85%" class="p1" border="0" cellSpacing="1" cellPadding="3" align="center" bgColor="#cccccc">
        
	<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="link_name" type="text" size="50" maxlength="25" value="<%=link_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="link_url" type="text" size="50" maxlength="120" value="<%=link_url%>">&nbsp;
                </td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4>链接描述：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
			<TEXTAREA name=link_desc rows=5 cols=80><%=link_desc%></TEXTAREA>
		</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="text" name="start_date" size="12" readonly="true" value="<%=start_date%>">
	                <img src="../images/dater.gif" width="34" height="21" align="absmiddle" onClick="g_Calendar.show(event,'form1.start_date',true,'yyyy-mm-dd'); return false;"> &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="text" name="end_date" size="12" readonly="true" value="<%=end_date%>">
	                <img src="../images/dater.gif" width="34" height="21" align="absmiddle" onClick="g_Calendar.show(event,'form1.end_date',true,'yyyy-mm-dd'); return false;"> &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 name="link_order" type="text" size="5" maxlength="5" value="<%=link_order%>">&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="首页"  name="dis_location" checked=true>首页&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="内页"  name="dis_location">内页	
		</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="新窗口"  name="open_method"  checked=true>新窗口&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="原窗口"  name="open_method">原窗口	
		</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="启用"  name="link_state"  checked=true>启用&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="禁用"  name="link_state">禁用	
		</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>
</div>
</form>
</body>
<Script Language="javaScript">
    function  check_validate(theForm) {
        if (isSpace(theForm.link_name.value)) {
            alert("链接名称不能为空！");
            theForm.link_name.focus();
            return false;
        }
        if (isSpace(theForm.link_url.value)) {
            alert("链接地址不能为空！");
            theForm.link_url.focus();
            return false;
        }
        if (isSpace(theForm.start_date.value)) {
            alert("开始时间不能为空！");
            theForm.start_date.focus();
            return false;
        }
        if (isSpace(theForm.end_date.value)) {
            alert("结束时间不能为空！");
            theForm.end_date.focus();
            return false;
        }
        if (isSpace(theForm.link_order.value) || (!isNum(theForm.link_order.value))) {
            alert("排列顺序不能为空,并且必须是正整数！");
            theForm.link_order.focus();
            return false;
        }
        theForm.submit();
    }
    function  modify_init(open_method,dis_location,link_state)
    { 
        var doc_open_method=document.getElementsByName("open_method"); 
        for(var i=0;i<doc_open_method.length;i++) 
          { 
          if(doc_open_method[i].value==open_method) 
            {
             doc_open_method[i].checked=true
             break; 
            } 
          }
       var doc_dis_location=document.getElementsByName("dis_location"); 
        for(var i=0;i<doc_dis_location.length;i++) 
          { 
          if(doc_dis_location[i].value==dis_location) 
            {
             doc_dis_location[i].checked=true
             break; 
            } 
          }
       var doc_link_state=document.getElementsByName("link_state"); 
        for(var i=0;i<doc_link_state.length;i++) 
          { 
          if(doc_link_state[i].value==link_state) 
            {
             doc_link_state[i].checked=true
             break; 
            } 
          }
     }      
   modify_init('<%=open_method%>','<%=dis_location%>','<%=link_state%>')
</Script>
</html>
