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

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

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

<%! // Global vars, methods, etc...

    // Date formatter for creation date/modified date
    SimpleDateFormat dateFormatter = new SimpleDateFormat("");
%>

<%	// Get parameters
	long forumID = ParamUtils.getLongParameter(request,"forum",-1L);
    String name = ParamUtils.getParameter(request,"name");
    String description = ParamUtils.getParameter(request,"description",true);
    boolean saveName = ParamUtils.getBooleanParameter(request,"saveName");

    // Load up the forum specified
    Forum forum = forumFactory.getForum(forumID);

    // Put the forum in the session (is needed by the sidebar)
    session.setAttribute("admin.sidebar.forums.currentForumID", ""+forumID);

    // save the name & description if requested
    if (saveName) {
        if (name != null) {
            forum.setName(name);
        }
        if (description != null) {
            forum.setDescription(description);
        }
        setOneTimeMessage(session,"message","修改已保存。");
        response.sendRedirect("editForum.jsp?forum="+forumID);
        return;
    }

    name = forum.getName();
    description = forum.getDescription();
%>

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

<p>

<%  // Title of this page and breadcrumbs
    String title = "编辑论坛属性";
    String[][] breadcrumbs = {
        {"主页面", "main.jsp"},
        {"论坛", "forums.jsp"},
        {"编辑论坛", "editForum.jsp?forum="+forumID}
    };
%>
<%@ include file="title.jsp" %>

<font size="-1">
在以下表单中设置论坛标题及描述。
</font>

<p>

<font size="-1"><b>总体信息</b></font>
<ul>
    <table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="">
    <tr><td>
    <table bgcolor="<%= tblBorderColor %>" cellpadding="3" cellspacing="1" border="0" width="100%">
    <tr bgcolor="#eeeeee">
        <td align="center"><font size="-2" face="verdana"><b>论坛ID</b></font></td>
        <td align="center"><font size="-2" face="verdana"><b>主题</b></font></td>
        <td align="center"><font size="-2" face="verdana"><b>消息</b></font></td>
        <td align="center"><font size="-2" face="verdana"><b>创建时间</b></font></td>
        <td align="center"><font size="-2" face="verdana"><b>最后回复时间</b></font></td>
    </tr>
    <tr bgcolor="#ffffff">
        <td align="center" bgcolor="#eeeeee"><font size="-1"><%= forum.getID() %></font></td>
        <td align="center"><font size="-1"><%= forum.getThreadCount() %></font></td>
        <td align="center"><font size="-1"><%= forum.getMessageCount() %></font></td>
        <td align="center"><font size="-1">&nbsp;<%= JiveGlobals.formatDateTime(forum.getCreationDate()) %>&nbsp;</font></td>
        <td align="center"><font size="-1">&nbsp;<%= JiveGlobals.formatDateTime(forum.getModifiedDate()) %>&nbsp;</font></td>
    </tr>
    </table>
    </td></tr>
    </table>
</ul>

<font size="-1"><b>编辑标题和描述</b></font>
<ul>
    <font size="-1">
    使用以下表单改变论坛标题及描述。
    </font>
    <p>
    <%  String message = getOneTimeMessage(session,"message");
        if (message != null) {
    %>
        <font size="-1" color="<%= messageColor %>"><b><i><%= message %></i></b></font>
        <p>
    <%  } %>
    <form action="editForum.jsp" method="post">
    <input type="hidden" name="saveName" value="true">
    <input type="hidden" name="forum" value="<%= forumID %>">
    <table cellpadding="2" cellspacing="0" border="0">
    <tr>
    	<td><font size="-1">标题:</font></td>
    	<td><input type="text" name="name" size="40" maxlength="100" value="<%= (name!=null)?name:"" %>"></td>
    </tr>
    <tr>
    	<td valign="top"><font size="-1">描述:</font></td>
    	<td><textarea name="description" cols="40" rows="5" wrap="virtual"><%= (description!=null)?description:"" %></textarea></td>
    </tr>
    <tr>
    	<td>&nbsp;</td>
    	<td><input type="submit" value="保存修改"></td>
    </tr>
    </table>
    </form>
</ul>

<form action="forums.jsp">
<br><hr size="1">
<center>
<input type="submit" value="返回论坛列表">
</center>
</form>

<p>

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