user_role_priv.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:4k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="cn.js.fan.db.*"%>
  4. <%@ page import="com.redmoon.oa.pvg.*"%>
  5. <%@ page import="com.redmoon.oa.person.*"%>
  6. <%@ page import="cn.js.fan.web.*"%>
  7. <html>
  8. <head>
  9. <title>管理角色权限</title>
  10. <link href="default.css" rel="stylesheet" type="text/css">
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  12. <style type="text/css">
  13. <!--
  14. .style4 {
  15. color: #FFFFFF;
  16. font-weight: bold;
  17. }
  18. -->
  19. </style>
  20. </head>
  21. <body bgcolor="#FFFFFF" text="#000000">
  22. <jsp:useBean id="privmgr" scope="page" class="com.redmoon.oa.pvg.PrivMgr"/>
  23. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  24. <%
  25. if (!privilege.isUserPrivValid(request, PrivDb.PRIV_ADMIN))
  26. {
  27. // out.println(StrUtil.makeErrMsg(privilege.MSG_INVALID,"red","green"));
  28. // return;
  29. }
  30. %>
  31. <%
  32. String roleCode = ParamUtil.get(request, "roleCode");
  33. if (roleCode.equals("")) {
  34. out.print(StrUtil.makeErrMsg("角色编码不能为空!"));
  35. return;
  36. }
  37. String op = StrUtil.getNullString(request.getParameter("op"));
  38. if (op.equals("setrolepriv")) {
  39. com.redmoon.oa.pvg.Privilege privg = new com.redmoon.oa.pvg.Privilege();
  40. try {
  41. if (privg.setRolePriv(request))
  42. out.print(StrUtil.Alert("修改角色权限成功!"));
  43. }
  44. catch (ErrMsgException e) {
  45. out.print(StrUtil.Alert_Back(e.getMessage()));
  46. }
  47. }
  48. %>
  49. <table cellSpacing="0" cellPadding="0" width="100%">
  50.   <tbody>
  51.     <tr>
  52.       <td class="head">管理角色权限</td>
  53.     </tr>
  54.   </tbody>
  55. </table>
  56. <%
  57. RoleDb rd = new RoleDb();
  58. String[] rolePriv = rd.getRolePriv(roleCode);
  59. PrivDb[] privs = privmgr.getAllPriv();
  60. String priv, desc;
  61. %>
  62. <br>
  63. <br>
  64. <table style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" cellSpacing="0" cellPadding="3" width="77%" align="center">
  65.    <form name="form1" method="post" action="?op=setrolepriv">
  66.   <tbody>
  67.     <tr>
  68.       <td class="thead" style="PADDING-LEFT: 10px" noWrap width="15%">&nbsp;</td>
  69.       <td class="thead" style="PADDING-LEFT: 10px" noWrap width="32%">编码</td>
  70.       <td class="thead" noWrap width="53%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">描述</td>
  71.     </tr>
  72. <%
  73. int len = 0;
  74. if (privs!=null)
  75. len = privs.length;
  76. int privlen = 0;
  77. if (rolePriv!=null)
  78. privlen = rolePriv.length;
  79. for (int i=0; i<len; i++) {
  80. PrivDb pv = privs[i];
  81. priv = pv.getPriv();
  82. desc = pv.getDesc();
  83. %>
  84.     <tr class="row" style="BACKGROUND-COLOR: #ffffff">
  85.       <td style="PADDING-LEFT: 10px">
  86.   <%
  87.   boolean isChecked = false;
  88.   for (int k=0; k<privlen; k++) {
  89.    if (rolePriv[k].equals(priv)) {
  90. isChecked = true;
  91. break;
  92. }
  93.   }
  94.   if (isChecked)
  95.    out.print("<input type=checkbox name=priv value='" + priv + "' checked>");
  96.   else
  97.    out.print("<input type=checkbox name=priv value='" + priv + "'");
  98.   %>
  99.   </td>
  100.       <td style="PADDING-LEFT: 10px">&nbsp;<img src="images/arrow.gif" align="absmiddle">&nbsp;<%=priv%></td>
  101.       <td><%=desc%></td>
  102.     </tr>
  103. <%}%>
  104.     <tr align="center" class="row" style="BACKGROUND-COLOR: #ffffff">
  105.       <td colspan="3" style="PADDING-LEFT: 10px">
  106.   <input type=hidden name=roleCode value="<%=roleCode%>">
  107.   <input name="Submit" type="submit" class="singleboarder" value="提交">
  108. &nbsp;&nbsp;&nbsp;
  109. <input name="Submit" type="reset" class="singleboarder" value="重置"></td>
  110.     </tr>
  111.   </tbody></form>
  112. </table>
  113. <HR noShade SIZE=1>
  114. <DIV style="WIDTH: 95%" align=right></DIV>
  115. </body>
  116. <script language="javascript">
  117. <!--
  118. function form1_onsubmit()
  119. {
  120. errmsg = "";
  121. if (form1.pwd.value!=form1.pwd_confirm.value)
  122. errmsg += "密码与确认密码不致,请检查!n"
  123. if (errmsg!="")
  124. {
  125. alert(errmsg);
  126. return false;
  127. }
  128. }
  129. //-->
  130. </script>
  131. </html>