forum.jsp

来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 459 行 · 第 1/2 页

JSP
459
字号
<%  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 = SkinUtils.getLocalizedString("skin.default.global.guest",locale);        if (!rootMessage.isAnonymous()) {            username = author.getUsername();        }        else {            String name = rootMessage.getProperty("name");            String email = rootMessage.getProperty("email");            String nameAndEmail = 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 pages of messages in this thread		int numMsgPages = (int)Math.ceil((double)numThreadMessages/(double)userMessageRange);        // Indicate if this thread has been modified since the last time the        // user visited the page        boolean isNew = (thread.getModifiedDate().getTime() > lastVisited.getTime());        // The last posted message in this thread and its user:        ForumMessage lastPost = null;        User lastPostAuthor = null;        if (!"false".equals(JiveGlobals.getJiveProperty("skin.default.showLastPostLink"))) {            lastPost = SkinUtils.getLastPost(thread);            if (lastPost != null) {                lastPostAuthor = lastPost.getUser();            }        }        // determine if the thread is locked or archived        boolean isLocked = "true".equals(thread.getProperty("locked"));        boolean isArchived = "true".equals(thread.getProperty("archived"));%>    <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableRowColor1") %>">        <td nowrap>        <%  if (isArchived) { %>            <img src="images/archived.gif" width="11" height="14" border="0">        <%  } else if (isLocked) { %>            <img src="images/lock.gif" width="9" height="12" border="0" vspace="1">        <%  } else { %>            <%  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="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"             face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">            <a href="thread.jsp?forum=<%= forumID %>&thread=<%= threadID %>&tstart=<%= start %>&trange=<%= range %>" class="forum"><b><%= subject %></b></a>            </font>        <%  // Print out "Page 1 2..." links. This makes it easy to jump to other            // parts of the thread. (Only do this if we're in flat-thread mode            // since paging is not supported in a threaded view).            if (numMsgPages > 1                    && "flat".equals(JiveGlobals.getJiveProperty("skin.default.threadMode")))            {        %>            &nbsp;		    <font size="<%= JiveGlobals.getJiveProperty("skin.default.headerFontSize") %>"             face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>">		    <%= SkinUtils.getLocalizedString("skin.default.global.left_bracket",locale) %>            <%= SkinUtils.getLocalizedString("skin.default.global.page",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %>            <%  for (int i=0; (i<numMsgPages && i<5); i++) { %>                <a href="thread.jsp?forum=<%=forumID%>&thread=<%= threadID %>&start=<%= (i*userMessageRange) %>&msRange=<%= userMessageRange %>&tstart=<%= start %>&trange=<%= range %>"                ><%= SkinUtils.getLocalizedNumber((i+1),locale) %></a>            <%  }                // If there are greater than 5 subpages, print out a "... x" where                // x is the last page                if (numMsgPages > 5) {            %>                <%= SkinUtils.getLocalizedString("skin.default.global.elipse",locale) %>                <a href="thread.jsp?forum=<%=forumID%>&thread=<%= threadID %>&start=<%= ((numMsgPages-1)*userMessageRange) %>&msRange=<%= userMessageRange %>&tstart=<%= start %>&trange=<%= range %>"                 ><%= SkinUtils.getLocalizedNumber(numMsgPages,locale) %></a>            <%  } %>                <%= SkinUtils.getLocalizedString("skin.default.global.right_bracket",locale) %>            </font>            <%  } // end if numMsgPages > 1 %>        </td>        <td align="center">            <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"             face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"             color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">            <%= SkinUtils.getLocalizedNumber((thread.getMessageCount()-1),locale) %>            </font>        </td>        <td nowrap>            <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"             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>            <table cellpadding="0" cellspacing="0" border="0" width="100%">            <tr><td nowrap>                    <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"                     face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"                     color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">                    <%= SkinUtils.formatDate(request,pageUser,thread.getModifiedDate()) %>                    </font>                </td>                <%  if (!"false".equals(JiveGlobals.getJiveProperty("skin.default.showLastPostLink"))) { %>                <td>&nbsp;</td>                <td align="right" nowrap>                    <font size="-2" face="verdana">                    <%  StringBuffer buf = new StringBuffer("<a href=\"thread.jsp?forum=");                        buf.append(lastPost.getForumThread().getForum().getID());                        buf.append("&thread=").append(lastPost.getForumThread().getID()).append("&message=");                        buf.append("&tstart=").append(start).append("&trange=").append(range);                        buf.append(lastPost.getID()).append("#").append(lastPost.getID()).append("\"");                        buf.append("title=\"").append(SkinUtils.getLocalizedString("skin.default.index.jump_to_message",locale));                        buf.append("\">[[name]] &raquo;</a>");                        String lastPostLink = buf.toString();                        if (lastPostAuthor == null) {                            String name = lastPost.getProperty("name");                            if (name != null) {                                lastPostLink = StringUtils.replace(lastPostLink, "[[name]]", "<i>"+name+"</i>");                                List nameDisplay = new ArrayList(1);                                nameDisplay.add(lastPostLink);                    %>                            <%= SkinUtils.getLocalizedString("skin.default.global.last_post_by", locale, nameDisplay) %>                    <%      } else {                                lastPostLink = StringUtils.replace(lastPostLink, "[[name]]", "<i>Guest</i>");                                List nameDisplay = new ArrayList(1);                                nameDisplay.add(lastPostLink);                    %>                            <%= SkinUtils.getLocalizedString("skin.default.global.last_post_by", locale, nameDisplay) %>                    <%      }                        }                        else {                            lastPostLink = StringUtils.replace(lastPostLink, "[[name]]", lastPostAuthor.getUsername());                            List nameDisplay = new ArrayList(1);                            nameDisplay.add(lastPostLink);                    %>                            <%= SkinUtils.getLocalizedString("skin.default.global.last_post_by", locale, nameDisplay) %>                    <%  } %>                    </font>                </td>                <%  } %>            </tr>            </table>        </td>    </tr><%  } %>    </table>    </td></tr></table><%  } %><%  if (numThreads > 0) { %><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 size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"     face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"     color="<%= JiveGlobals.getJiveProperty("skin.default.paginatorTextColor") %>">    <%= SkinUtils.getLocalizedString("skin.default.forum.pages_in_forum",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %>    <b><%= numPages %></b>    &nbsp;    <%= 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 size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"     face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"     color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">    <i><%= SkinUtils.getLocalizedString("skin.default.forum.denotes_new_messages",locale) %></i>    </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"         title="<%= SkinUtils.getLocalizedString("skin.default.forum.go_back_to_forum",locale) %>" border="0"></a>    </td>	<td nowrap>        <font size="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontSize") %>"         face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>">        &nbsp;        <a href="index.jsp" title="<%= SkinUtils.getLocalizedString("skin.default.forum.go_back_to_forum",locale) %>"         ><%= SkinUtils.getLocalizedString("skin.default.forum.forum_list",locale) %></a>        </font>    </td></tr></table><%  } // end if numThreads > 0 %><p><%@ include file="footer.jsp" %>

⌨️ 快捷键说明

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