upadd.jsp~118~
资源名称:bangong.rar [点击查看]
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:7k
源码类别:
OA系统
开发平台:
Java
- <%@ page contentType="text/html; charset=GBK" import="officeol.mc.tools.*" %>
- <%request.setCharacterEncoding("GBK"); %>
- <html>
- <head>
- <title>
- 天津市河东区经济贸易委员会内部办公网
- </title>
- </head>
- <body bgcolor="#ffffff">
- <h1>
- 用户权限添加
- </h1>
- <%
- String message = request.getAttribute("msg")==null?"":request.getAttribute("msg").toString();
- out.print(message);
- DBConn dbc = new DBConn();
- String usql = "";
- String upsql = "";
- //权限处理
- String depid = (String)session.getAttribute("UDID");
- String login = (String)session.getAttribute("LOGIN");
- String pope = (String)session.getAttribute("POPE");
- boolean pageView = true;
- String type = "com";
- if(login.equals("OK")){
- if(pope.equals("all")){
- 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 ";
- upsql = "select * from userpope";
- type = "all";
- }else if(pope.equals("dep")){
- 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";
- upsql = "select * from userpope";
- type = "dep";
- //System.out.println("upadd.jsp_usql :"+usql);
- }else if(pope.equals("com")){
- out.print("你没有权限查看这个页面");
- pageView = false;
- }
- if(pageView&&type.equals("all")){
- String[][] users = dbc.getArray(usql);
- String[][] up = dbc.getArray(upsql);
- if(users != null){
- if(up != null){
- %>
- <form name="form1" method="post" action="upAddAction.do">
- <table width="90%" border="1">
- <tr>
- <td>用户</td>
- <td>用户所属部门</td>
- <td>权限</td>
- </tr>
- <%
- String p1 = "";
- String p2 = "";
- String p3 = "";
- int count = 0;
- aaa:for(int i = 0;i < users.length; i++){
- p1 = "";
- p2 = "";
- p3 = "";
- for(int j = 0; j < up.length; j++){
- if(users[i][0].equals(up[j][1])){
- continue aaa;
- }
- }
- %>
- <tr>
- <td><%=users[i][1] %>
- <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
- <td><%=users[i][2] %></td>
- <td>
- <input type="radio" name="pope<%=count%>" value="3" <%=p3%>>
- 全局权限
- <input type="radio" name="pope<%=count%>" value="1" <%=p1%>>
- 部门权限
- <input type="radio" name="pope<%=count%>" value="2" <%=p2%>>
- 普通权限
- </td>
- </tr>
- <%
- count++;
- }
- %>
- <tr>
- <td colspan="3"><div align="center">
- <input type="hidden" value="<%=count%>" name="count"/>
- <input type="submit" name="Submit" value="提交">
- </div></td>
- </tr>
- </table>
- </form>
- <%
- }else{
- %>
- <form name="form1" method="post" action="upAddAction.do">
- <table width="90%" border="1">
- <tr>
- <td>用户</td>
- <td>用户所属部门</td>
- <td>权限</td>
- </tr>
- <%
- String p1 = "";
- String p2 = "";
- String p3 = "";
- int count = 0;
- for(int i = 0;i < users.length; i++){
- %>
- <tr>
- <td><%=users[i][1] %>
- <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
- <td><%=users[i][2] %></td>
- <td>
- <input type="radio" name="pope<%=count%>" value="3" <%=p3%>>
- 全局权限
- <input type="radio" name="pope<%=count%>" value="1" <%=p1%>>
- 部门权限
- <input type="radio" name="pope<%=count%>" value="2" <%=p2%>>
- 普通权限
- </td>
- </tr>
- <%
- count++;
- }
- %>
- <tr>
- <td colspan="3"><div align="center">
- <input type="hidden" value="<%=count%>" name="count"/>
- <input type="submit" name="Submit" value="提交">
- </div></td>
- </tr>
- </table>
- </form>
- <%
- }
- }else{
- out.print("没有用户!");
- }
- }
- if(pageView&&type.equals("dep")){
- String[][] users = dbc.getArray(usql);
- String[][] up = dbc.getArray(upsql);
- if(users != null){
- if(up != null){
- %>
- <form name="form1" method="post" action="upAddAction.do">
- <table width="90%" border="1">
- <tr>
- <td>用户</td>
- <td>用户所属部门</td>
- <td>权限</td>
- </tr>
- <%
- String p1 = "";
- String p2 = "";
- String p3 = "";
- String p1dis = "";
- String p2dis ="";
- int count = 0;
- bbb:for(int i = 0;i < users.length; i++){
- p1 = "";
- p2 = "";
- p3 = "";
- p1dis ="";
- p2dis = "";
- for(int j = 0; j < up.length; j++){
- if(users[i][0].equals(up[j][1])){
- continue bbb;
- }
- }
- %>
- <tr>
- <td><%=users[i][1] %>
- <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
- <td><%=users[i][2] %></td>
- <td>
- <input type="radio" name="pope<%=count%>" value="3" disabled="disabled" <%=p3%>>
- 全局权限
- <input type="radio" name="pope<%=count%>" value="1" <%=p1%> <%=p1dis%>>
- 部门权限
- <input type="radio" name="pope<%=count%>" value="2" <%=p2%> <%=p2dis%>>
- 普通权限
- </td>
- </tr>
- <%
- count++;
- }
- %>
- <tr>
- <td colspan="3"><div align="center">
- <input type="hidden" value="<%=count%>" name="count"/>
- <input type="submit" name="Submit" value="提交">
- </div></td>
- </tr>
- </table>
- </form>
- <%
- }else{
- %>
- <form name="form1" method="post" action="upAddAction.do">
- <table width="90%" border="1">
- <tr>
- <td>用户</td>
- <td>用户所属部门</td>
- <td>权限</td>
- </tr>
- <%
- String p1 = "";
- String p2 = "";
- String p3 = "";
- int count = 0;
- for(int i = 0;i < users.length; i++){
- %>
- <tr>
- <td><%=users[i][1] %>
- <input type="hidden" name="uid<%=count%>" value="<%=users[i][0] %>" /></td>
- <td><%=users[i][2] %></td>
- <td>
- <input type="radio" name="pope<%=count%>" value="3" disabled="disabled" <%=p3%>>
- 全局权限
- <input type="radio" name="pope<%=count%>" value="1" <%=p1%>>
- 部门权限
- <input type="radio" name="pope<%=count%>" value="2" <%=p2%>>
- 普通权限
- </td>
- </tr>
- <%
- count++;
- }
- %>
- <tr>
- <td colspan="3"><div align="center">
- <input type="hidden" value="<%=count%>" name="count"/>
- <input type="submit" name="Submit" value="提交">
- </div></td>
- </tr>
- </table>
- </form>
- <%
- }
- }else{
- out.print("没有用户!");
- }
- }
- }else{
- if(!pageView){
- out.print("你没有权限查看这个页面");
- }
- out.print("请登录!");
- %>
- <br /><a href="userlogin.jsp" target="mainFrame">用户登录</a>
- <%
- }
- %>
- </body>
- </html>