<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*,gbase.db.*" %>
<%@ include file="../checkLogin.jsp" %>
<%@ page import="java.util.*,java.text.SimpleDateFormat,com.jivesoftware.forum.*,com.jivesoftware.forum.util.*"%>
<SCRIPT language="JavaScript" src="../js/util.js"></SCRIPT>
<LINK href="../css/css.css" rel=stylesheet>
<html>
<head>
<title>
论坛内容管理
</title>
</head>
<body leftmargin="0" topmargin="0">

<!--导航-->
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
		<td width="100%" height="20"  bgcolor="#eeeeee" class="p2">您当前所在的位置>>论坛内容管理</td>
	   </tr>
       <tr>
          <td width="100%" height="2"> <img border="0" src="../images/spacer.gif" width="1" height="3"></td>
       </tr>
    </table>
<!--标题-->
  <div align="center">
   <table border="0" width="100%" cellspacing="0" cellpadding="0" height="34">
	<tr>
		<td width="159" background="../images/back_board2.gif" nowrap valign="bottom"><span class="title01">&nbsp;<span class="style1">修改论坛内容</span></span></td>
		<td valign="bottom" align="right" width="642"></td>
	</tr>
	<tr>
		<td bgcolor="#2C9CC4" colspan="2"><img border="0" src="../images/bline_3.gif" width="1" height="2"></td>
	</tr>
</table>
</div><br>
<%	// 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
    Authorization authToken = AuthorizationFactory.getAuthorization("admin-user-web-admin", "admin");
    ForumFactory forumFactory = ForumFactory.getInstance(authToken);
    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;
%>
<b>&nbsp;&nbsp;<%= thread.getName() %></b></font>
<br>
<font size="-1">
&nbsp;&nbsp;此主题共有 <%= 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="#cccccc" cellpadding="0" cellspacing="0" border="0" width="97%" align="center">
<tr><td>
<table bgcolor="#cccccc" 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="../../jive/admin/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>
<%  } %>

