<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*,gbase.db.*" %>
<%@ include file="../checkLogin.jsp" %>
<SCRIPT language="JavaScript" src="../js/util.js"></SCRIPT>
<%
DBOperation theDBOperation = new DBOperation();
String id = request.getParameter("id") == null ? "" :request.getParameter("id");
String sql = "select * from bar_menu where id="+id+"";
ResultSet rs =theDBOperation.getResultSet(sql);
String name=request.getParameter("name") == null ? "" :request.getParameter("name");
String parent_id=request.getParameter("parent_id") == null ? "" :request.getParameter("parent_id");
String menu_type=request.getParameter("menu_type") == null ? "" :request.getParameter("menu_type");
String content_type=request.getParameter("content_type") == null ? "" :request.getParameter("content_type");
String web_template_id=request.getParameter("web_template_id") == null ? "" :request.getParameter("web_template_id");
String web_template_id2=request.getParameter("web_template_id2") == null ? "" :request.getParameter("web_template_id2");
String menu_level=request.getParameter("menu_level") == null ? "" :request.getParameter("menu_level");

%>
<html>
<head>
<title>
</title>
<LINK href="../css/css.css" rel=stylesheet>
</head>
<body leftmargin="0" topmargin="0">
<BR>
<form name="form1" method="post" action="barmenu_modify_save.jsp">
<input name="id" type="hidden" value="<%=id%>">
<input name="menu_level" type="hidden" value="<%=menu_level%>">
<input name="parent_id" type="hidden" value="<%=parent_id%>">
<div align="center">
<table border="0" width="80%" cellspacing="0" cellpadding="0" height="29">
	<tr>
		<td align="left"><B>>>修改栏目</B></td>
		<td align="right">
		<%if((!menu_level.equals("3")) && (!menu_type.equals("1")) && (!menu_type.equals("3"))){%>
		<input name="add" type="button" value="新增子栏目" onclick="window.location='barmenu_add.jsp?parent_id=<%=id%>&menu_level=<%=menu_level%>'">
		<%}%> 
		&nbsp;&nbsp;<input name="delete" type="button" value="删除本栏目" onclick="window.location='barmenu_delete.jsp?id=<%=id%>'"></td> 
	</tr>
