<%@ page contentType="text/html;charset=GBK" %>

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

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

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

<%	// Get parameters
	long forumID = ParamUtils.getLongParameter(request,"forum",-1L);
	long threadID = ParamUtils.getLongParameter(request,"thread",-1L);
    long messageID = ParamUtils.getLongParameter(request,"message",-1L);
    int start = ParamUtils.getIntParameter(request,"start",0);
    int range = ParamUtils.getIntParameter(request,"range",20);
    boolean delete = ParamUtils.getBooleanParameter(request,"delete");

    // Load the forum we're working with
    Forum forum = forumFactory.getForum(forumID);

    // Optionally load the thread we're working with
    ForumThread thread = null;
    if (threadID != -1L) {
        thread = forum.getThread(threadID);
    }

    // Optionally load the thread we're working with
    ForumMessage message = null;
    if (messageID != -1L) {
        message = thread.getMessage(messageID);
    }

    // Number of replies to this thread
    int replyCount = thread.getMessageCount()-1;
%>

<%  // 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},
        {"内容管理", "forumContent.jsp?forum="+forumID},
        {title, "forumContent_thread.jsp?forum="+forumID+"&thread="+threadID+"&message="+messageID}
    };
%>
<%@ include file="title.jsp" %>

<font size="-1">
管理单独主题的内容。
</font>

<p>

<%  String msg = getOneTimeMessage(session,"message");
    if (msg != null) {
%>
    <font size="-1" color="#009900"><i><%= msg %></i></font>
    <p>
<%  } %>

<b><%= thread.getName() %></b></font>
<br>
<font size="-1">
此主题共有 <%= replyCount %> 条回复。
</font>

<p>


<%  // loop through all threads in the forum
    ResultFilter filter = new ResultFilter();
    filter.setStartIndex(start);
    filter.setNumResults(range);
    filter.setSortOrder(ResultFilter.ASCENDING);
    Iterator messages = thread.messages(filter);
    while (messages.hasNext()) {
        ForumMessage theMessage = (ForumMessage)messages.next();
%>
<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>
    <td bgcolor="#eeeeee">
        <table cellspacing="2" cellpadding="0" border="0" width="100%">
        <tr>
        	<td width="99%">
            <font size="-1">
            <b><%= theMessage.getSubject() %></b>
            <br>
            <%= JiveGlobals.formatDateTime(theMessage.getCreationDate()) %>
            </font>
            </td>
        	<td width="1%" nowrap>
                <!--<img src="images/button_edit.gif" width="17" height="17" alt="" border="0">-->
                <a href="forumContent_delete.jsp?forum=<%= forumID %>&thread=<%= theMessage.getForumThread().getID() %>&message=<%= theMessage.getID() %>"
                ><img src="images/button_delete.gif" width="17" height="17" alt="删除此消息及其所有回复" border="0"
                ></a>
            </td>
        </tr>
        </table>
    </td>
</tr>
<tr bgcolor="#ffffff">
    <td>
        <font size="-1">
        <%= theMessage.getBody() %>
        </font>
    </td>
</tr>
</table>
</td></tr>
</table>
<br>
<%  } %>

<p>

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