Package org.jamwiki

Examples of org.jamwiki.WikiMessage


    Map editors = WikiConfiguration.getInstance().getEditors();
    next.addObject("editors", editors);
    next.addObject("newuser", user);
    pageInfo.setSpecial(true);
    pageInfo.setContentJsp(JSP_REGISTER);
    pageInfo.setPageTitle(new WikiMessage("register.title"));
  }
View Full Code Here


      if (!StringUtils.isBlank(user.getDefaultLocale())) {
        Locale locale = LocaleUtils.toLocale(user.getDefaultLocale());
        request.getSession().setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, locale);
      }
      if (isUpdate) {
        next.addObject("updateMessage", new WikiMessage("register.caption.updatesuccess"));
        this.view(request, next, pageInfo);
      } else {
        VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
        String topic = virtualWiki.getDefaultTopicName();
        ServletUtil.redirect(next, virtualWikiName, topic);
View Full Code Here

    } catch (WikiException e) {
      errors.add(e.getWikiMessage());
    }
    String oldPassword = request.getParameter("oldPassword");
    if (user.getUserId() != null && !StringUtils.isBlank(oldPassword) && !WikiBase.getDataHandler().authenticate(user.getUsername(), oldPassword)) {
      errors.add(new WikiMessage("register.error.oldpasswordinvalid"));
    }
    String newPassword = request.getParameter("newPassword");
    String confirmPassword = request.getParameter("confirmPassword");
    if (user.getUserId() == null && StringUtils.isBlank(newPassword)) {
      errors.add(new WikiMessage("register.error.passwordempty"));
    }
    if (!StringUtils.isBlank(newPassword) || !StringUtils.isBlank(confirmPassword)) {
      if (user.getUserId() != null && StringUtils.isBlank(oldPassword)) {
        errors.add(new WikiMessage("register.error.oldpasswordinvalid"));
      }
      try {
        WikiUtil.validatePassword(newPassword, confirmPassword);
      } catch (WikiException e) {
        errors.add(e.getWikiMessage());
      }
    }
    if (user.getUserId() == null && WikiBase.getDataHandler().lookupWikiUser(user.getUsername()) != null) {
      errors.add(new WikiMessage("register.error.logininvalid", user.getUsername()));
    }
    return errors;
  }
View Full Code Here

  private void linksTo(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (StringUtils.isBlank(topicName)) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    WikiMessage pageTitle = new WikiMessage("linkto.title", topicName);
    pageInfo.setPageTitle(pageTitle);
    // grab search engine instance and find
    // List<SearchResultEntry> results =
    // WikiBase.getSearchEngine().findLinkedTo(virtualWiki, topicName);
    // next.addObject("results", results);
View Full Code Here

  /**
   *
   */
  private void specialPages(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    pageInfo.setPageTitle(new WikiMessage("specialpages.title"));
    pageInfo.setContentJsp(JSP_SPECIAL_PAGES);
    pageInfo.setSpecial(true);
  }
View Full Code Here

        next.addObject("hideTranslated", true);
      }
    }
    pageInfo.setContentJsp(JSP_ADMIN_TRANSLATION);
    pageInfo.setAdmin(true);
    pageInfo.setPageTitle(new WikiMessage("translation.title"));
    next.addObject("translations", new TreeMap(translations));
    next.addObject("codes", this.retrieveTranslationCodes());
    next.addObject("language", language);
    SortedProperties defaultTranslations = new SortedProperties(Environment.loadProperties("ApplicationResources.properties"));
    next.addObject("defaultTranslations", new TreeMap(defaultTranslations));
View Full Code Here

   *
   */
  private void delete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (topicName == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    deletePage(request, next, pageInfo, topicName);
    String manageCommentsPage = WikiUtil.getParameterFromRequest(request, "manageCommentsPage", true);
    if (!StringUtils.isBlank(manageCommentsPage)) {
      if (WikiUtil.isCommentsPage(manageCommentsPage) && !manageCommentsPage.equals(topicName)) {
        deletePage(request, next, pageInfo, manageCommentsPage);
      }
    }
    next.addObject("message", new WikiMessage("manage.message.updated", topicName));
    view(request, next, pageInfo);
  }
View Full Code Here

   */
  private void permissions(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    if (topicName == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null);
    if (topic == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    topic.setReadOnly(request.getParameter("readOnly") != null);
    topic.setAdminOnly(request.getParameter("adminOnly") != null);
    WikiUser user = ServletUtil.currentWikiUser();
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), null, topic.getTopicContent(), 0);
    topicVersion.setEditType(TopicVersion.EDIT_PERMISSION);
    WikiBase.getDataHandler().writeTopic(topic, topicVersion, null, null);
    next.addObject("message", new WikiMessage("manage.message.updated", topicName));
    view(request, next, pageInfo);
  }
View Full Code Here

   *
   */
  private void undelete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (topicName == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    undeletePage(request, next, pageInfo, topicName);
    String manageCommentsPage = WikiUtil.getParameterFromRequest(request, "manageCommentsPage", true);
    if (!StringUtils.isBlank(manageCommentsPage)) {
      if (WikiUtil.isCommentsPage(manageCommentsPage) && !manageCommentsPage.equals(topicName)) {
        undeletePage(request, next, pageInfo, manageCommentsPage);
      }
    }
    next.addObject("message", new WikiMessage("manage.message.updated", topicName));
    view(request, next, pageInfo);
  }
View Full Code Here

  private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, true, null);
    if (topic == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    String commentsPage = WikiUtil.extractCommentsLink(topicName);
    if (!topicName.equals(commentsPage)) {
      Topic commentsTopic = WikiBase.getDataHandler().lookupTopic(virtualWiki, commentsPage, true, null);
      if (commentsTopic != null && commentsTopic.getDeleted() == topic.getDeleted()) {
        // add option to also move comments page
        next.addObject("manageCommentsPage", commentsPage);
      }
    }
    next.addObject("readOnly", topic.isReadOnly());
    next.addObject("adminOnly", topic.isAdminOnly());
    next.addObject("deleted", (topic.getDeleteDate() != null));
    pageInfo.setTopicName(topicName);
    pageInfo.setContentJsp(JSP_ADMIN_MANAGE);
    pageInfo.setPageTitle(new WikiMessage("manage.title", topicName));
  }
View Full Code Here

TOP

Related Classes of org.jamwiki.WikiMessage

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.