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