Package org.jamwiki

Examples of org.jamwiki.WikiMessage


   *
   */
  private void update(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      throw new WikiException(new WikiMessage("watchlist.error.loginrequired"));
    }
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    Watchlist watchlist = ServletUtil.currentWatchlist(request, virtualWiki);
    WikiUser user = ServletUtil.currentWikiUser();
    WikiBase.getDataHandler().writeWatchlistEntry(watchlist, virtualWiki, topicName, user.getUserId());
    String article = WikiUtil.extractTopicLink(topicName);
    if (watchlist.containsTopic(topicName)) {
      // added to watchlist
      next.addObject("message", new WikiMessage("watchlist.caption.added", article));
    } else {
      // removed from watchlist
      next.addObject("message", new WikiMessage("watchlist.caption.removed", article));
    }
    this.view(request, next, pageInfo);
  }
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);
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      throw new WikiException(new WikiMessage("watchlist.error.loginrequired"));
    }
    WikiUser user = ServletUtil.currentWikiUser();
    List<RecentChange> changes = WikiBase.getDataHandler().getWatchlist(virtualWiki, user.getUserId(), pagination);
    next.addObject("numChanges", changes.size());
    next.addObject("changes", changes);
    pageInfo.setPageTitle(new WikiMessage("watchlist.title"));
    pageInfo.setContentJsp(JSP_WATCHLIST);
    pageInfo.setSpecial(true);
  }
View Full Code Here

   */
  private void cache(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    try {
      // WikiCache.initialize();
      next.addObject("message", new WikiMessage("admin.message.cache"));
    } catch (Exception e) {
      logger.severe("Failure while clearing cache", e);
      next.addObject("message", new WikiMessage(
          "admin.cache.message.clearfailed", e.getMessage()));
    }
    viewAdminSystem(request, next, pageInfo);
  }
View Full Code Here

   */
  private void logItems(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    try {
      WikiBase.getDataHandler().reloadLogItems();
      next.addObject("message", new WikiMessage("admin.message.logitems"));
    } catch (Exception e) {
      logger.severe("Failure while loading log items", e);
      next.addObject("message", new WikiMessage("admin.message.logitemsfail", e
          .getMessage()));
    }
    viewAdminSystem(request, next, pageInfo);
  }
View Full Code Here

    String newPassword = request.getParameter("passwordPassword");
    String confirmPassword = request.getParameter("passwordPasswordConfirm");
    try {
      WikiUser user = WikiBase.getDataHandler().lookupWikiUser(userLogin);
      if (user == null) {
        throw new WikiException(new WikiMessage(
            "admin.password.message.invalidlogin", userLogin));
      }
      WikiUtil.validatePassword(newPassword, confirmPassword);
      String encryptedPassword = Encryption.encrypt(newPassword);
      WikiBase.getDataHandler().writeWikiUser(user, userLogin,
          encryptedPassword);
    } catch (WikiException e) {
      errors.add(e.getWikiMessage());
    } catch (Exception e) {
      logger.severe("Failure while updating user password", e);
      errors
          .add(new WikiMessage("admin.message.exportcsvfail", e.getMessage()));
    }
    if (!errors.isEmpty()) {
      next.addObject("errors", errors);
      next.addObject("passwordLogin", userLogin);
      next.addObject("passwordPassword", newPassword);
      next.addObject("passwordPasswordConfirm", confirmPassword);
    } else {
      next.addObject("message", new WikiMessage(
          "admin.password.message.success", userLogin));
    }
    viewAdminSystem(request, next, pageInfo);
  }
