Package org.jamwiki

Examples of org.jamwiki.WikiMessage


      // older versions of JAMWiki did not have this field, so it may not always
      // be populated as expected
      return;
    }
    if (editType == TopicVersion.EDIT_MOVE) {
      this.setChangeWikiMessage(new WikiMessage("move.editcomment",
          versionParamString.split("\\|")));
    } else if (editType == TopicVersion.EDIT_PERMISSION) {
      this.setChangeWikiMessage(new WikiMessage("manage.message.permissions"));
    }
  }
View Full Code Here


   *
   */
  private void loadEdit(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo, String contents, String virtualWiki,
      String topicName, boolean useSection) throws Exception {
    pageInfo.setPageTitle(new WikiMessage("edit.title", topicName));
    pageInfo.setTopicName(topicName);
    WikiLink wikiLink = LinkUtil.parseWikiLink(topicName);
    String namespace = wikiLink.getNamespace();
    if (namespace != null
        && namespace.equals(NamespaceHandler.NAMESPACE_CATEGORY)) {
View Full Code Here

    WikiUserDetails user = ServletUtil.currentUserDetails();
    if (ServletUtil.isEditable(virtualWiki, topicName, user)) {
      return null;
    }
    if (!user.hasRole(RoleImpl.ROLE_EDIT_EXISTING)) {
      WikiMessage messageObject = new WikiMessage("login.message.edit");
      return ServletUtil.viewLogin(request, pageInfo, WikiUtil
          .getTopicFromURI(request), messageObject);
    }
    if (!user.hasRole(RoleImpl.ROLE_EDIT_NEW)
        && WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false,
            null) == null) {
      WikiMessage messageObject = new WikiMessage("login.message.editnew");
      return ServletUtil.viewLogin(request, pageInfo, WikiUtil
          .getTopicFromURI(request), messageObject);
    }
    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName,
        false, null);
    if (topic == null) {
      // this should never trigger, but better safe than sorry...
      return null;
    }
    // if (topic.getAdminOnly()) {
    // WikiMessage messageObject = new WikiMessage("login.message.editadmin",
    // topicName);
    // return ServletUtil.viewLogin(request, pageInfo,
    // WikiUtil.getTopicFromURI(request), messageObject);
    // }
    // if (topic.getReadOnly()) {
    // throw new WikiException(new WikiMessage("error.readonly"));
    // }
    // it should be impossible to get here...
    throw new WikiException(new WikiMessage("error.unknown",
        "Unable to determine topic editing permissions"));
  }
View Full Code Here

      contents = spliceResult[1];
      sectionName = parserOutput.getSectionName();
    }
    if (contents == null) {
      logger.warning("The topic " + topicName + " has no content");
      throw new WikiException(new WikiMessage("edit.exception.nocontent",
          topicName));
    }
    // strip line feeds
    contents = StringUtils.remove(contents, '\r');
    String lastTopicContent = (lastTopic != null) ? StringUtils.remove(
View Full Code Here

      String logParamString) {
    String[] logParams = null;
    if (!StringUtils.isBlank(logParamString)) {
      logParams = logParamString.split("\\|");
    }
    WikiMessage logWikiMessage = null;
    if (logType == LogItem.LOG_TYPE_DELETE) {
      if (logParams != null
          && logParams.length >= 2
          && StringUtils.equals(logParams[1], Integer
              .toString(TopicVersion.EDIT_UNDELETE))) {
        logWikiMessage = new WikiMessage("log.message.undeletion", logParams);
      } else {
        logWikiMessage = new WikiMessage("log.message.deletion", logParams);
      }
    } else if (logType == LogItem.LOG_TYPE_IMPORT) {
      logWikiMessage = new WikiMessage("log.message.import", logParams);
    } else if (logType == LogItem.LOG_TYPE_MOVE) {
      logWikiMessage = new WikiMessage("log.message.move", logParams);
    } else if (logType == LogItem.LOG_TYPE_PERMISSION) {
      logWikiMessage = new WikiMessage("log.message.permission", logParams);
    } else if (logType == LogItem.LOG_TYPE_UPLOAD) {
      logWikiMessage = new WikiMessage("log.message.upload", logParams);
    } else if (logType == LogItem.LOG_TYPE_USER_CREATION) {
      logWikiMessage = new WikiMessage("log.message.user");
    }
    return logWikiMessage;
  }
