users.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:6k
源码类别:
电子政务应用
开发平台:
Java
- <%
- /**
- * $RCSfile: users.jsp,v $
- * $Revision: 1.3 $
- * $Date: 2000/12/18 02:06:21 $
- */
- %>
- <%@ page import="java.util.*,
- com.coolservlets.forum.*,
- com.coolservlets.forum.util.*,
- com.coolservlets.forum.util.admin.*" %>
- <jsp:useBean id="adminBean" scope="session"
- class="com.coolservlets.forum.util.admin.AdminBean"/>
- <%! //////////////////
- // page variables
- private final String YES = "<font color='#006600' size='-1'><b>是</b></font>";
- private final String NO = "<font color='#ff0000' size='-1'><b>否</b></font>";
- private final int DEFAULT_RANGE = 10;
- private final int[] ranges = {10,20,30,50};
- %>
- <% ////////////////////////////////
- // Jive authorization check
- // check the bean for the existence of an authorization token.
- // Its existence proves the user is valid. If it's not found, redirect
- // to the login page
- Authorization authToken = adminBean.getAuthToken();
- if( authToken == null ) {
- response.sendRedirect( "/mainctrl/bbs/admin" );
- return;
- }
- %>
- <% ////////////////////
- // Security check
- // make sure the user is authorized to administer users:
- ForumFactory forumFactory = ForumFactory.getInstance(authToken);
- ForumPermissions permissions = forumFactory.getPermissions(authToken);
- boolean isSystemAdmin = permissions.get(ForumPermissions.SYSTEM_ADMIN);
- boolean isUserAdmin = permissions.get(ForumPermissions.USER_ADMIN);
- // redirect to error page if we're not a user admin or a system admin
- if( !isUserAdmin && !isSystemAdmin ) {
- request.setAttribute("message","您没有权限管理用户!");
- response.sendRedirect("error.jsp");
- return;
- }
- %>
- <% ///////////////////
- // get parameters
- // parameter for paging through list of users
- int start = ParamUtils.getIntParameter(request,"start",0);
- int range = ParamUtils.getIntParameter(request,"range",DEFAULT_RANGE);
- String msg = ParamUtils.getParameter(request,"msg");
- %>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" href="style/global.css">
- <style type="text/css">
- .userHeader {
- font-size : 8pt;
- text-align : center;
- }
- </style>
- </head>
- <body background="images/shadowBack.gif" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
- <% ///////////////////////
- // pageTitleInfo variable (used by include/pageTitle.jsp)
- String[] pageTitleInfo = { "用户" };
- %>
- <% ///////////////////
- // pageTitle include
- %><%@ include file="include/pageTitle.jsp" %>
- <% ////////////////////////////////
- // get an Iterator of users
- ProfileManager manager = forumFactory.getProfileManager();
- Iterator userIterator = manager.users();
- int userCount = manager.getUserCount();
- %>
- <p>
- <% if( msg != null ) { %>
- <span class="messageText">
- <%= msg %>
- </span>
- <% } %>
- <p>
- <form>
- <%-- paging table --%>
- <% if( (userCount>0) ) { %>
- <table cellpadding="3" cellspacing="1" border="0" width="100%">
- <tr>
- <td width="1%" nowrap>
- <% if( (start-range) >= 0 ) { %>
- « <a href="users.jsp?range=<%=range%>&start=<%=(start-range)%>">前<%=start%></a>
- <% } else { %>
-
- <% } %>
- </td>
- <td width="98%" align="center">
- 显示
- <select size="1"
- onchange="location.href='users.jsp?start=<%=start%>&range='+this.options[this.selectedIndex].value;">
- <% for( int i=0; i<ranges.length; i++ ) { %>
- <% String selected = ""; %>
- <% if( range == ranges[i] ) { selected = " selected"; } %>
- <option value="<%= ranges[i] %>"<%= selected %>><%= ranges[i] %>
- <% } %>
- </select>
- 个用户每页
- </td>
- <td width="1%" nowrap>
- <% if( (start+range) < userCount ) {
- System.out.println("start:"+start);
- System.out.println("range:"+range);
- System.out.println("userCount :"+userCount );
- %>
- <a href="users.jsp?range=<%=range%>&start=<%=(start+range)%>">后<%// ((start+range-userCount)<range)?(userCount-range):range %><%=(userCount-start-range >= 0)?(userCount-start-range):0%></a> »
- <% } else { %>
-
- <% } %>
- </td>
- </tr>
- </table>
- <% } %>
- <% /////////////////////
- // skip results if necessary
- int skip = start;
- if( skip > 0 ) {
- while( userIterator.hasNext() && (skip-- > 0) ) {
- userIterator.next();
- }
- }
- %>
- <%-- /paging table --%>
- <p>
- <%-- table of users --%>
- <table bgcolor="#666666" border="0" cellpadding="0" cellspacing="0" width="100%">
- <td>
- <table border="0" cellpadding="2" cellspacing="1" width="100%">
- <tr bgcolor="#eeeeee">
- <td class="userHeader" width="2%" nowrap> ID </td>
- <td width="25%"><b>用户名</b></td>
- <td width="36%"><b>姓名</b></td>
- <td width="25%"><b>Email</b></td>
- <td class="userHeader" width="4%" nowrap>编辑<br>属性</td>
- <%--<td class="userHeader" width="4%" nowrap>Permissions</td>--%>
- <td class="userHeader" width="4%" nowrap>删除</td>
- </tr>
- <% ////////////////////////////////////
- // iterate through users, show info
- int count = 0;
- while( userIterator.hasNext() && (count++)<range ) {
- User user = (User)userIterator.next();
- int userID = user.getID();
- String username = user.getUsername();
- String name = user.getName();
- String email = user.getEmail();
- boolean isNameVisible = user.isNameVisible();
- boolean isEmailVisible = user.isEmailVisible();
- %>
- <tr bgcolor="#ffffff">
- <td align="center"><%= userID %></td>
- <td>
- <b><%= username %></b>
- </td>
- <td>
- <%= (name!=null&&!name.equals(""))?name:" " %>
- </td>
- <td>
- <%= (email!=null&&!email.equals(""))?email:" " %>
- </td>
- <td align="center">
- <input type="radio" name="props" value=""
- onclick="location.href='editUser.jsp?user=<%= username %>';">
- </td>
- <%--
- <td align="center">
- <input type="radio" name="props" value=""
- onclick="location.href='userProps.jsp?user=<%= username %>';">
- </td>
- --%>
- <td align="center">
- <input type="radio" name="props" value=""
- onclick="location.href='removeUser.jsp?user=<%= username %>';">
- </td>
- </tr>
- <% }
- %>
- </table>
- </td>
- </table>
- </form>
- <p>
- <form method="post" action="userSearch.jsp">
- <center>
- 查找用户:
- <input type="text" name="q" value="" size="30" maxlength="50">
- <input type="submit" value="查找"><br>
- (可以包含在姓名、用户名或者Email中)
- </center>
- </form>
- </body>
- </html>