<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="gbase.menu.*"%>
<%@ page import="java.sql.*,gbase.db.*,gbase.menu.*" %>
<%@ include file="../checkLogin.jsp" %>
<html>
<head>
<title>
角色管理
</title>
</head>
<LINK href="../css/css.css" rel=stylesheet>
<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;&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>
<%
String role_id=request.getParameter("ROLE_ID")==null?request.getParameter("role_id"):(String)request.getParameter("ROLE_ID");
//out.print(role_id);
String role_name=request.getParameter("ROLE_NAME")==null?request.getParameter("role_name"):(String)request.getParameter("ROLE_NAME");
DBOperation theDBOperation1 = new DBOperation();
String sql1 = "select * from web_role where role_id="+role_id+"";
ResultSet rs1 =theDBOperation1.getResultSet(sql1);
if(rs1.next())role_name=rs1.getString("role_name");

%>
<div align="center">
<table width="90%" border="0">
  <tr> 
    <td><strong>为角色“<%=role_name%>”设置权限</strong></td>
  </tr>
</table>
</div>
<script language="JavaScript1.2">
	function formcheck1(max){
	        var flag="false";
	        var frm = document.frames;
		form1.rowCount.value=frm(0).menutree.rowCount.value;
		for(var i=0;i<max;i++)
		{
		eval("flag=frm(0).menutree.menu_id"+i+".checked;");
		if(flag==true)
   		eval("form1.menu_id"+i+".value=frm(0).menutree.menu_id"+i+".value;");
   		}
   		form1.submit();
	}
</script>
<form name="form1" method="post" action="role_menu_modify_save.jsp">
  <%
  String record[][]=null;
  WebMenuTree theMenuTree=new WebMenuTree();
  //UserLogin theUserLogin=(UserLogin)session.getAttribute("UserLogin");
  //String user_id=theUserLogin.getUser_id();
  String user_id=session.getAttribute("user_id")==null?"":(String)session.getAttribute("user_id");
  record=theMenuTree.getRoleMenuTree(user_id);
  for(int i=0;i<record.length;i++){
  %>
  <input name="menu_id<%=i%>" type="hidden" value="">
  <%
  }
  %>
  <input name="rowCount" type="hidden" value="<%=record.length%>">
  <input name="role_id" type="hidden" value="<%=role_id%>">
  <input name="role_name" type="hidden" value="<%=role_name%>">
  <table width="100%" border="0">
    <tr> 
      <td width="100%"> <div align="center"> 
	 <table width="80%" border="0">
            <tr> 
              <td width="100%"><div align="center">菜单权限</div></td>
            </tr>
	 </table>
          <table width="80%" border="0">
            <tr> 
              <td width="100%">
			   <table width="100%" border="0" bgcolor="#CCCCCC">
                  <tr>
                    <td>
					<IFRAME name="role_left" src="role_menu_tree.jsp?role_id=<%=role_id%>" height="280" width="100%" frameborder=0 scrolling="auto" target="index_top">
		            </IFRAME>
					</td>
                  </tr>
                </table></td>
            </tr>
          </table>
        </div>
        <p align="center">&nbsp;</p>
        <div align="center">
           
          <input type="button" name="save" value="提交" onClick="javascript: formcheck1(<%=record.length%>);">
          &nbsp;&nbsp; 
          <input name="reset" type="reset" value="重置">
          &nbsp;&nbsp; 
          <input type="button" name="return" value="返回" onClick="javascript:self.location = 'role_list.jsp';">
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
