searchbox.jsp

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

JSP
119
字号
<%/** *	$RCSfile: searchbox.jsp,v $ *	$Revision: 1.5 $ *	$Date: 2002/06/23 23:58:27 $ */%><%@ page import="java.util.*,                 com.jivesoftware.forum.*,                 com.jivesoftware.forum.util.*"%><%  // Since this page is statically included, it assumes a "forumFactory"    // variable which is an instance of ForumFactory.    // Get the root category: (all category objects on this page are called    // "cat" to avoid naming problems in other pages)    ForumCategory cat = forumFactory.getRootForumCategory();%><table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.tableBorderColor") %>" cellpadding="1" cellspacing="0" border="0" width="200"><tr><td>    <table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.sidebarHeaderBgColor") %>"     cellpadding="4" cellspacing="0" border="0" width="100%">    <tr>        <td align="center">            <font size="<%= JiveGlobals.getJiveProperty("skin.default.headerFontSize") %>"             color="<%= JiveGlobals.getJiveProperty("skin.default.sidebarHeaderTextColor") %>"             face="<%= JiveGlobals.getJiveProperty("skin.default.headerFontFace") %>">            <b><%= SkinUtils.getLocalizedString("skin.default.global.search",locale).toUpperCase(JiveGlobals.getLocale()) %></b>            </font>        </td>    </tr>    </table></td></tr><tr><td>    <table bgcolor="<%= JiveGlobals.getJiveProperty("skin.default.sidebarBgColor") %>"     cellpadding="3" cellspacing="0" border="0" width="100%">    <form action="search.jsp">    <input type="hidden" name="search" value="true">    <tr>    <td width="99%"><input type="text" name="q" style="width:100%;"></td>    <td width="1%"><input type="image" src="images/go.gif" width="17" height="17" border="0" title="<%= SkinUtils.getLocalizedString("skin.default.index.click_to_search",locale) %>"></td>    </tr>    <tr>    <td colspan="2">        <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>"         face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">        <select size="6" style="width:100%;" multiple name="forums">        <option value="-1" selected><%= SkinUtils.getLocalizedString("skin.default.global.all_forums_default",locale) %>    <%  // First, print out all the forums in the root category:        String forumName = "";        int maxNameLength = 20;        for (Iterator iter=cat.forums(); iter.hasNext();) {            Forum f = (Forum)iter.next();            forumName = f.getName();            if (forumName.length() > maxNameLength) {                forumName = forumName.substring(0, maxNameLength)                        + SkinUtils.getLocalizedString("skin.default.global.elipse",locale);            }    %>        <option value="<%= f.getID() %>">&nbsp;&#149; <%= forumName %>    <%  }        // Next, recursively loop through        for (Iterator iter=cat.recursiveCategories(); iter.hasNext();) {            cat = (ForumCategory)iter.next();            int depth = cat.getCategoryDepth();            int chop = (maxNameLength-(depth*2)); // 2 characters for each level            if (chop < 0) {                chop = 10;            }            String catName = cat.getName();            if (catName.length() > chop) {                catName = catName.substring(0, chop)                        + SkinUtils.getLocalizedString("skin.default.global.elipse",locale);            }            String buf = getCategoryBuffer(cat, "&nbsp;&nbsp;");    %>        <option value="cid<%= cat.getID() %>"><%= buf %><%= catName %>    <%      // Forums in this category:            for (Iterator iter2=cat.forums(); iter2.hasNext();) {                Forum f = (Forum)iter2.next();                forumName = f.getName();                if (forumName.length() > chop) {                    forumName = forumName.substring(0, chop)                            + SkinUtils.getLocalizedString("skin.default.global.elipse",locale);                }    %>        <option value="<%= f.getID() %>"><%= buf %>&nbsp;&#149; <%= forumName %>    <%      }        }    %>        </select>        </font>    </td>    </tr>    </form>    </table></td></tr></table><%! // Returns a buffer indentation for a category depth:    private static String getCategoryBuffer(ForumCategory category, String str) {        int depth = category.getCategoryDepth();        if (depth == 0) {            return "";        }        else {            StringBuffer buf = new StringBuffer(str.length()*depth);            for (int i=0; i<depth; i++) {                buf.append(str);            }            return buf.toString();        }    }%>

⌨️ 快捷键说明

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