⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forum.jsp~1~

📁 jive-jdon是非常值得研究的一个开源项目
💻 JSP~1~
字号:
<%@ page contentType="text/html;charset=ISO8859_1" %>

<%
/**
 *	$RCSfile: forum.jsp,v $
 *	$Revision: 1.3 $
 *	$Date: 2002/09/30 14:56:16 $
 */
%>

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


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

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

    // Load the forum
    Forum forum = myEnv.getForumFactory().getForum(forumID);
%>

<%  String title = "论坛 - " + forum.getName(); %>
<%@ include file="header.jsp" %>

<%  // Create a ResultFilter for creating thread iterators and getting thread
    // counts
    ResultFilter filter = new ResultFilter();
    filter.setStartIndex(start);
    filter.setNumResults(range);
    // Set the moderation level minimum
    filter.setModerationRangeMin(forum.getModerationMinThreadValue());

    // More forum properties
    int numThreads = forum.getThreadCount(filter);
    int numMessages = forum.getMessageCount(filter);

    // Iterator of threads
    ForumThreadIterator threads = forum.threads(filter);
%>

<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>
    &raquo;
    <a href="forum.jsp?forum=<%= forumID %>" title="返回热门主题列表"
    ><%= forum.getName() %></a>
    </b>
    </font>
    <br>

    <%-- Forum description, message & thread count summaries --%>

    <font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">
    <b><%= numMessages %></b> 消息 /<b><%= numThreads %></b> 主题 .
    最后回复: <%= SkinUtils.formatDate(request,response,pageUser,forum.getModifiedDate()) %>.
    <p>
    <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
    <%  String description = forum.getDescription(); %>
    <i><%= (description!=null)?description:"" %></i>
    </font>

    </td>
    <td valign="top" width="1%" align="center">
    <%@ include file="loginbox.jsp" %>
    </td>
</tr>
</table>
<table cellpadding="0" cellspacing="2" border="0">
<tr>
	<td><a href="post.jsp?forum=<%= forumID %>"><img src="images/post.gif" width="17" height="17" alt="Click to start a new topic" border="0"></a></td>
	<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
        &nbsp;<a href="post.jsp?forum=<%= forumID %>" title="发起新主题">发新帖</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") %>">
        &nbsp;<a href="search.jsp?forums=<%= forumID %>" title="在此论坛中搜索消息">搜索论坛</a>
        </font>
    </td>
    <td><img src="images/blank.gif" width="30" height="1" border="0"></td>
	<td><a href="index.jsp"><img src="images/back_to.gif" width="12" height="12" alt="返回论坛列表" border="0"></a></td>
	<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
        &nbsp;<a href="index.jsp" title="返回论坛列表">返回论坛列表</a>
        </font>
    </td>
</tr>
</table>

<p>

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