View Full Code Here

      virtualWiki = WikiBase.DEFAULT_VWIKI;
    }
    Topic topic = ServletUtil.initializeTopic(virtualWiki, topicName);
    if (topic.getContent()==null) {
      // topic does not exist, display empty page
      WikiMessage wikiMessage = new WikiMessage("topic.notcreated");
      // topic name is escaped from WikiUtil.getTopicFromURI, so do not double-escape
      wikiMessage.setParamsWithoutEscaping(new String[]{topicName});
      next.addObject("notopic", wikiMessage);
    }
    WikiMessage pageTitle = new WikiMessage("topic.title", topicName);
    ServletUtil.viewTopic(request, next, pageInfo, pageTitle, topic, true, true);
  }
View Full Code Here

   */
  protected ModelAndView handleJAMWikiRequest(HttpServletRequest request,
      HttpServletResponse response, ModelAndView next, WikiPageInfo pageInfo)
      throws Exception {
    if (!WikiUtil.isFirstUse()) {
      throw new WikiException(new WikiMessage("setup.error.notrequired"));
    }
    String function = (request.getParameter("function") == null) ? request
        .getParameter("override") : request.getParameter("function");
    if (function == null) {
      function = "";
    }
    try {
      if (!SystemUtils.isJavaVersionAtLeast(MINIMUM_JDK_VERSION)) {
        throw new WikiException(new WikiMessage("setup.error.jdk", Integer
            .valueOf(MINIMUM_JDK_VERSION).toString(), System
            .getProperty("java.version")));
      }
      if (!StringUtils.isBlank(function) && initialize(request, next, pageInfo)) {
        ServletUtil.redirect(next, WikiBase.DEFAULT_VWIKI, Environment
View Full Code Here

    }
    if (e instanceof WikiException) {
      WikiException we = (WikiException) e;
      next.addObject("messageObject", we.getWikiMessage());
    } else {
      next.addObject("messageObject", new WikiMessage("error.unknown", e
          .getMessage()));
    }
  }
View Full Code Here

  private List<WikiMessage> validate(HttpServletRequest request, WikiUser user)
      throws Exception {
    List<WikiMessage> errors = ServletUtil.validateSystemSettings(Environment
        .getInstance());
    if (StringUtils.isBlank(user.getUsername())) {
      errors.add(new WikiMessage("error.loginempty"));
    }
    String newPassword = request.getParameter("newPassword");
    String confirmPassword = request.getParameter("confirmPassword");
    if (newPassword != null || confirmPassword != null) {
      if (newPassword == null) {
        errors.add(new WikiMessage("error.newpasswordempty"));
      } else if (confirmPassword == null) {
        errors.add(new WikiMessage("error.passwordconfirm"));
      } else if (!newPassword.equals(confirmPassword)) {
        errors.add(new WikiMessage("admin.message.passwordsnomatch"));
      }
    }
    return errors;
  }
View Full Code Here

      String value = key.substring(NamespaceHandler.NAMESPACE_CATEGORY.length() + NamespaceHandler.NAMESPACE_SEPARATOR.length());
      categories.put(key, value);
    }
    next.addObject("categoryCount", categories.size());
    next.addObject("categories", categories);
    pageInfo.setPageTitle(new WikiMessage("allcategories.title"));
    pageInfo.setContentJsp(JSP_CATEGORIES);
    pageInfo.setSpecial(true);
  }
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.