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

📄 browseservlet.java

📁 dspace 用j2ee架构的一个数字图书馆.开源程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                 */                if (!oldestFirst)                {                    startsWith = startsWith + "-32";                }            }            scope.setFocus(startsWith);            highlight = true;            logInfo = "starts_with=" + startsWith + ",";        }        else if ((top != null) || (bottom != null))        {            // ----------------------------------------------            // Paginating: put specified entry at top or bottom            // ----------------------------------------------            // Use a single value and a boolean to simplify the code below            String val = bottom;            boolean isTop = false;            if (top != null)            {                val = top;                isTop = true;            }            if (browseAuthors || browseSubjects)            {                // Value will be a text value for author browse                scope.setFocus(val);            }            else            {                // Value is Handle if we're browsing items by title or date                Item item = (Item) HandleManager.resolveToObject(context, val);                if (item == null)                {                    // Handle is invalid one. Show an error.                    JSPManager.showInvalidIDError(request, response, focus,                            Constants.ITEM);                    return;                }                scope.setFocus(item);            }            // This entry appears at the top or bottom, and so needs to have            // 0 or 20 entries shown before it            scope.setNumberBefore(isTop ? 0 : 20);            logInfo = (isTop ? "top" : "bottom") + "=" + val + ",";            if (browseDates)            {                // If the date order is flipped, we'll flip the table upside                // down - i.e. the top will become the bottom and the bottom                // the top.                if (top != null)                {                    flipOrderingQuery = "bottom="                            + URLEncoder                                    .encode(top, Constants.DEFAULT_ENCODING)                            + "&";                }                else                {                    flipOrderingQuery = "top="                            + URLEncoder.encode(bottom,                                    Constants.DEFAULT_ENCODING) + "&";                }            }        }        // ----------------------------------------------        // If none of the above apply, no positioning parameters        // set - use start of index        // ----------------------------------------------        // Are we in a community or collection?        Community community = UIUtil.getCommunityLocation(request);        Collection collection = UIUtil.getCollectionLocation(request);        if (collection != null)        {            logInfo = logInfo + ",collection_id=" + collection.getID() + ",";            scope.setScope(collection);        }        else if (community != null)        {            logInfo = logInfo + ",community_id=" + community.getID() + ",";            scope.setScope(community);        }        BrowseInfo browseInfo;        // Query the browse index        if (browseAuthors)        {            browseInfo = Browse.getAuthors(scope);        }        else if (browseDates)        {            browseInfo = Browse.getItemsByDate(scope, oldestFirst);        }        else if (browseSubjects)        {            browseInfo = Browse.getSubjects(scope);        }        else        {            browseInfo = Browse.getItemsByTitle(scope);        }        // Write log entry        String what = "title";        if (browseAuthors)        {            what = "author";        }        else if (browseSubjects)        {            what = "subject";        }        else if (browseDates)        {            what = "date";        }        log.info(LogManager.getHeader(context, "browse_" + what, logInfo                + "results=" + browseInfo.getResultCount()));        if (browseInfo.getResultCount() == 0)        {            // No results!            request.setAttribute("community", community);            request.setAttribute("collection", collection);            JSPManager.showJSP(request, response, "/browse/no-results.jsp");        }        else        {            // Work out what the query strings will be for the previous            // and next pages            if (!browseInfo.isFirst())            {                // Not the first page, so we'll need a "previous page" button                // The top entry of the current page becomes the bottom                // entry of the "previous page"                String s;                if (browseAuthors || browseSubjects) //aneesh                {                    s = (browseInfo.getStringResults())[0];                }                else                {                    Item firstItem = (browseInfo.getItemResults())[0];                    s = firstItem.getHandle();                }                if (browseDates && oldestFirst)                {                    // For browsing by date, oldest first, we need                    // to add the ordering parameter                    request.setAttribute("previous.query",                            "order=oldestfirst&bottom="                                    + URLEncoder.encode(s,                                            Constants.DEFAULT_ENCODING));                }                else                {                    request.setAttribute("previous.query", "bottom="                            + URLEncoder.encode(s, Constants.DEFAULT_ENCODING));                }            }            if (!browseInfo.isLast())            {                // Not the last page, so we'll need a "next page" button                // The bottom entry of the current page will be the top                // entry in the next page                String s;                if (browseAuthors)                {                    String[] authors = browseInfo.getStringResults();                    s = authors[authors.length - 1];                }                else if (browseSubjects)                {                    String[] subjects = browseInfo.getStringResults();                    s = subjects[subjects.length - 1];                }                else                {                    Item[] items = browseInfo.getItemResults();                    Item lastItem = items[items.length - 1];                    s = lastItem.getHandle();                }                if (browseDates && oldestFirst)                {                    // For browsing by date, oldest first, we need                    // to add the ordering parameter                    request.setAttribute("next.query", "order=oldestfirst&top="                            + URLEncoder.encode(s, Constants.DEFAULT_ENCODING));                }                else                {                    request.setAttribute("next.query", "top="                            + URLEncoder.encode(s, Constants.DEFAULT_ENCODING));                }            }            // Set appropriate attributes and forward to results page            request.setAttribute("community", community);            request.setAttribute("collection", collection);            request.setAttribute("browse.info", browseInfo);            request.setAttribute("highlight", new Boolean(highlight));            if (browseAuthors)            {                JSPManager.showJSP(request, response, "/browse/authors.jsp");            }            else if (browseSubjects)            {                JSPManager.showJSP(request, response, "/browse/subjects.jsp");            }            else if (browseDates)            {                request.setAttribute("oldest.first", new Boolean(oldestFirst));                request.setAttribute("flip.ordering.query", flipOrderingQuery);                JSPManager.showJSP(request, response,                        "/browse/items-by-date.jsp");            }            else            {                JSPManager.showJSP(request, response,                        "/browse/items-by-title.jsp");            }        }    }}

⌨️ 快捷键说明

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