<%@ page contentType="text/html;charset=GBK" %>
<%
/**
 *	$RCSfile: users.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:20 $
 */
%>

<%@ page import="java.util.*,
                 com.jivesoftware.forum.*,
				 com.jivesoftware.forum.util.*"
    errorPage="error.jsp"
%>

<%!	// Global vars, methods, etc

	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>";
%>

<%@ include file="global.jsp" %>

<%	// get parameters
	int start = ParamUtils.getIntParameter(request,"start",0);
	int range = ParamUtils.getIntParameter(request,"range",10);

    // if the start isn't passed in as a parameter, look for it in the session
    if (request.getParameter("start") == null) {
        try {
            start = Integer.parseInt((String)session.getAttribute("admin.users.start"));
        } catch (Exception e) {}
    }
    else {
        session.setAttribute("admin.users.start",start+"");
    }

	// get an Iterator of users
	UserManager manager = forumFactory.getUserManager();
	Iterator users = manager.users(start, range);

    // Total user count
	int userCount = manager.getUserCount();

    // Remove the user in the session (if we come to this page, the sidebar
    // shouldn't show the specific user options).
    session.removeAttribute("admin.sidebar.users.currentUser");
%>

<%  // special onload command to load the sidebar
    onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=users';\"";
%>
<%@ include file="header.jsp" %>

<p>

<%  // Title of this page and breadcrumbs
    String title = "用户概览";
    String[][] breadcrumbs = {
        {"主页面", "main.jsp"},
        {title, "users.jsp"}
    };
%>
<%@ include file="title.jsp" %>

<font size="-1">
共有 <%= userCount %> 个用户(每页显示 <%= range %> 个)。
你可以<a href="createUser.jsp">创建一个新用户</a>。
</font>

<p>

<%	String message = getOneTimeMessage(session,"admin.users.message");
    if (message != null) {
%>
	<font size="-1"><i><%= message %></i></font>
    <p>
<%	} %>

<table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td>
<table bgcolor="<%= tblBorderColor %>" cellpadding="3" cellspacing="1" border="0" width="100%">
<tr bgcolor="#eeeeee">
    <td align="center" nowrap><font size="-2" face="verdana"><b>用户ID</b></font></td>
    <td align="center" nowrap><font size="-2" face="verdana"><b>用户名</b></font></td>
    <td align="center" nowrap><font size="-2" face="verdana"><b>姓名</b></font></td>
    <td align="center" nowrap><font size="-2" face="verdana"><b>EMAIL</b></font></td>
    <td align="center" nowrap><font size="-2" face="verdana"><b>编辑</b></font></td>
    <td align="center" nowrap><font size="-2" face="verdana"><b>删除</b></font></td>
</tr>
<%  while (users.hasNext()) {
        User user = (User)users.next();
        String name = user.getName();
        String email = user.getEmail();
%>
<tr bgcolor="#ffffff">
    <td align="center" width="2%"><font size="-1"><%= user.getID() %></font></td>
    <td width="30%"><font size="-1"><a href="editUser.jsp?user=<%= user.getID() %>"><%= user.getUsername() %></a></font></td>
    <td width="30%"><font size="-1"><%= (name!=null)?name:"" %></font></td>
    <td width="30%"><font size="-1"><%= (email!=null)?email:"" %></font></td>
    <td align="center" width="4%"
        ><a href="editUser.jsp?user=<%= user.getID() %>"
        ><img src="images/button_edit.gif" width="17" height="17" alt="编辑用户属性..." border="0"
        ></a
        ></td>
    <td align="center" width="4%"
        ><a href="removeUser.jsp?user=<%= user.getID() %>"
        ><img src="images/button_delete.gif" width="17" height="17" alt="删除用户..." border="0"
        ></a
        ></td>
</tr>
<%  } %>
</table>
</td></tr>
</table>

<p>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<%  if (start > 0) { %>
	<td width="1%" nowrap><font size="-1"><a href="users.jsp?start=<%= start-range %>">上<%= range %>个用户</a></font></td>
<%  } else { %>
	<td width="1%" nowrap><font size="-1">&nbsp;</font></td>
<%  } %>

<%  if (start > 0) { %>
	<td width="98%" align="center"><font size="-1"><a href="users.jsp?start=0">第一页</a></font></td>
<%  } else { %>
	<td width="98%" nowrap><font size="-1">&nbsp;</font></td>
<%  } %>

<%  if (start+range < userCount) { %>
	<td width="1%" nowrap><font size="-1"><a href="users.jsp?start=<%= start+range %>">下<%= range %>个用户</a></font></td>
<%  } else { %>
	<td width="1%" nowrap><font size="-1">&nbsp;</font></td>
<%  } %>
</tr>
</table>

<p>

<form action="userSearch.jsp">
<input type="hidden" name="lookup" value="true">
<font size="-1"><b>查找用户</b></font><p>
<ul>
    <font size="-1">用户名:</font>
    <input type="text" name="username" value="" size="30" maxlength="50">
    <input type="submit" value="查找">
</ul>
</form>

</body>
</html>


