userSearch.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:5k
源码类别:
电子政务应用
开发平台:
Java
- <%
- /**
- * $RCSfile: userSearch.jsp,v $
- * $Revision: 1.3.2.2 $
- * $Date: 2001/02/28 23:56:08 $
- */
- %>
- <%@ 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>Yes</b></font>";
- private final String NO = "<font color='#ff0000' size='-1'><b>No</b></font>";
- %>
- <% ////////////////////////////////
- // 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 create forums::
- 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 forum admin or a system admin
- if( !isUserAdmin && !isSystemAdmin ) {
- request.setAttribute("message","您没有权限查询用户!");
- response.sendRedirect("error.jsp");
- return;
- }
- %>
- <% //////////////////////
- // get parameters
- // paging vars:
- String query = ParamUtils.getParameter(request,"q");
- %>
- <html>
- <head>
- <title></title>
- <style type="text/css">
- .userHeader {
- font-size : 8pt;
- text-align : center;
- }
- </style>
- <link rel="stylesheet" href="style/global.css">
- </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" %>
- <p>
- 结果: <p>
- <% /////////////////////////////
- // do a search
- ProfileManager manager = forumFactory.getProfileManager();
- Iterator userIterator = manager.users();
- Hashtable results = new Hashtable();
- while( query!=null && userIterator.hasNext() ) {
- try
- {
- User user = (User)userIterator.next();
- int userID = user.getID();
- String name="无";
- name = user.getName();
- String username = user.getUsername();
- String email = user.getEmail();
- if( name.toLowerCase().indexOf(query.toLowerCase()) > -1
- || username.toLowerCase().indexOf(query.toLowerCase()) > -1
- || email.toLowerCase().indexOf(query.toLowerCase()) > -1 )
- {
- results.put(""+userID, user);
- }
- }
- catch ( Exception ex )
- {
- //ex.printStackTrace();
- }
- }
- if( results.size() == 0 ) {
- %>
- <i>没有查询到任何记录。</i>
- <%
- } else {
- %>
- <p>
- <form>
- <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="1%" nowrap> ID </td>
- <td width="59%"><b>用户名</b><br>姓名<br>Email</td>
- <td class="userHeader" width="20%" nowrap>修改<br>属性<br></td>
- <td class="userHeader" width="20%" nowrap>删除</td>
- </tr>
- <% Enumeration resultsEnum = results.elements();
- while( resultsEnum.hasMoreElements() ) {
- User user = (User)resultsEnum.nextElement();
- 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>
- <br>
- <%= (name!=null)?name:"<i>no name</i>" %>
- <br>
- <span style="font-size:8pt"><%= email %></span>
- </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='removeUser.jsp?username=<%= username %>';">
- </td>
- </tr>
- <% }
- %>
- </table>
- </td>
- </table>
- <% } %>
- </form>
- </body>
- </html>