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

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="cn.js.fan.web.*"%>
  5. <%@ page import="com.redmoon.oa.pvg.*" %>
  6. <html>
  7. <head>
  8. <title>管理用户</title>
  9. <link href="default.css" rel="stylesheet" type="text/css">
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <style type="text/css">
  12. <!--
  13. .style4 {
  14. color: #FFFFFF;
  15. font-weight: bold;
  16. }
  17. -->
  18. </style>
  19. <script>
  20. var selUserNames = "";
  21. var selUserRealNames = "";
  22. function getSelUserNames() {
  23. return selUserNames;
  24. }
  25. function getSelUserRealNames() {
  26. return selUserRealNames;
  27. }
  28. function openWinUsers() {
  29. selUserNames = form1.users.value;
  30. selUserRealNames = form1.userRealNames.value;
  31. showModalDialog('../user_multi_sel.jsp',window.self,'dialogWidth:600px;dialogHeight:480px;status:no;help:no;')
  32. }
  33. function setUsers(users, userRealNames) {
  34. form1.users.value = users;
  35. form1.userRealNames.value = userRealNames;
  36. }
  37. </script>
  38. </head>
  39. <body bgcolor="#FFFFFF" text="#000000">
  40. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  41. <%
  42. if (!privilege.isUserPrivValid(request, PrivDb.PRIV_ADMIN)) {
  43. out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  44. return;
  45. }
  46. %>
  47. <%
  48. String op = StrUtil.getNullString(request.getParameter("op"));
  49. String groupCode = ParamUtil.get(request, "group_code").trim();
  50. String sql = "select name,realname,gender from users order by name";
  51. String strWhat = "";
  52. if (!groupCode.equals("")) {
  53. sql = "select u.name,u.realName,u.gender from users u,user_of_group g where g.group_code=" + StrUtil.sqlstr(groupCode) + " and g.user_name=u.name";
  54. UserGroupDb ugd = new UserGroupDb();
  55. ugd = ugd.getUserGroupDb(groupCode);
  56. strWhat = ugd.getDesc();
  57. }
  58. if (op.equals("add")) {
  59. String userNames = ParamUtil.get(request, "users");
  60. String[] users = StrUtil.split(userNames, ",");
  61. if (users==null) {
  62. out.print(StrUtil.Alert_Back("请选择用户!"));
  63. return;
  64. }
  65. else {
  66. UserGroupDb ugd = new UserGroupDb();
  67. ugd.addUsers(groupCode, users);
  68. out.print(StrUtil.Alert_Redirect("操作成功!", "user_group_user.jsp?group_code=" + StrUtil.UrlEncode(groupCode)));
  69. return;
  70. }
  71. }
  72. if (op.equals("del")) {
  73. String userName = ParamUtil.get(request, "userName");
  74. UserGroupDb ugd = new UserGroupDb();
  75. boolean re = ugd.delUser(groupCode, userName);
  76. if (re)
  77. out.print(StrUtil.Alert_Redirect("操作成功!", "user_group_user.jsp?group_code=" + StrUtil.UrlEncode(groupCode)));
  78. else {
  79. out.print(StrUtil.Alert_Back("操作失败!"));
  80. return;
  81. }
  82. }
  83. %>
  84. <table cellSpacing="0" cellPadding="0" width="100%">
  85.   <tbody>
  86.     <tr>
  87.       <td class="head">管理<%=strWhat%>用户</td>
  88.     </tr>
  89.   </tbody>
  90. </table>
  91. <%
  92. RMConn rmconn = new RMConn(Global.defaultDB);
  93. ResultIterator ri = rmconn.executeQuery(sql);
  94. ResultRecord rr = null;
  95. String name;
  96. String realname;
  97. String genderdesc;
  98. %>
  99. <br>
  100. <br>
  101. <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="95%" align="center">
  102.   <tbody>
  103.     <tr>
  104.       <td class="thead" style="PADDING-LEFT: 10px" noWrap width="19%">用户名</td>
  105.       <td class="thead" style="PADDING-LEFT: 10px" noWrap width="22%">真实姓名</td>
  106.       <td class="thead" noWrap width="42%"><img src="images/tl.gif" align="absMiddle" width="10" height="15">性别</td>
  107.       <td width="17%" noWrap class="thead"><img src="images/tl.gif" align="absMiddle" width="10" height="15">操作</td>
  108.     </tr>
  109.     <%
  110. String userNames = "";
  111. String userRealNames = "";
  112. while (ri.hasNext()) {
  113.   rr = (ResultRecord)ri.next();
  114. name = rr.getString(1);
  115. realname = rr.getString(2);
  116. if (userNames.equals("")) {
  117. userNames = name;
  118. userRealNames = realname;
  119. }
  120. else {
  121. userNames += "," + name;
  122. userRealNames += "," + realname;
  123. }
  124. genderdesc = rr.getInt(3)==0?"男":"女";
  125. %>
  126.     <tr class="row" style="BACKGROUND-COLOR: #ffffff">
  127.       <td style="PADDING-LEFT: 10px">&nbsp;<img src="images/arrow.gif" align="absmiddle">&nbsp;<a href="user_op.jsp?op=edit&name=<%=StrUtil.UrlEncode(name)%>"><%=name%></a></td>
  128.       <td style="PADDING-LEFT: 10px"><a href="user_op.jsp?op=edit&name=<%=StrUtil.UrlEncode(name)%>"><%=realname%></a></td>
  129.       <td><a href="user_op.jsp?op=edit&name=<%=StrUtil.UrlEncode(name)%>"><%=genderdesc%></a></td>
  130.       <td><a href="user_op.jsp?op=edit&name=<%=StrUtil.UrlEncode(name)%>">[ 管理 ]</a>&nbsp;&nbsp;[ <a href="user_group_user.jsp?op=del&group_code=<%=StrUtil.UrlEncode(groupCode)%>&userName=<%=StrUtil.UrlEncode(name)%>">删除</a> ]</td>
  131.     </tr>
  132. <%}%>
  133.   </tbody>
  134. </table>
  135. <HR noShade SIZE=1>
  136. <table width="80%" border="0" align="center">
  137. <form name="form1" action="user_group_user.jsp?op=add" method="post">
  138.   <tr>
  139.     <td align="center"><input name="users" id="users" type="hidden" value="">
  140. <input name="group_code" type="hidden" value="<%=groupCode%>">
  141.         <textarea name="userRealNames" cols="75" rows="5" readonly wrap="yes" id="userRealNames"></textarea>
  142.         <span class="TableData">
  143.         <input class="SmallButton" title="添加收件人" onClick="openWinUsers()" type="button" value="添 加" name="button2">
  144.          &nbsp;
  145.          <input class="SmallButton" title="清空收件人" onClick="form1.users.value='';form1.userRealNames.value=''" type="button" value="清 空" name="button">
  146.       </span></td>
  147.   </tr>
  148.   <tr>
  149.     <td align="center"><input name="submit" type="submit" value="确定"></td>
  150.   </tr>
  151.  </form>
  152. </table>
  153. </body>
  154. </html>