<%  
String hrefname="forum.jsp?forum="+forumID;
String paginatorHTML = myEnv.du.getForumPaginator(hrefname, numThreads, 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>

<%  if (!threads.hasNext()) { %>
    <center>
    <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
    <i>这个论坛还没有主题发表.</i>
    </font>
    </center>
<%  } else { %>
<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>
<%  int row = 0;
    while (threads.hasNext()) {
        ForumThread thread = (ForumThread)threads.next();
        long threadID = thread.getID();
        ForumMessage rootMessage = thread.getRootMessage();
        String subject = rootMessage.getSubject();
        User author = rootMessage.getUser();
        String username = "Guest";
        if (!rootMessage.isAnonymous()) {
            username = author.getUsername();
        }
        else {
            String name = rootMessage.getProperty("name");
            String email = rootMessage.getProperty("email");
            String nameAndEmail = myEnv.du.getNameAndEmailDisplay(name, email);
            if (nameAndEmail != null) {
                username = nameAndEmail;
            }
        }
		// Number of topics, messages in this forum
		int numThreadMessages = thread.getMessageCount();
        int numReplies = numThreadMessages - 1;
        // number of messages to show per thread page:
        int messageRange = myEnv.du.getMessageRange(request,response,pageUser);
		// Number of pages of messages in this thread
		int numMsgPages = (int)Math.ceil((double)numThreadMessages/(double)messageRange);
        // Indicate if this thread has been modified since the last time the
        // user visited the page
        boolean isNew = (thread.getModifiedDate().getTime() > lastVisited.getTime());
        ForumMessage lastPost = myEnv.du.getLastPost(thread);
            User lastPostAuthor = null;
            if (lastPost != null) {
                lastPostAuthor = lastPost.getUser();
        }

%>
    <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableRowColor1") %>">
        <td nowrap>
        <%  if (isNew) { %>
            <img src="images/topic_new.gif" width="8" height="8" vspace="4" border="0">
        <%  } else { %>
            <img src="images/topic_old.gif" width="8" height="8" vspace="4" border="0">
        <%  } %>
        </td>
        <td>
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
            <a href="thread.jsp?forum=<%= forumID %>&thread=<%= threadID %>" class="forum"><%= subject %></a>
            </font>
<%          // Print out "Page 1 2..." links. This makes it easy to jump to other
            // parts of the thread.
            if (numMsgPages > 1) {
%>          &nbsp;
		    <font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>">
		    [页:
<%          for (int i=0; (i<numMsgPages && i<5); i++) { %>
		    <a href="thread.jsp?forum=<%=forumID%>&thread=<%= threadID %>&start=<%= (i*userMessageRange) %>&msRange=<%= userMessageRange %>"
		    ><%= i+1 %></a>
<%          }
            if (numMsgPages > 5) {
%>
		    ... <a href="thread.jsp?forum=<%=forumID%>&thread=<%= threadID %>&start=<%= ((numMsgPages-1)*userMessageRange) %>&msRange=<%= userMessageRange %>"><%= numMsgPages %></a>
<%          } %>
		    ]
		    </font>
<%          } %>
        </td>
        <td align="center">
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
            color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">
            <%= (thread.getMessageCount()-1) %>
            </font>
        </td>
        <td nowrap>
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
            &nbsp;
            <%  if (rootMessage.isAnonymous()) { %>
            <i><%= username %></i>
            <%  } else { %>
            <a href="profile.jsp?user=<%= author.getID() %>"><b><%= username %></b></a>
            <%  } %>
            &nbsp;
            </font>
        </td>
        <td nowrap>
            <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
             color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">
            <%= SkinUtils.formatDate(request,response,pageUser,thread.getModifiedDate()) %>
            </font>
                <font size="-2" face="verdana">
                <%  if (lastPostAuthor == null) { %>
                    by: <i>Guest</i>
                <%  } else { %>
                    by: <a href="thread.jsp?forum=<%= lastPost.getForumThread().getForum().getID() %>&thread=<%= lastPost.getForumThread().getID() %>&message=<%= lastPost.getID() %>#<%= lastPost.getID() %>"
                         title="Jump to Message"
                         ><%= lastPostAuthor.getUsername() %> &raquo;</a>
                <%  } %>
                </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>

<table cellpadding="3" cellspacing="0" border="0">
<tr><td>
    <img src="images/topic_new.gif" width="8" height="8" vspace="2" border="0">
</td><td>
    <font class=p1 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
    color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">
    <b>表示在您最后一次访问本论坛有新消息发布.</b>
    </font>
</td></tr>
</table>

<p>

<table cellpadding="0" cellspacing="2" border="0">
<tr>
	<td><a href="index.jsp"><img src="images/back_to.gif" width="12" height="12" alt="返回论坛列表" border="0"></a></td>
	<td nowrap><font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">
        &nbsp;<a href="index.jsp" title="返回论坛列表">返回论坛列表</a>
        </font>
    </td>
</tr>
</table>

<p>

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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -