upadd.jsp~120~
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:7k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" import="officeol.mc.tools.*" %>
  2. <%request.setCharacterEncoding("GBK"); %>
  3. <html>
  4. <head>
  5. <title>
  6. 天津市河东区经济贸易委员会内部办公网
  7. </title>
  8. </head>
  9. <body bgcolor="#ffffff"><br />
  10. <h4>
  11. 用户权限添加
  12. </h4>
  13. <a href="upadd.jsp">用户权限添加</a>
  14. <a href="upMod.jsp">用户权限修改</a>
  15. <%
  16. String message = request.getAttribute("msg")==null?"":request.getAttribute("msg").toString();
  17. out.print(message);
  18. DBConn dbc = new DBConn();
  19. String usql = "";
  20. String upsql = "";
  21. //权限处理
  22. String depid = (String)session.getAttribute("UDID");
  23. String login = (String)session.getAttribute("LOGIN");
  24. String pope = (String)session.getAttribute("POPE");
  25. boolean pageView = true;
  26. String type = "com";
  27. if(login!=null&&login.equals("OK")){
  28.   if(pope.equals("all")){
  29.     usql = "select u.id,u.username,d.deparname from [user] as u inner join userdepar as ud on ud.userid = u.id inner join deparment as d on ud.deparid = d.id group by u.id,u.username,d.deparname order by deparname ";
  30.     upsql = "select * from userpope";
  31.     type = "all";
  32.   }else if(pope.equals("dep")){
  33.     usql = "select u.id,u.username,d.deparname from [user] as u inner join userdepar as ud on ud.userid = u.id  inner join deparment as d on ud.deparid = d.id and ud.deparid = '"+depid+"' group by u.id,u.username,d.deparname";
  34.     upsql = "select * from userpope";
  35.     type = "dep";
  36.     //System.out.println("upadd.jsp_usql :"+usql);
  37.   }else if(pope.equals("com")){
  38.     out.print("你没有权限查看这个页面");
  39.     pageView = false;
  40.   }
  41.   if(pageView&&type.equals("all")){
  42.    String[][] users = dbc.getArray(usql);
  43.    String[][] up = dbc.getArray(upsql);
  44.    if(users != null){
  45.      if(up != null){
  46.        %>
  47. <form name="form1" method="post" action="upAddAction.do">
  48.   <table width="90%" border="1">
  49.     <tr>
  50.       <td>用户</td>
  51.       <td>用户所属部门</td>
  52.       <td>权限</td>
  53.     </tr>
  54.       <%
  55.       String p1 = "";
  56.       String p2 = "";
  57.       String p3 = "";
  58.       int count = 0;
  59.       aaa:for(int i = 0;i < users.length; i++){
  60.         p1 = "";
  61.         p2 = "";
  62.         p3 = "";
  63.         for(int j = 0; j < up.length; j++){
  64.           if(users[i][0].equals(up[j][1])){
  65.             continue aaa;
  66.           }
  67.         }
  68.         %>
  69.         <tr>
  70.           <td><%=users[i][1] %>
  71.            <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
  72.           <td><%=users[i][2] %></td>
  73.           <td>
  74.           <input type="radio" name="pope<%=count%>" value="3" <%=p3%>>
  75.           全局权限
  76.           <input type="radio" name="pope<%=count%>" value="1"  <%=p1%>>
  77.           部门权限
  78.           <input type="radio" name="pope<%=count%>" value="2" <%=p2%>>
  79.           普通权限
  80.           </td>
  81.         </tr>
  82.         <%
  83.          count++;
  84.         }
  85.     %>
  86.     <tr>
  87.       <td colspan="3"><div align="center">
  88.       <input type="hidden" value="<%=count%>"  name="count"/>
  89.         <input type="submit" name="Submit" value="保存">
  90.       </div></td>
  91.     </tr>
  92.   </table>
  93. </form>
  94.        <%
  95.      }else{
  96.        %>
  97. <form name="form1" method="post" action="upAddAction.do">
  98.   <table width="90%" border="1">
  99.     <tr>
  100.       <td>用户</td>
  101.       <td>用户所属部门</td>
  102.       <td>权限</td>
  103.     </tr>
  104.       <%
  105.       String p1 = "";
  106.       String p2 = "";
  107.       String p3 = "";
  108.       int count = 0;
  109.       for(int i = 0;i < users.length; i++){
  110.         %>
  111.         <tr>
  112.           <td><%=users[i][1] %>
  113.             <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
  114.           <td><%=users[i][2] %></td>
  115.           <td>
  116.           <input type="radio" name="pope<%=count%>" value="3" <%=p3%>>
  117.           全局权限
  118.           <input type="radio" name="pope<%=count%>" value="1"  <%=p1%>>
  119.           部门权限
  120.           <input type="radio" name="pope<%=count%>" value="2" <%=p2%>>
  121.           普通权限
  122.           </td>
  123.         </tr>
  124.         <%
  125.          count++;
  126.         }
  127.     %>
  128.     <tr>
  129.       <td colspan="3"><div align="center">
  130.       <input type="hidden" value="<%=count%>"  name="count"/>
  131.         <input type="submit" name="Submit" value="保存">
  132.       </div></td>
  133.     </tr>
  134.   </table>
  135. </form>
  136.        <%
  137.      }
  138.    }else{
  139.      out.print("没有用户!");
  140.    }
  141.   }
  142. if(pageView&&type.equals("dep")){
  143.    String[][] users = dbc.getArray(usql);
  144.    String[][] up = dbc.getArray(upsql);
  145.    if(users != null){
  146.      if(up != null){
  147.        %>
  148. <form name="form1" method="post" action="upAddAction.do">
  149.   <table width="90%" border="1">
  150.     <tr>
  151.       <td>用户</td>
  152.       <td>用户所属部门</td>
  153.       <td>权限</td>
  154.     </tr>
  155.       <%
  156.       String p1 = "";
  157.       String p2 = "";
  158.       String p3 = "";
  159.       String p1dis = "";
  160.       String p2dis ="";
  161.       int count = 0;
  162.       bbb:for(int i = 0;i < users.length; i++){
  163.         p1 = "";
  164.         p2 = "";
  165.         p3 = "";
  166.         p1dis  ="";
  167.         p2dis = "";
  168.         for(int j = 0; j < up.length; j++){
  169.           if(users[i][0].equals(up[j][1])){
  170.             continue bbb;
  171.           }
  172.         }
  173.         %>
  174.         <tr>
  175.           <td><%=users[i][1] %>
  176.            <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
  177.           <td><%=users[i][2] %></td>
  178.           <td>
  179.           <input type="radio" name="pope<%=count%>" value="3" disabled="disabled" <%=p3%>>
  180.           全局权限
  181.           <input type="radio" name="pope<%=count%>" value="1"  <%=p1%> <%=p1dis%>>
  182.           部门权限
  183.           <input type="radio" name="pope<%=count%>" value="2" <%=p2%> <%=p2dis%>>
  184.           普通权限
  185.           </td>
  186.         </tr>
  187.         <%
  188.          count++;
  189.         }
  190.     %>
  191.     <tr>
  192.       <td colspan="3"><div align="center">
  193.       <input type="hidden" value="<%=count%>"  name="count"/>
  194.         <input type="submit" name="Submit" value="保存">
  195.       </div></td>
  196.     </tr>
  197.   </table>
  198. </form>
  199.        <%
  200.      }else{
  201.        %>
  202. <form name="form1" method="post" action="upAddAction.do">
  203.   <table width="90%" border="1">
  204.     <tr>
  205.       <td>用户</td>
  206.       <td>用户所属部门</td>
  207.       <td>权限</td>
  208.     </tr>
  209.       <%
  210.       String p1 = "";
  211.       String p2 = "";
  212.       String p3 = "";
  213.       int count = 0;
  214.       for(int i = 0;i < users.length; i++){
  215.         %>
  216.         <tr>
  217.           <td><%=users[i][1] %>
  218.            <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
  219.           <td><%=users[i][2] %></td>
  220.           <td>
  221.           <input type="radio" name="pope<%=count%>" value="3" disabled="disabled" <%=p3%>>
  222.           全局权限
  223.           <input type="radio" name="pope<%=count%>" value="1"  <%=p1%>>
  224.           部门权限
  225.           <input type="radio" name="pope<%=count%>" value="2" <%=p2%>>
  226.           普通权限
  227.           </td>
  228.         </tr>
  229.         <%
  230.          count++;
  231.         }
  232.     %>
  233.     <tr>
  234.       <td colspan="3"><div align="center">
  235.       <input type="hidden" value="<%=count%>"  name="count"/>
  236.         <input type="submit" name="Submit" value="保存">
  237.       </div></td>
  238.     </tr>
  239.   </table>
  240. </form>
  241.        <%
  242.      }
  243.    }else{
  244.      out.print("没有用户!");
  245.    }
  246.   }
  247. }else{
  248.   if(!pageView){
  249.     out.print("你没有权限查看这个页面");
  250.   }
  251.    response.sendRedirect("userlogin.jsp");
  252. }
  253. %>
  254. </body>
  255. </html>