</table>
<table width="85%" class="p1" border="0" cellSpacing="1" cellPadding="3" align="center" bgColor="#cccccc">
        <tr>
		<td align="right"  bgColor=#e9f0f4 width="30%">栏目名称：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp; 
			<input name="name" type="text" size="40" maxlength="25" value="<%=name%>">&nbsp;
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4 width="30%">栏目链接：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp; 
			<%if(menu_type.equals("3")){%>
			  index.html
			<%} else {%>
			  bar<%=id%>.html 
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4  width="30%">栏目类型：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp; 
		    <input type="radio" value="0"  name="menu_type">非子栏目&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="1"  name="menu_type" onclick="javaScript:onChange_menu_type();">子栏目	
		</td>
	</tr>
	
	<tr>
		<td align="right"  bgColor=#e9f0f4  width="30%">栏目显示属性：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp; 
	             <select name="content_type" onclick="javaScript:onChange_content_type(this.value);">
                        <option value="">--请选择--</option>
                        <option value="1">栏目介绍</option>
                        <option value="2">标题列表</option>
                        <option value="3">图片列表</option>
                        <option value="4">其他</option>
                     </select>
                     <script>form1.content_type.value='<%=content_type%>';</script>
		</td>
	</tr>
	<tr>
		<td align="right"  bgColor=#e9f0f4  width="30%">采用模板：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp; 
		     <%
	               DBOperation theSelectDBOperation = new DBOperation();
	               String select_sql="select id,title from web_template where web_account='"+web_account+"'";
	               ResultSet select_rs =theSelectDBOperation.getResultSet(select_sql);
                     %>
	             <select name="web_template_id">
                        <option value="">--请选择--</option>
                        <%while(select_rs.next()){%>
	                <option value="<%=select_rs.getString("id")%>"><%=select_rs.getString("title")%></option>
	                <%}%>
                     </select>
                     <script>form1.web_template_id.value='<%=web_template_id%>';</script>
		</td>
	</tr>
	<tr id="dis_template2" style="display:none">
		<td align="right"  bgColor=#e9f0f4  width="30%">内容模板：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>
	             <%
	               DBOperation theSelectDBOperation1 = new DBOperation();
	               String select_sql1="select id,title from web_template where web_account='"+web_account+"'";
	               ResultSet select_rs1 =theSelectDBOperation.getResultSet(select_sql1);
                     %>
	             <select name="web_template_id2">
                        <option value="">--请选择--</option>
                        <%while(select_rs1.next()){%>
	                <option value="<%=select_rs1.getString("id")%>"><%=select_rs1.getString("title")%></option>
	                <%}%>
                     </select>
                </td>
	</tr>
</table>
<BR>
<table border="0" cellpadding="3" class="p1" width="80%" bordercolor="#D7D7D7" align="center" style="border-collapse: collapse" cellspacing="0">
	<tr>
		<td  height="0" align="center">
		      <%if(!id.equals("0")){%>
			<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>
			
		</td>
	</tr>
</table>
<BR><BR>
<table border="0" cellpadding="3" class="p1" width="80%" bordercolor="#D7D7D7"  style="border-collapse: collapse" cellspacing="0">
	<tr>
	  <td  height="0">
	    信息说明：<BR>
	      1、标题列表可以修改每页显示的记录数，<BR>
	      &nbsp;&nbsp;&nbsp;在info.jsp中修改后面的数字即可thePageManager.setPageSize(10);<BR>
	      2、图片列表可以修改每行显示的图片个数和显示的图片行数，<BR>
	        &nbsp;&nbsp;&nbsp;int column_count=3;  //每行显示的图片数，修改左边的数字即可;<BR> 
                &nbsp;&nbsp;&nbsp;int row_count=3;     //每页显示的行数，修改左边的数字即可;     
	  </td>
	</tr>
</table>
</div>
</form>
</body>
<Script Language="javaScript">
    function  get_menu_type()
    {   
        var doc_menu_type=document.getElementsByName("menu_type"); 
        var menu_type="";
        for(var i=0;i<doc_menu_type.length;i++) 
          { 
          if(doc_menu_type[i].checked==true) 
            { 
             menu_type=doc_menu_type[i].value; 
             break; 
            } 
          } 
        return menu_type;
    }
    function  check_validate(theForm) {
        var menu_type=get_menu_type();
        if(isSpace(menu_type)) {
            alert("请选择相应的栏目类型！");
            theForm.menu_type.focus();
            return false;
        }
        if(isSpace(theForm.content_type.value)) {
            alert("请选择相应的栏目显示属性！");
            theForm.content_type.focus();
            return false;
        }
        if(menu_type=='0')
        {
          if(theForm.content_type.value=='2' || theForm.content_type.value=='3')
          {
           alert("非子栏目只能选择'栏目介绍'或'其他'，而不能选择'标题列表'和'图片列表'属性！");
           return false;
          }
        }
        if(isSpace(theForm.web_template_id.value)) {
            alert("请选择相应的采用模板！");
            theForm.web_template_id.focus();
            return false;
        }
        if(theForm.content_type.value=='2' || theForm.content_type.value=='3')
        {
          if(isSpace(theForm.web_template_id2.value))
          {
            alert("请选择相应的内容模板！");
            theForm.web_template_id2.focus();
            return false;
          }
        }
        theForm.submit();
    }
    
    function  onChange_content_type(content_type)
    { 
      if(content_type=='2' || content_type.value=='3')
      {
       document.all.dis_template2.style.display = ""; 
      }
      else
      {
       document.all.dis_template2.style.display = "none"; 
      }
    }
    onChange_content_type('<%=content_type%>');
</Script>

</html>
