📄 threadmode2.jsp
字号:
<%@ page contentType="text/html;charset=ISO8859_1" %>
<%
/**
* $RCSfile: threadMode2.jsp,v $
* $Revision: 1.4 $
* $Date: 2002/10/07 07:50:53 $
*/
%>
<%@ page import="java.util.*,
com.jivesoftware.forum.*,
com.jivesoftware.forum.util.*"
errorPage="error.jsp"
%>
<%@ include file="global.jsp" %>
<% //
// This page displays the messages in the thread in a "flat" view.
//
// 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 = myEnv.du.getMessageRange(request,response,pageUser);
boolean hilite = ParamUtils.getBooleanParameter(request,"hilite");
boolean redirect = ParamUtils.getBooleanParameter(request,"redirect");
String searchWords = ParamUtils.getParameter(request,"q");
// Load the forum
Forum forum = myEnv.getForumFactory().getForum(forumID);
// The requested thread object
ForumThread thread = forum.getThread(threadID);
// Compute number of topics, messages in this forum, number of pages
int numMessages = thread.getMessageCount();
int numReplies = numMessages-1; // subtract 1 because the root message is counted
int numPages = (int)Math.ceil((double)numMessages/(double)range);
// Variables for message iteration
Iterator messages = null;
// Determine if we need to adjust the start index of the thread iterator.
// If we're passed a message ID, we need to show the thread page that
// messageID is contained on.
if (messageID != -1) {
// get an iterator of all messages
messages = thread.messages();
int index = 0;
int messageRange = myEnv.du.getMessageRange(request,response,pageUser);
// loop through the messages
while (messages.hasNext()) {
ForumMessage message = (ForumMessage)messages.next();
if (message.getID() != messageID) {
index++;
}
else {
// found the message, calculage what page we're on
start = (index/messageRange)*messageRange;
break;
}
}
}
// Root message of the thread
ForumMessage rootMessage = thread.getRootMessage();
ResultFilter filter = ResultFilter.createDefaultMessageFilter();
filter.setStartIndex(start);
filter.setNumResults(range);
// reinitialize the message iterator to show the appropriate range
messages = thread.messages(filter);
// A user manager lets us get information about users
UserManager userManager = myEnv.getForumFactory().getUserManager();
// Get a thread iterator (for the next/previous thread feature)
ForumThreadIterator threadIterator = forum.threads();
// Set its index to this thread
threadIterator.setIndex(thread);
// Get a watch manager to manage watches on this page.
WatchManager watchManager = null;
// Indicates if this thread is watched
boolean isWatchedThread = false;
if (!isGuest) {
watchManager = myEnv.getForumFactory().getWatchManager();
isWatchedThread = watchManager.isWatchedThread(pageUser, thread, WatchManager.NORMAL_WATCH);
}
%>
<% String title = "论坛 - " + thread.getName(); %>
<%@ include file="header.jsp" %>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="99%" valign="top">
<font face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>">
<b><%= rootMessage.getSubject() %></b>
</font>
<br>
<%-- Breadcrumbs --%>
<font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>">
<b>
<a href="<%= JiveGlobals.getJiveProperty("skin.default.homeURL") %>"
>首页</a>
»
<a href="index.jsp" title="返回主题列表"
>论坛</a>
»
<a href="forum.jsp?forum=<%= forumID %>" title="返回主题列表"
><%= forum.getName() %></a>
</b>
</font>
<p>
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<b><%= numReplies %></b> 回复 / <b><%= numPages %></b> 页.
<% if (numReplies > 0) {
String recentUsername = null;
// Get the most recent message in this thread:
ResultFilter recentFilter = new ResultFilter();
recentFilter.setSortOrder(ResultFilter.DESCENDING);
recentFilter.setNumResults(1);
Iterator recentMessages = thread.messages(recentFilter);
ForumMessage recentMessage = null;
if (recentMessages.hasNext()) {
recentMessage = (ForumMessage)recentMessages.next();
}
if (recentMessage != null) {
User recentUser = recentMessage.getUser();
long recentMessageID = recentMessage.getID();
if (!recentMessage.isAnonymous()) {
recentUsername = recentUser.getUsername();
}
// starting page of the recent message:
int recentMessageStart = (numPages-1) * range;
%>
<a href="thread.jsp?forum=<%= forumID %>&thread=<%= threadID %>&start=<%= recentMessageStart %>#<%= recentMessageID %>"
title="此主题最新的回复">更多回复</a>:
本主题最后由
<%= SkinUtils.formatDate(request, response, pageUser, recentMessage.getCreationDate()) %>
<% if (recentMessage.isAnonymous()) { %>
<i>客人</i>
<% } else { %>
<a href="profile.jsp?user=<%= recentUser.getID() %>" title="<%= recentUsername %>'s profile"><%= recentUsername %></a>
<% }
}
}
%>
</font>
</td>
<td valign="top" width="1%" align="center">
<%@ include file="loginbox.jsp" %>
</td>
</tr>
</table>
<% if (isWatchedThread) { %>
<table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableBorderColor") %>"
cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableBorderColor") %>"
cellpadding="3" cellspacing="1" border="0" width="100%">
<tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.prefsHeaderBgColor") %>"><td>
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
您正在监控此主题. 按下面“停止监控”按钮可以停止查看.
<br>
[<a href="watches.jsp?forum=<%= forumID %>">监控选项</a>]
</font>
</td></tr>
</table>
</td></tr>
</table><br>
<% } %>
<table cellpadding="0" cellspacing="2" border="0">
<tr>
<td><a href="post.jsp?forum=<%= forumID %>&thread=<%= threadID %>&reply=true"><img src="images/reply.gif" width="17" height="17" alt="回复此主题" border="0"></a></td>
<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="post.jsp?forum=<%= forumID %>&thread=<%= threadID %>&reply=true" title="Click to reply to this topic">回复此主题</a>
</font>
</td>
<td><img src="images/blank.gif" width="10" height="1" border="0"></td>
<td><a href="search.jsp?forums=<%= forumID %>"><img src="images/search.gif" width="17" height="17" alt="搜索论坛" border="0"></a></td>
<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="search.jsp?forums=<%= forumID %>" title="搜索论坛">搜索论坛</a>
</font>
</td>
<td><img src="images/blank.gif" width="10" height="1" border="0"></td>
<% if (!isGuest) {
if (isWatchedThread) {
%>
<td><a href="watches.jsp?forum=<%= forumID %>&thread=<%= threadID %>&remove=true"><img src="images/watch.gif" width="17" height="17" alt="停止监控此主题" border="0"></a></td>
<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="watches.jsp?forum=<%= forumID %>&thread=<%= threadID %>&remove=true" title="停止监控此主题">停止监控</a>
</font>
</td>
<% } else { %>
<td><a href="watches.jsp?forum=<%= forumID %>&thread=<%= threadID %>&add=true"><img src="images/watch.gif" width="17" height="17" alt="开始监控此主题" border="0"></a></td>
<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="watches.jsp?forum=<%= forumID %>&thread=<%= threadID %>&add=true" title="开始监控此主题">监控此主题</a>
</font>
</td>
<% }
}
%>
</tr>
</table>
<table cellpadding="0" cellspacing="2" border="0" width="100%" align="center">
<tr><td colspan="3"><img src="images/blank.gif" width="1" height="5" border="0"></td></tr>
<tr>
<td width="1%" nowrap>
<% if (threadIterator.hasPrevious()) {
ForumThread prevThread = (ForumThread)threadIterator.previous();
// advance the iterator pointer back to the original index
threadIterator.next();
String subj = prevThread.getRootMessage().getSubject();
// Replace any " in the subject
subj = StringUtils.replace(subj, "\"", """);
%>
<a href="thread.jsp?forum=<%= forumID %>&thread=<%= prevThread.getID() %>"
title="<%= subj %>"><img src="images/prev.gif" width="10" height="10" hspace="2" alt="Topic: <%= subj %>" border="0"></a>
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="thread.jsp?forum=<%= forumID %>&thread=<%= prevThread.getID() %>"
title="Topic: <%= subj %>">上一主题</a>
</font>
<% } else { %>
<% } %>
</td>
<td width="98%" align="center">
<table cellpadding="0" cellspacing="2" border="0">
<tr>
<td><a href="forum.jsp?forum=<%= forumID %>"><img src="images/back_to.gif" width="12" height="12" alt="Go back to the topic listing" border="0"></a></td>
<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="forum.jsp?forum=<%= forumID %>" title="返回主题列表">返回主题列表</a>
</font>
</td>
</tr>
</table>
</td>
<td width="1%" nowrap>
<% if (threadIterator.hasNext()) {
ForumThread nextThread = (ForumThread)threadIterator.next();
String subj = nextThread.getRootMessage().getSubject();
%>
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
<a href="thread.jsp?forum=<%= forumID %>&thread=<%= nextThread.getID() %>"
title="<%= subj %>">下一主题</a>
</font>
<a href="thread.jsp?forum=<%= forumID %>&thread=<%= nextThread.getID() %>"
title="<%= subj %>"><img src="images/next.gif" width="10" height="10" hspace="2" alt="Topic: <%= subj %>" border="0"></a>
<% } else { %>
<% } %>
</td>
</tr>
</table>
<% String paginatorHTML = myEnv.du.getThreadPaginator(forumID, threadID, numMessages, numReplies, numPages, start, range);
%>
<table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderBgColor") %>"
cellpadding="3" cellspacing="0" border="0" width="100%" align="center">
<tr><td>
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>">
<%= paginatorHTML %>
</font>
</td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -