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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import="com.redmoon.oa.pvg.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="cn.js.fan.db.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <jsp:useBean id="privmgr" scope="page" class="com.redmoon.oa.pvg.PrivMgr"/>
  7. <html>
  8. <head>
  9. <title>管理登录</title>
  10. <link href="../common.css" rel="stylesheet" type="text/css">
  11. <link href="default.css" rel="stylesheet" type="text/css">
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  13. </head>
  14. <body bgcolor="#FFFFFF" text="#000000">
  15. <%
  16. String op = ParamUtil.get(request, "op");
  17. User user = null;
  18. boolean isEdit = false;
  19. if (op.equals("edit")) {
  20. isEdit = true;
  21. String name = ParamUtil.get(request, "name");
  22. if (name.equals("")) {
  23. StrUtil.Alert_Back("用户名不能为空!");
  24. return;
  25. }
  26. user = new User(name);
  27. }
  28. if (op.equals("editdo")) {
  29. isEdit = true;
  30. UserMgr usermgr = new UserMgr();
  31. try {
  32. if (usermgr.update(request))
  33. out.print(StrUtil.Alert("修改成功!"));
  34. }
  35. catch (ErrMsgException e) {
  36. out.print(StrUtil.Alert_Back(e.getMessage()));
  37. }
  38. String name = ParamUtil.get(request, "name");
  39. if (name.equals("")) {
  40. StrUtil.Alert_Back("用户名不能为空!");
  41. return;
  42. }
  43. user = usermgr.getUser(name);
  44. }
  45. if (op.equals("setuserofgroup")) {
  46. isEdit = true;
  47. String name = ParamUtil.get(request, "name");
  48. if (name.equals("")) {
  49. StrUtil.Alert_Back("用户名不能为空!");
  50. return;
  51. }
  52. UserMgr usermgr = new UserMgr();
  53. user = usermgr.getUser(name);
  54. try {
  55. if (user.setGroups(request))
  56. out.print(StrUtil.Alert("修改用户组权限成功!"));
  57. }
  58. catch (ErrMsgException e) {
  59. out.print(StrUtil.Alert_Back(e.getMessage()));
  60. }
  61. }
  62. if (op.equals("setprivs")) {
  63. try {
  64. String username = ParamUtil.get(request, "name");
  65. user = new User();
  66. user = user.getUser(username);
  67. if (user.setPrivs(request))
  68. out.print(StrUtil.Alert("修改用户权限成功!"));
  69. }
  70. catch (ErrMsgException e) {
  71. out.print(StrUtil.Alert_Back(e.getMessage()));
  72. }
  73. }
  74. %>
  75. <table cellSpacing="0" cellPadding="0" width="100%">
  76.   <tbody>
  77.     <tr>
  78.       <td class="head">管理用户</td>
  79.     </tr>
  80.   </tbody>
  81. </table>
  82. <br>
  83. <TABLE 
  84. style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" 
  85. cellSpacing=0 cellPadding=3 width="95%" align=center>
  86.   <!-- Table Head Start-->
  87.   <TBODY>
  88.     <TR>
  89.       <TD class=thead style="PADDING-LEFT: 10px" noWrap width="70%">
  90.   <%if (user!=null) {%>
  91.      修改用户
  92.      <%}else{%>
  93.   添加用户
  94.   <%}%>
  95.   </TD>
  96.     </TR>
  97.     <TR class=row style="BACKGROUND-COLOR: #fafafa">
  98.       <TD height="175" align="center" style="PADDING-LEFT: 10px"><table class="frame_gray" width="64%" border="0" cellpadding="0" cellspacing="1">
  99.           <tr>
  100.             <td align="center"><table width="71%" border="0" cellpadding="0" cellspacing="0">
  101.                 <form name="form1" method="post" action="<%=user!=null?"user_op.jsp?op=editdo":"user_m.jsp?op=add"%>">
  102.                   <tr>
  103.                     <td width="113" height="31" align="center">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</td>
  104.                   <td align="left"><input name="name" value="<%=user!=null?user.getName():""%>" <%=isEdit?"readonly":""%>></td>
  105.                   </tr>
  106.                   <tr>
  107.                     <td height="32" align="center">真实姓名</td>
  108.                     <td align="left"><input name="realname" value="<%=user!=null?user.getRealName():""%>" ></td>
  109.                   </tr>
  110.                   <tr>
  111.                     <td height="32" align="center">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述</td>
  112.                   <td align="left"><input name="desc" value="<%=user!=null?user.getDesc():""%>"></td>
  113.                   </tr>
  114.                   <tr>
  115.                     <td height="32" align="center">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</td>
  116.                     <td align="left"><input name="pwd" type="password" id="pwd"></td>
  117.                   </tr>
  118.                   <tr>
  119.                     <td height="32" align="center">确认密码</td>
  120.                     <td align="left"><input name="pwd_confirm" type="password" id="pwd_confirm"></td>
  121.                   </tr>
  122.                   <tr>
  123.                     <td colspan="2" align="center">
  124.                     </td>
  125.                   </tr>
  126.                   <tr>
  127.                     <td height="43" colspan="2" align="center"><input name="Submit" type="submit" class="singleboarder" value="提交">
  128. &nbsp;&nbsp;&nbsp;
  129.                       <input name="Submit" type="reset" class="singleboarder" value="重置"></td>
  130.                   </tr>
  131.                   <tr>
  132.                     <td height="43" colspan="2" align="center">
  133. <%if (isEdit) {%>
  134. 请注意:如果要更改密码,则请填写,否则勿需填写
  135. <%}%>
  136. </td>
  137.                   </tr>
  138.                 </form>
  139.             </table></td>
  140.           </tr>
  141.       </table><br>
  142.   <%if (user!=null) {%>
  143.         <table class="" width="72%" border="0" cellpadding="0" cellspacing="1">
  144.           <tr>
  145.             <td align="center"><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="90%" align="center">
  146.               <form name="form1" method="post" action="?op=setuserofgroup">
  147.                 <tbody>
  148.                   <tr>
  149.                     <td class="thead" style="PADDING-LEFT: 10px" noWrap width="15%">&nbsp;</td>
  150.                     <td class="thead" style="PADDING-LEFT: 10px" noWrap width="32%">用户组编码</td>
  151.                     <td class="thead" noWrap width="53%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">用户组描述</td>
  152.                   </tr>
  153.                   <%
  154. UserGroupMgr usergroupmgr = new UserGroupMgr();   
  155. UserGroup[] ugs = usergroupmgr.getAllUserGroup();
  156. int len = 0;
  157. if (ugs!=null)
  158. len = ugs.length;
  159. UserGroup[] userofgroups = user.getGroup();
  160. int ulen = 0;
  161. if (userofgroups!=null)
  162. ulen = userofgroups.length;
  163. String group_code, desc;
  164. for (int i=0; i<len; i++) {
  165. UserGroup ug = ugs[i];
  166. group_code = ug.getCode();
  167. desc = ug.getDesc();
  168. %>
  169.                   <tr class="row" style="BACKGROUND-COLOR: #ffffff">
  170.                     <td style="PADDING-LEFT: 10px"><%
  171.   boolean isChecked = false;
  172.   for (int k=0; k<ulen; k++) {
  173.    if (userofgroups[k].getCode().equals(group_code)) {
  174. isChecked = true;
  175. break;
  176. }
  177.   }
  178.   if (isChecked)
  179.    out.print("<input type=checkbox name=group_code value='" + group_code + "' checked>");
  180.   else
  181.    out.print("<input type=checkbox name=group_code value='" + group_code + "'");
  182.   %>
  183.                     </td>
  184.                     <td style="PADDING-LEFT: 10px">&nbsp;<img src="images/arrow.gif" align="absmiddle">&nbsp;<%=group_code%></td>
  185.                     <td><%=desc%></td>
  186.                   </tr>
  187.                   <%}%>
  188.                   <tr align="center" class="row" style="BACKGROUND-COLOR: #ffffff">
  189.                     <td colspan="3" style="PADDING-LEFT: 10px"><input type=hidden name="name" value="<%=user.getName()%>">
  190.                         <input name="Submit" type="submit" class="singleboarder" value="提交">
  191. &nbsp;&nbsp;&nbsp;
  192.           <input name="Submit" type="reset" class="singleboarder" value="重置"></td>
  193.                   </tr>
  194.                 </tbody>
  195.               </form>
  196.             </table></td>
  197.           </tr>
  198.         </table>
  199. <%}%>
  200.         <%
  201. if (user!=null) {
  202. %>
  203.         <br>
  204.         <table width="44%"  border="0">
  205.           <tr>
  206.             <td align="center"><strong>权 限 设 定</strong></td>
  207.           </tr>
  208.         </table>
  209.                 <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="64%" align="center">
  210.           <form name="form1" method="post" action="?op=setprivs">
  211.             <tbody>
  212.               <tr>
  213.                 <td class="thead" style="PADDING-LEFT: 10px" noWrap width="15%">
  214. <input type=hidden name="name" value="<%=user.getName()%>">
  215. </td>
  216.                 <td class="thead" style="PADDING-LEFT: 10px" noWrap width="29%">编码</td>
  217.                 <td class="thead" noWrap width="56%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">描述</td>
  218.               </tr>
  219. <%
  220. String[] userprivs = user.getPrivs();
  221. Priv[] privs = privmgr.getAllPriv();
  222. String priv, desc;
  223.   
  224. int len = 0;
  225. if (privs!=null)
  226. len = privs.length;
  227. int privlen = 0;
  228. if (userprivs!=null)
  229. privlen = userprivs.length;
  230. for (int i=0; i<len; i++) {
  231. Priv pv = privs[i];
  232. priv = pv.getPriv();
  233. desc = pv.getDesc();
  234. %>
  235.               <tr class="row" style="BACKGROUND-COLOR: #ffffff">
  236.                 <td style="PADDING-LEFT: 10px">
  237. &nbsp;<img src="images/arrow.gif" align="absmiddle">&nbsp;
  238. <%
  239.   boolean isChecked = false;
  240.   for (int k=0; k<privlen; k++) {
  241.    if (userprivs[k].equals(priv)) {
  242. isChecked = true;
  243. break;
  244. }
  245.   }
  246.   if (isChecked)
  247.    out.print("<input type=checkbox name=priv value='" + priv + "' checked>");
  248.   else
  249.    out.print("<input type=checkbox name=priv value='" + priv + "'");
  250.   %>
  251.                 </td>
  252.                 <td style="PADDING-LEFT: 10px"><%=priv%></td>
  253.                 <td><%=desc%></td>
  254.               </tr>
  255.               <%}%>
  256.               <tr align="center" class="row" style="BACKGROUND-COLOR: #ffffff">
  257.                 <td colspan="3" style="PADDING-LEFT: 10px"><input type=hidden name=username value="<%=user.getName()%>">
  258.                     <input name="Submit" type="submit" class="singleboarder" value="提交">
  259. &nbsp;&nbsp;&nbsp;
  260.           <input name="Submit" type="reset" class="singleboarder" value="重置"></td>
  261.               </tr>
  262.             </tbody>
  263.           </form>
  264.         </table>
  265. <%}%>
  266. </TD>
  267.     </TR>
  268.     <!-- Table Body End -->
  269.     <!-- Table Foot -->
  270.     <TR>
  271.       <TD class=tfoot align=right><DIV align=right> </DIV></TD>
  272.     </TR>
  273.     <!-- Table Foot -->
  274.   </TBODY>
  275. </TABLE>
  276. <br>
  277. <br>
  278. </body>
  279. <script language="javascript">
  280. <!--
  281. function form1_onsubmit()
  282. {
  283. }
  284. //-->
  285. </script>
  286. </html>