Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.Blog


   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    StaticPageService service = new StaticPageService();

    String id = request.getParameter("page");
    if (id != null) {
      try {
        StaticPage staticPage = service.getStaticPageById(blog, id);
        if (staticPage != null) {
          service.unlock(staticPage);
          blog.info("Static page <a href=\"" + staticPage.getLocalPermalink() + "\">" + staticPage.getTitle() + "</a> unlocked.");
        }
      } catch (StaticPageServiceException e) {
        blog.warn(e.getClass().getName() + " Error while unlocking static page - " + StringUtils.transformHTML(e.getMessage()));
        log.warn("Error while unlocking static page", e);
      }
    }

    return new RedirectView(blog.getUrl() + "viewStaticPages.secureaction");
  }
View Full Code Here


   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    getModel().put("pluginProperties", blog.getPluginProperties().getProperties());
    getModel().put("pluginPropertiesAsString", blog.getPluginProperties().getPropertiesAsString());
    getModel().put("availablePlugins", PluginLocator.getAvailablePluginsSortedForBlog(blog));

    return new PluginsView();
  }
View Full Code Here

   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);

    getModel().put("properties", blog.getProperties());

    Set resources = request.getSession().getServletContext().getResourcePaths("/themes/");
    List themes = new ArrayList();
    Iterator it = resources.iterator();
    String resource;
View Full Code Here

   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    String themeName = request.getParameter("theme");
    if (themeName == null || themeName.length() == 0) {
      themeName = Theme.DEFAULT_THEME_NAME;
    }
    Utilities.restoreTheme(blog, themeName);
View Full Code Here

   * @param o2  object 2
   * @return  -n, 0 or +n if the last modified date of the second blog is less
   *          than, the same as or greater than the first, respectively
   */
  public int compare(Object o1, Object o2) {
    Blog b1 = (Blog)o1;
    Blog b2 = (Blog)o2;

    return b1.getId().compareTo(b2.getId());
  }
View Full Code Here

   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    Log log = getLog(request, response);

    List requests = new ArrayList(log.getRequests());

    String sort = request.getParameter("sort");
View Full Code Here

    postToHubs(event);
  }

  private void postToHubs(BlogEntryEvent event) {
    BlogEntry entry = event.getBlogEntry();
    Blog blog = entry.getBlog();
    String blogUrl = blog.getUrl();
    for (String hub : getHubs(blog)) {
      HttpClient httpClient = new HttpClient();
      PostMethod method = new PostMethod(hub);
      method.addParameter(HUB_MODE_PARAM, HUB_MODE);
      // Add every feed that might have this
      method.addParameter(HUB_URL_PARAM, blogUrl + ATOM_XML);
      for (Category category : entry.getCategories()) {
        method.addParameter(HUB_URL_PARAM, category.getPermalink() + ATOM_XML);
      }
      for (Tag tag : entry.getAllTags()) {
        method.addParameter(HUB_URL_PARAM, tag.getPermalink() + ATOM_XML);
      }
      method.addParameter(HUB_URL_PARAM, blogUrl + "authors/" + entry.getAuthor() + "/" + ATOM_XML);
      try {
        int rc = httpClient.executeMethod(method);
        if (rc != HttpServletResponse.SC_NO_CONTENT) {
          String errorMessage = "Unexpected response code received from hub: " + hub + " - " + rc + " " +
              method.getStatusText();
          log.warn(errorMessage);
          blog.warn(errorMessage);
        }
      } catch (IOException e) {
        log.error("Error posting to hub: " + hub, e);
        blog.warn("Error publishing to hub: " + hub + ". Message: " + e.getMessage());
      }
    }
  }
View Full Code Here

   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    String tag = request.getParameter("tag");
    try {
      return new ForwardView("/search.action?query=tag:\"" + URLEncoder.encode(Tag.encode(tag), blog.getCharacterEncoding()) + "\"&sort=date");
    } catch (UnsupportedEncodingException uee) {
      throw new ServletException(uee);
    }
  }
View Full Code Here

   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);

    String yearAsStriing = request.getParameter("year");
    String monthAsString = request.getParameter("month");

    Calendar cal = blog.getCalendar();
    LogSummary logSummary;
    View view;

    if (yearAsStriing != null && yearAsStriing.length() > 0 &&
        monthAsString != null && monthAsString.length() > 0) {
      int year = Integer.parseInt(yearAsStriing);
      int month = Integer.parseInt(monthAsString)-1;
      cal.set(Calendar.YEAR, year);
      cal.set(Calendar.MONTH, month);
      logSummary = blog.getLogger().getLogSummary(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1);
      view = new LogSummaryByMonthView();
      registerObjectsForNavigation(blog, blog.getBlogForMonth(year, month+1));
    } else if (yearAsStriing != null && yearAsStriing.length() > 0) {
      cal.set(Calendar.YEAR, Integer.parseInt(yearAsStriing));
      logSummary = blog.getLogger().getLogSummary(cal.get(Calendar.YEAR));
      view = new LogSummaryByYearView();
    } else {
      // get the log for this monthAsString
      logSummary = blog.getLogger().getLogSummary(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1);
      view = new LogSummaryByMonthView();
      registerObjectsForNavigation(blog, blog.getBlogForThisMonth());
    }

    SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy", Locale.ENGLISH);
    yearFormatter.setTimeZone(blog.getTimeZone());
    SimpleDateFormat monthFormatter = new SimpleDateFormat("MM", Locale.ENGLISH);
    monthFormatter.setTimeZone(blog.getTimeZone());
    SimpleDateFormat dayFormatter = new SimpleDateFormat("dd", Locale.ENGLISH);
    dayFormatter.setTimeZone(blog.getTimeZone());
    getModel().put("year", yearFormatter.format(logSummary.getDate()));
    getModel().put("month", monthFormatter.format(logSummary.getDate()));

    getModel().put("logAction", "viewLogSummary");
    getModel().put("logSummary", logSummary);
View Full Code Here

   * Gets the title of this view.
   *
   * @return the title as a String
   */
  public String getTitle() {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    Month month = (Month)getModel().get(Constants.MONTHLY_BLOG);
    SimpleDateFormat sdf = new SimpleDateFormat("MMMM yyyy", blog.getLocale());
    sdf.setTimeZone(blog.getTimeZone());
    return sdf.format(month.getDate());
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.domain.Blog

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.