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

<%
/**
 *	$RCSfile: usermessages.jsp,v $
 *	$Revision: 1.1 $
 *	$Date: 2002/09/30 14:53:24 $
 */
%>

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


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

<%  // Get parameters
    long userID = ParamUtils.getLongParameter(request,"user",-1L);
    String username = ParamUtils.getParameter(request,"username");
//    long forumID = ParamUtils.getLongParameter(request,"forum",-1L);
    int start = ParamUtils.getIntParameter(request,"start",0);
    int range = myEnv.du.getThreadRange(request,response,pageUser);


%>

<%  String title = "user' all post"; %>
<%@ include file="header.jsp" %>



<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
    <td valign="top" width="99%">

    <%-- Breadcrumbs --%>

    <font face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>">
    <b>
    <a href="<%= JiveGlobals.getJiveProperty("skin.default.homeURL") %>"
    >首页</a>
    &raquo;
    <a href="index.jsp" title="返回论坛列表"
    >论坛</a>
        </font>

    </td>
    <td valign="top" width="1%" align="center">
    <%@ include file="loginbox.jsp" %>
    </td>
</tr>
</table>


<p>

<%

    User user=myEnv.getUser(userID);

    int numMessages = myEnv.getForumFactory().getUserManager().userMessageCount(user);


        // Number of
    int numPages = 0;
    if (numMessages != range) {
        numPages = (int)Math.ceil((double)numMessages/(double)range);
    } else {
        numPages = 1;
    }
%>

<%
String hrefname="usermessages.jsp?user="+user.getID();
String paginatorHTML = myEnv.du.getForumPaginator(hrefname, numMessages, numPages, start, range);
 %>


<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
    <td>
    <font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
    <%= paginatorHTML %>
    </font>
    </td>
</tr>
</table>

<table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableBorderColor") %>"
 cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td>
    <table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableBorderColor") %>"
     cellpadding="3" cellspacing="1" border="0" width="100%">
    <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderBgColor") %>">
        <td width="1%">&nbsp;</td>
        <td width="96%"><font class=p2 color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"><b>&nbsp; 主题名</b></font></td>
          <td width="1%" nowrap><font class=p2 color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"><b>&nbsp;
            论坛&nbsp;</b></font></td>
        <td width="1%" align="center" nowrap><font class=p2 color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"><b>&nbsp; 作者 &nbsp;</b></font></td>
          <td width="1%" nowrap align="center"><font class=p2 color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"><b>发表日期</b></font></td>
    </tr>
<%
    String bgcolor = "";
    int row = 1;
    Iterator messages=myEnv.getForumFactory().getUserManager().userMessages(user,start,range);
    while (messages.hasNext()) {
        ForumMessage message = (ForumMessage)messages.next();
        User author = message.getUser();

        if (row++%2 == 1) {
                 bgcolor = JiveGlobals.getJiveProperty("skin.default.tableRowColor1");
        }
        else {
                 bgcolor = JiveGlobals.getJiveProperty("skin.default.tableRowColor2");
        }
        ForumThread thread=message.getForumThread();
        Forum forum=thread.getForum();

%>
    <tr bgcolor="<%=  bgcolor %>">
        <td nowrap>
        </td>
        <td>
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
            <a href="thread.jsp?forum=<%= forum.getID()%>&thread=<%= thread.getID() %>&message=<%=message.getID()%>#<%=message.getID()%>" class="forum"><%= message.getSubject() %></a>
            </font>

        </td>
		<td nowrap>
    		<font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
		     <a href="forum.jsp?forum=<%= forum.getID() %>"><%= forum.getName() %></a>
			 </font>
		</td>
        <td nowrap>
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
            <a href="profile.jsp?user=<%= user.getID() %>"><b><%= user.getUsername() %></b></a>
            </font>
        </td>
        <td nowrap>
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
             color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">
            <%= SkinUtils.formatDate(request,response,pageUser,message.getModifiedDate()) %>
            </font>
        </td>
    </tr>
<%  } %>
    </table>
    </td>
</tr>
</table>


<table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableBorderColor") %>" cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
    <td>
<table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.paginatorTableBgColor") %>" cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
    <td>
    <font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
    color="<%= JiveGlobals.getJiveProperty("skin.default.paginatorTextColor") %>">
    <%=
paginatorHTML
 %>
    </font>
    </td>
</tr>
</table>
    </td>
</tr>
</table>
<br>
<p>



<p>

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