
<%
/**
 *	$RCSfile: editGroup.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:26 $
 */
%>

<%@ page import="java.util.*,
                 com.jivesoftware.forum.*,
                 com.jivesoftware.forum.util.*"
    errorPage="error.jsp"
%>
 
<%@	include file="include/global.jsp" %>
 
<%	// get parameters
	int groupID = ParamUtils.getIntParameter(request,"group",-1);
	String name = ParamUtils.getParameter(request,"name");
	String description = ParamUtils.getParameter(request,"description",true);
	boolean edit = ParamUtils.getBooleanParameter(request,"edit");
    
	// Get a group manager
	GroupManager groupManager = forumFactory.getGroupManager();
    
    // Load the specified group
	Group group = groupManager.getGroup(groupID);
    
    // Put the forum in the session (is needed by the sidebar)
    session.setAttribute("admin.sidebar.groups.currentGroup", group);
    
    // Total number of groups
    int groupCount = groupManager.getGroupCount();
    
	if (edit) {
        group.setName(name);
        if (description != null) {
            group.setDescription(description);
        }
        // done editing, so redirect
        response.sendRedirect("groups.jsp");
        return;
	}
    
    name = group.getName();
    description = group.getDescription();
    
    // 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="include/header.jsp" %>

<p>

<%  // Title of this page and breadcrumbs
    String title = "Edit Group Properties";
    String[][] breadcrumbs = {
        {"Main", "main.jsp"},
        {"Groups Summary", "groups.jsp"},
        {title, "editGroup.jsp?group="+groupID}
    };
%>
<%@ include file="include/title.jsp" %>

<font size="-1">
Some text for this page...
</font>

<form action="editGroup.jsp" method="post">
<input type="hidden" name="group" value="<%= groupID %>">
<input type="hidden" name="edit" value="true">

<font size="-1"><b>Edit Group Fields</b></font>
<ul>
    <table cellpadding="3" cellspacing="0" border="0">
    <tr>
    	<td><font size="-1">Group ID:</font></td>
    	<td><font size="-1"><%= group.getID() %></font></td>
    </tr>
    <tr>
    	<td><font size="-1">Name:</font></td>
    	<td><input type="text" name="name" value="<%= (name!=null)?name:"" %>"></td>
    </tr>
    <tr>
    	<td valign="top"><font size="-1">Description:</font></td>
    	<td><textarea cols="30" rows="5" name="description"><%= (description!=null)?description:"" %></textarea></td>
    </tr>
    <tr>
        <td><font size="-1">&nbsp;</font></td>
        <td><p><input type="submit" value="Save Changes"></td>
    </table>
</ul>
</form>


</body>
</html>