View Full Code Here

      setProperty(props, request, Environment.PROP_DBCP_WHEN_EXHAUSTED_ACTION);
      String maxFileSizeString = request
          .getParameter(Environment.PROP_FILE_MAX_FILE_SIZE);
      if (StringUtils.isBlank(maxFileSizeString)
          || !StringUtils.isNumeric(maxFileSizeString)) {
        errors.add(new WikiMessage("admin.message.nonnumeric",
            Environment.PROP_FILE_MAX_FILE_SIZE, maxFileSizeString));
      } else {
        int maxFileSizeInKB = Integer.parseInt(maxFileSizeString);
        props.setProperty(Environment.PROP_FILE_MAX_FILE_SIZE, Integer
            .toString(maxFileSizeInKB * 1000));
      }
      setProperty(props, request, Environment.PROP_FILE_DIR_FULL_PATH);
      setProperty(props, request, Environment.PROP_FILE_DIR_RELATIVE_PATH);
      setProperty(props, request, Environment.PROP_FILE_SERVER_URL);
      setProperty(props, request, Environment.PROP_FILE_BLACKLIST_TYPE);
      setProperty(props, request, Environment.PROP_FILE_BLACKLIST);
      setProperty(props, request, Environment.PROP_FILE_WHITELIST);
      /*
       * setProperty(props, request, Environment.PROP_EMAIL_SMTP_HOST);
       * setProperty(props, request, Environment.PROP_EMAIL_SMTP_USERNAME);
       * setPassword(props, request, next, Environment.PROP_EMAIL_SMTP_PASSWORD,
       * "smtpPassword"); setProperty(props, request,
       * Environment.PROP_EMAIL_REPLY_ADDRESS);
       */
      setNumericProperty(props, request,
          Environment.PROP_CACHE_INDIVIDUAL_SIZE, errors);
      setNumericProperty(props, request, Environment.PROP_CACHE_MAX_AGE, errors);
      setNumericProperty(props, request, Environment.PROP_CACHE_MAX_IDLE_AGE,
          errors);
      setNumericProperty(props, request, Environment.PROP_CACHE_TOTAL_SIZE,
          errors);
      setBooleanProperty(props, request, Environment.PROP_RSS_ALLOWED);
      setProperty(props, request, Environment.PROP_RSS_TITLE);
      errors.addAll(ServletUtil.validateSystemSettings(props));
      if (this.saveProperties(request, next, pageInfo, props, errors)) {
        next
            .addObject("message", new WikiMessage("admin.message.changessaved"));
      }
    } catch (Exception e) {
      logger.severe("Failure while processing property values", e);
      next.addObject("message", new WikiMessage(
          "admin.message.propertyfailure", e.getMessage()));
    }
    viewAdmin(request, next, pageInfo, props);
  }
View Full Code Here

   */
  private void recentChanges(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    try {
      WikiBase.getDataHandler().reloadRecentChanges();
      next.addObject("message", new WikiMessage("admin.message.recentchanges"));
    } catch (Exception e) {
      logger.severe("Failure while loading recent changes", e);
      next.addObject("message", new WikiMessage(
          "admin.message.recentchangesfail", e.getMessage()));
    }
    viewAdminSystem(request, next, pageInfo);
  }
View Full Code Here

      WikiPageInfo pageInfo, Properties props, List<WikiMessage> errors)
      throws Exception {
    if (!errors.isEmpty()) {
      next.addObject("errors", errors);
      next.addObject("message",
          new WikiMessage("admin.message.changesnotsaved"));
      return false;
    }
    // all is well, save the properties
    Iterator iterator = props.keySet().iterator();
    while (iterator.hasNext()) {
View Full Code Here

   */
  private static void setNumericProperty(Properties props,
      HttpServletRequest request, String parameter, List<WikiMessage> errors) {
    String value = request.getParameter(parameter);
    if (StringUtils.isBlank(value) || !StringUtils.isNumeric(value)) {
      errors.add(new WikiMessage("admin.message.nonnumeric", parameter, value));
    }
    props.setProperty(parameter, value);
  }
View Full Code Here

   */
  private void spam(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    try {
      SpamFilter.reload();
      next.addObject("message", new WikiMessage("admin.message.spamfilter"));
    } catch (Exception e) {
      logger.severe("Failure while reloading spam filter patterns", e);
      next.addObject("message", new WikiMessage("admin.message.spamfilterfail",
          e.getMessage()));
    }
    viewAdminSystem(request, next, pageInfo);
  }
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.