分配页面Role_Right.jsp原码:
<%@ page language="java" isELIgnored="false" pageEncoding="GBK" errorPage="/inc/exception.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>角色分配权限</title>
<!--列表-->
<script src="${pageContext.request.contextPath}/common/js/tab.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/tab/form.css" type="text/css"></link>
<!--高亮-->
<script language="javascript" src="${pageContext.request.contextPath}/common/js/input.js" type="text/javascript"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/tab/input.css" type="text/css"></link>
<!--时间控件-->
<script language="javascript" src="${pageContext.request.contextPath}/common/js/date.js" type="text/javascript"></script>
<!--验证框架-->
<link href="${pageContext.request.contextPath}/common/validator/validator.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/common/validator/mootools.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/validator/full-validator.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/jquery_last.js"></script>
<script type="text/javascript">
<!--获得用户选项并提交-->
function submitRole(roleId){
var cbxMenu= document.getElementsByName("cbxMenu");
var cbxEdit= document.getElementsByName("cbxEdit");
var menu="",edit="";
if(cbxMenu.length>0){
for(var i=0;i<cbxMenu.length;i++){
if(cbxMenu[i].checked){
alert(cbxMenu[i].checked);
menu=menu+cbxMenu[i].value+","
};
}
if(cbxEdit.length>0){
for(var i=0;i<cbxEdit.length;i++){
if(cbxEdit[i].checked) edit=edit+cbxEdit[i].value+",";
}
}else{
edit=0;
}
$.ajax({
type: "post",
url: "role.do",
data: "param=doDispatch&roleId="+roleId+"&cbxMenu="+menu+"&cbxEdit="+edit,
success: function(msg){
if(msg=="false")alert("角色分配权限失败");
}
});
}
window.close();
}
//隐藏编辑层
function change(contr){
var div=document.getElementById(contr.value);
var menu=document.getElementById(contr.value.substring(0,3));
if(menu.checked){
if(contr.checked){
div.style.display="block";
}else{
div.style.display="none";
}
}else{
contr.checked="";
}
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" class="tab_05">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="30" class="tab_03"></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" valign="middle">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" class="tb"></td>
<td width="95%" class="STYLE1">
<span class="STYLE3">你当前的位置</span>:[角色管理]-[角色分配权限]
</td>
</tr>
</table>
</td>
</tr>
</table></td>
<td width="16" class="tab_07"></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" class="tab_12">
</td>
<td>
<!-- start -->
<div class="body-box">
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
<tr bgcolor="#ffffff" class="STYLE1">
<th >根目录</th>
<th >文档页面</th>
<th colspan="4">操作权限</th>
</tr>
<c:forEach var="right" items="${sessionScope.rightList}" varStatus="status">
<c:if test="${right[1] eq 'Folder'}">
<tr bgcolor="#ffffff">
<td>
<input type="checkbox" name="cbxMenu" value="${right[0]}" id="${right[0]}"/>${right[2]}
</td>
<td> </td>
<td colspan="4"> </td>
</tr>
</c:if>
<c:if test="${right[1] eq 'Document'}">
<tr bgcolor="#ffffff">
<td> </td>
<td>
<input type="checkbox" name="cbxMenu" value="${right[0]}" οnclick="change(this)" />${right[2]}
</td>
<td colspan="4">
<div id="${right[0]}" style="display:none;" >
<input type="checkbox" name="cbxEdit" value="${right[0]}:1"/>增加
<input type="checkbox" name="cbxEdit" value="${right[0]}:2"/>删除
<input type="checkbox" name="cbxEdit" value="${right[0]}:4"/>编辑
<input type="checkbox" name="cbxEdit" value="${right[0]}:8"/>查询
<input type="checkbox" name="cbxEdit" value="${right[0]}:16"/>打印
<input type="checkbox" name="cbxEdit" value="${right[0]}:32"/>分配权
<input type="checkbox" name="cbxEdit" value="${right[0]}:64"/>批准权
<input type="checkbox" name="cbxEdit" value="${right[0]}:128"/>特别权
<input type="checkbox" name="cbxEdit" value="${right[0]}:256"/>管理员
<input type="checkbox" name="cbxEdit" value="${right[0]}:512"/>下载权限
</div>
</td>
</tr>
</c:if>
</c:forEach>
<tr bgcolor="#ffffff"><td class="pn-flabel pn-flabel-h" colspan="7" style="text-align:center"><input type="button" value="提交" οnclick="submitRole(${param.roleId});" /></td></tr>
</table>
</div>
<!-- end. -->
</td>
<td width="8" class="tab_15"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="35" class="tab_19">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="35" class="tab_18"> </td>
<td>
</td>
<td width="16" class="tab_20"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
查看页面:
showRoleRight.jsp:
<%@ page language="java" isELIgnored="false" pageEncoding="GBK" errorPage="/inc/exception.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>角色分配权限</title>
<!--列表-->
<script src="${pageContext.request.contextPath}/common/js/tab.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/tab/form.css" type="text/css"></link>
<!--高亮-->
<script language="javascript" src="${pageContext.request.contextPath}/common/js/input.js" type="text/javascript"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/tab/input.css" type="text/css"></link>
<!--时间控件-->
<script language="javascript" src="${pageContext.request.contextPath}/common/js/date.js" type="text/javascript"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" class="tab_05">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="30" class="tab_03"></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" valign="middle">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" class="tb"></td>
<td width="95%" class="STYLE1">
<span class="STYLE3">你当前的位置</span>:[角色管理]-[角色所属权限]
</td>
</tr>
</table>
</td>
</tr>
</table></td>
<td width="16" class="tab_07"></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" class="tab_12">
</td>
<td>
<!-- start -->
<div class="body-box">
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
<tr bgcolor="#ffffff" class="STYLE1">
<th>根目录</th>
<th>文档页面</th>
<th colspan="4">操作权限</th>
</tr>
<c:forEach var="ror" items="${requestScope.RoleForm.role.rolerights}" varStatus="status">
<c:if test="${ror.right.rightType eq 'Folder'}">
<tr bgcolor="#ffffff">
<td>
${ror.right.rightText}
</td>
<td> </td>
<td colspan="4"> </td>
</tr>
</c:if>
<c:if test="${ror.right.rightType eq 'Document'}">
<tr bgcolor="#ffffff">
<td> </td>
<td>
${ror.right.rightText}
</td>
<td colspan="4">
<c:choose>
<c:when test="${ror.addVal}"><input type="checkbox" checked="checked" disabled="disabled"/>增加</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>增加</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.delVal}"><input type="checkbox" checked="checked" disabled="disabled"/>删除</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>删除</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.editVal}"><input type="checkbox" checked="checked" disabled="disabled"/>编辑</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>编辑</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.findVal}"><input type="checkbox" checked="checked" disabled="disabled"/>查询</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>查询</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.printVal}"><input type="checkbox" checked="checked" disabled="disabled"/>打印</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>打印<br/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.disVal}"><input type="checkbox" checked="checked" disabled="disabled"/>分配权</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>分配权</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.cfmVal}"><input type="checkbox" checked="checked" disabled="disabled"/>批准权</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>批准权</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.specVal}"><input type="checkbox" checked="checked" disabled="disabled"/>特别权</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>特别权</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.adminVal}"><input type="checkbox" checked="checked" disabled="disabled"/>管理权</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>管理员权</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ror.downLoadVal}"><input type="checkbox" checked="checked" disabled="disabled"/>下载权</c:when>
<c:otherwise><input type="checkbox" disabled="disabled"/>下载权</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
</c:forEach>
<tr bgcolor="#ffffff"><td class="pn-flabel pn-flabel-h" colspan="7" style="text-align:center"><input type="button" value="返回" οnclick="window.history.go(-1);" /></td></tr>
</table>
</div>
<!-- end. -->
</td>
<td width="8" class="tab_15"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="35" class="tab_19">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="35" class="tab_18"> </td>
<td>
</td>
<td width="16" class="tab_20"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>