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

<%@ 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.groups.start"));
        } catch (Exception e) {}
    }
    else {
        session.setAttribute("admin.groups.start",start+"");
    }

	// get an Iterator of groups
	GroupManager manager = forumFactory.getGroupManager();
	Iterator groups = manager.groups(start, range);

    // Total group count
	int groupCount = manager.getGroupCount();

    // 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.groups.currentGroup");
%>

<%  // 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, "groups.jsp"}
    };
%>
<%@ include file="title.jsp" %>

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

<p>

<%	String message = getOneTimeMessage(session,"admin.groups.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>编辑</b></font></td>
    <td align="center" nowrap><font size="-2" face="verdana"><b>删除</b></font></td>
</tr>
<%  while (groups.hasNext()) {
        Group group = (Group)groups.next();
%>
<tr bgcolor="#ffffff">
    <td align="center" width="2%"><font size="-1"><%= group.getID() %></font></td>
    <td width="80%"><font size="-1"><a href="editGroup.jsp?group=<%= group.getID() %>"><%= group.getName() %></a><br><%= group.getDescription() %></font></td>
    <td width="8%" align="center"><font size="-1"><%= group.getMemberCount() %></font></td>
    <td align="center" width="5%"
        ><a href="editGroup.jsp?group=<%= group.getID() %>"
        ><img src="images/button_edit.gif" width="17" height="17" alt="Edit Group Properties..." border="0"
        ></a
        ></td>
    <td align="center" width="5%"
        ><a href="removeGroup.jsp?group=<%= group.getID() %>"
        ><img src="images/button_delete.gif" width="17" height="17" alt="Delete Group..." border="0"
        ></a
        ></td>
</tr>
<%  } %>
</table>
</td></tr>
</table>

<p>

</body>
</html>

