Package org.jamwiki.utils

Examples of org.jamwiki.utils.Pagination


   */
  public static Pagination loadPagination(HttpServletRequest request, ModelAndView next) {
    if (next == null) {
      throw new IllegalArgumentException("A non-null ModelAndView object must be specified when loading pagination values");
    }
    Pagination pagination = WikiUtil.buildPagination(request);
    next.addObject("num", pagination.getNumResults());
    next.addObject("offset", pagination.getOffset());
    return pagination;
  }
View Full Code Here


  /**
   *
   */
  private String pagination(String baseUrl, int count) {
    HttpServletRequest request = (HttpServletRequest)this.pageContext.getRequest();
    Pagination pagination = WikiUtil.buildPagination(request);
    StringBuilder output = new StringBuilder();
    output.append(this.nextPage(pagination, baseUrl, count, true));
    output.append(" | ");
    output.append(this.nextPage(pagination, baseUrl, count, false));
    output.append("  (");
View Full Code Here

  /**
   *
   */
  private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    int logType = NumberUtils.toInt(request.getParameter("logType"), -1);
    if (logType != -1) {
      next.addObject("logTypeSelected", logType);
    }
    List<LogItem> logItems = WikiBase.getDataHandler().getLogItems(virtualWiki, logType, pagination, true);
View Full Code Here

  /**
   *
   */
  private List<RecentChange> getChanges(HttpServletRequest request) throws Exception {
    String virtualWiki = WikiUtil.getVirtualWikiFromURI(request);
    Pagination pagination = WikiUtil.buildPagination(request);
    return WikiBase.getDataHandler().getRecentChanges(virtualWiki, pagination, true);
  }
View Full Code Here

   *
   */
  private void viewFiles(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    List<String> items = WikiBase.getDataHandler().lookupTopicByType(
        virtualWiki, Topic.TYPE_FILE, Topic.TYPE_FILE, pagination);
    next.addObject("itemCount", items.size());
    next.addObject("items", items);
    next.addObject("rootUrl", "Special:Filelist");
View Full Code Here

   *
   */
  private void viewOrphanedPages(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    Set<String> allItems = new TreeSet<String>();
    List<String> unlinkedTopics = WikiBase.getDataHandler().getAllTopicNames(
        virtualWiki);
    Topic topic;
    List<SearchResultEntry> topicLinks = null;
    ParserInput parserInput;
    ParserOutput parserOutput;
    for (String topicName : unlinkedTopics) {
      topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName,
          true, null);
      if (topic == null) {
        logger.warning("No topic found: " + virtualWiki + " / " + topicName);
        continue;
      }
      if (topic.getTopicType() != Topic.TYPE_ARTICLE) {
        continue;
      }
      // only mark them orphaned if there is neither category defined in it, nor
      // a link to it!
      // topicLinks = WikiBase.getSearchEngine().findLinkedTo(virtualWiki,
      // topicName);
      if (topicLinks == null || !topicLinks.isEmpty()) {
        continue;
      }
      parserInput = new ParserInput();
      parserInput.setContext(request.getContextPath());
      parserInput.setLocale(request.getLocale());
      parserInput.setWikiUser(ServletUtil.currentWikiUser());
      parserInput.setTopicName(topicName);
      parserInput.setUserDisplay(ServletUtil.getIpAddress(request));
      parserInput.setVirtualWiki(virtualWiki);
      parserInput.setAllowSectionEdit(false);
      parserOutput = new ParserOutput();
      ParserUtil.parse(parserInput, parserOutput, topic.getTopicContent());
      if (parserOutput.getCategories().size() == 0) {
        allItems.add(topic.getName());
      }
    }
    // FIXME - this is a nasty hack until data can be retrieved properly for
    // pagination
    Set<String> items = new TreeSet<String>();
    int count = 0;
    for (String topicName : allItems) {
      count++;
      if (count < (pagination.getOffset() + 1)) {
        continue;
      }
      if (count > (pagination.getOffset() + pagination.getNumResults())) {
        break;
      }
      items.add(topicName);
    }
    next.addObject("itemCount", items.size());
View Full Code Here

  /**
   *
   */
  private void viewUsers(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    Pagination pagination = ServletUtil.loadPagination(request, next);
    List<String> items = WikiBase.getDataHandler().lookupWikiUsers(pagination);
    List<String> links = new ArrayList<String>();
    for (String link : items) {
      links.add(NamespaceHandler.NAMESPACE_USER
          + NamespaceHandler.NAMESPACE_SEPARATOR + link);
View Full Code Here

   *
   */
  private void viewImages(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    List<String> items = WikiBase.getDataHandler().lookupTopicByType(
        virtualWiki, Topic.TYPE_IMAGE, Topic.TYPE_IMAGE, pagination);
    next.addObject("itemCount", items.size());
    next.addObject("items", items);
    next.addObject("rootUrl", "Special:Imagelist");
View Full Code Here

   *
   */
  private void viewTopics(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    List<String> items = WikiBase.getDataHandler().lookupTopicByType(
        virtualWiki, Topic.TYPE_ARTICLE, Topic.TYPE_TEMPLATE, pagination);
    next.addObject("itemCount", items.size());
    next.addObject("items", items);
    next.addObject("rootUrl", "Special:Allpages");
View Full Code Here

   *
   */
  private void viewTopicsAdmin(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    List<String> items = WikiBase.getDataHandler().getTopicsAdmin(virtualWiki,
        pagination);
    next.addObject("itemCount", items.size());
    next.addObject("items", items);
    next.addObject("rootUrl", "Special:TopicsAdmin");
View Full Code Here

TOP

Related Classes of org.jamwiki.utils.Pagination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.