index.jsp
来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 581 行 · 第 1/2 页
JSP
581 行
<%/** * $RCSfile: index.jsp,v $ * $Revision: 1.21 $ * $Date: 2002/08/10 19:30:41 $ */%><%@ page import="java.util.*, com.jivesoftware.util.*, com.jivesoftware.forum.*, com.jivesoftware.forum.util.*" errorPage="error.jsp"%><% // global.jsp is a collection of utility methods and global variables. // Page authorization and the creation of the authToken and forumFactory // variables is handled there.%><%@ include file="global.jsp" %><% // Put the request URI and query string in the session as an attribute. // This is done so the error.jsp and auth.jsp pages can figure out what // page sent it an error and redirect appropriately. setRedirectURL(request);%><% // The category ID might be passed into this page: long categoryID = ParamUtils.getLongParameter(request,"cat",-1L); // If the category is -1, try loading the category id from the session. This way, // the user will return to the category they used to be on: if (categoryID == -1L) { try { categoryID = Long.parseLong((String)session.getAttribute("jive.category.id")); } catch (NumberFormatException ignored) {} } // If the category ID is -1, the initial category will be the root category: ForumCategory category = null; if (categoryID <= forumFactory.getRootForumCategory().getID()) { category = forumFactory.getRootForumCategory(); } else { category = forumFactory.getForumCategory(categoryID); // Store the category ID in the session. If the user returns to this page, they'll see // the category they were on: session.setAttribute("jive.category.id", String.valueOf(category.getID())); } // Load the root category ForumCategory rootCategory = forumFactory.getRootForumCategory(); int totalDepth = rootCategory.getRecursiveCategoryCount(); boolean oneCategoryLevel = (totalDepth - category.getCategoryCount()) == 0;%><% // Header include. Pass a title into the header page. String title = SkinUtils.getLocalizedString("skin.default.index.title",locale);%><%@ include file="header.jsp" %><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr> <td valign="top" width="98%"> <%-- Breadcrumbs (see admin tool to customize): --%> <font face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>"> <b> <a href="index.jsp"><%= SkinUtils.getLocalizedString("skin.default.global.home",locale) %></a> » <a href="index.jsp" title="<%= SkinUtils.getLocalizedString("skin.default.global.go_back_to_forum_list",locale) %>" ><%= SkinUtils.getLocalizedString("skin.default.global.forums",locale) %></a> </b> </font> <p> <%-- Text describing your community - settable via the admin tool: --%> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <% if (!"false".equals(JiveGlobals.getJiveProperty("skin.default.useDefaultWelcomeText"))) { %> <%= SkinUtils.getLocalizedString("skin.default.global.community_text", locale) %> <% } else { %> <%= JiveGlobals.getJiveProperty("skin.default.communityDescription") %> <% } %> </font> </td> <td width="1%"><img src="images/blank.gif" width="10" height="1" border="0"></td> <td valign="top" width="1%" align="center"> <%@ include file="loginbox.jsp" %> </td></tr></table><p><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td width="98%" valign="top"> <%-- Forum listing cell: --%> <% // If the category is not the root category, print out a link to go // back to the root category if (category.getID() != rootCategory.getID()) { %> <table cellpadding="0" cellspacing="2" border="0"> <tr> <td> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"> <b> <%-- back to main category --%> <a href="index.jsp?cat=<%= rootCategory.getID() %>" title="Click to go back to the main category" ><%= SkinUtils.getLocalizedString("skin.default.index.back_to_main_cat",locale) %></a> <% List parents = new java.util.LinkedList(); parents.add(category); ForumCategory parentCat = category.getParentCategory(); while (parentCat.getID() != rootCategory.getID()) { parents.add(0, parentCat); parentCat = parentCat.getParentCategory(); } for (int i=0; i<parents.size(); i++) { ForumCategory c = (ForumCategory)parents.get(i); // Print the case where the 'c' category is not the current category: if ((i+1) < parents.size()) { %> » <a href="index.jsp?cat=<%= c.getID() %>" title="Click to go back to this category" ><%= c.getName() %></a> <% } else { %> » <%= c.getName() %> <% } } %> </b> </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="4" cellspacing="1" border="0" width="100%"> <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderBgColor") %>"> <td width="1%"><img src="images/blank.gif" width="1" height="1" border="0"></td> <td width="97%"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.headerFontSize") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"> <%-- FORUM NAME --%> <!-- <b><%= SkinUtils.getLocalizedString("skin.default.index.forum_name",locale).toUpperCase(locale) %></b> --> <b>FORUM / CATEGORY NAME</b> </font> </td> <td width="1%" nowrap> <font size="<%= JiveGlobals.getJiveProperty("skin.default.headerFontSize") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"> <%-- TOPICS/MESSAGES --%> <b><%= SkinUtils.getLocalizedString("skin.default.index.topics_messages",locale).toUpperCase(locale) %></b> </font> </td> <td width="1%" nowrap align="center"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.headerFontSize") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.tableHeaderTextColor") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>"> <%-- LAST POST --%> <b><%= SkinUtils.getLocalizedString("skin.default.global.last_post",locale).toUpperCase(locale) %></b> </font> </td> </tr><% // Start by displaying the name of the category, if the current // category is not the root category: if (rootCategory.getID() != category.getID()) {%> <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.categoryCellBgColor") %>"> <td width="1%" align="center" valign="top"> <img src="images/blank.gif" width="12" height="12" vspace="2" border="0"> </td> <td width="99%" colspan="3"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.categoryFontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.categoryFontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.categoryTextColor") %>"> <b><%= category.getName() %></b> </font> </td> </tr><% } // Next, list all forums in the current category: Iterator forums = category.forums(); // If there are no forums in this category and if this is not the // root category, print a message that indicates there are no forums // in this category: if (!forums.hasNext() && rootCategory.getID() != category.getID()) {%> <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableRowColor1") %>"> <td width="1%" align="center" valign="top"> <img src="images/blank.gif" width="12" height="12" vspace="2" border="0"> </td> <td width="99%" colspan="3"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <i><%= SkinUtils.getLocalizedString("skin.default.index.no_forums_in_category", locale) %></i> </font> </td> </tr><% } while (forums.hasNext()) { Forum forum = (Forum)forums.next(); String description = forum.getDescription(); ForumMessage lastPost = null; if (!"false".equals(JiveGlobals.getJiveProperty("skin.default.showLastPostLink"))) { lastPost = SkinUtils.getLastPost(forum); }%> <tr bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableRowColor1") %>"> <td width="1%" align="center" valign="top"> <% if (SkinUtils.isNew(forum, lastVisited)) { %> <img src="images/forum_new.gif" width="12" height="12" vspace="2" border="0"> <% } else { %> <img src="images/forum_old.gif" width="12" height="12" vspace="2" border="0"> <% } %> </td> <td width="97%" valign="top"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <a href="forum.jsp?forum=<%= forum.getID() %>"><%= forum.getName() %></a> <br> <i><%= (description!=null)?description:"" %></i> </font> </td> <td width="1%" nowrap align="center" valign="top"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedNumber(forum.getThreadCount(),locale) %> <%= SkinUtils.getLocalizedString("skin.default.global.slash",locale) %> <%= SkinUtils.getLocalizedNumber(forum.getMessageCount(),locale) %> </font> </td> <td width="1%" nowrap valign="top"> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.formatDate(request,pageUser,forum.getModifiedDate()) %> </font> <% if (lastPost != null) { User lastPostAuthor = lastPost.getUser(); %> <br> <font size="-2" face="<%= JiveGlobals.getJiveProperty("skin.default.buttonFontFace") %>"> <% 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(lastPost.getID()).append("#").append(lastPost.getID()).append("\""); buf.append("title=\"").append(SkinUtils.getLocalizedString("skin.default.index.jump_to_message",locale)); buf.append("\">[[name]] »</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) %>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?