Examples of BlogArticleForm


Examples of evolaris.framework.blog.web.form.BlogArticleForm

    return mapping.findForward("cloud");
  }
 
  @Override
  public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    return injectId(mapping.findForward("cancelled"), f.getBlogId());
  }
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

    }
    return null;
 
 
  public ActionForward enterArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Long id = Long.parseLong(req.getParameter("id"));
    Blog blog = blogMgr.getBlog(id);
    if (blog == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.BlogNotFound", id, ""));
    }
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.WRITE_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    f.setBlogId(id);
    req.getSession().setAttribute("blog", blog);
    req.getSession().setAttribute("blogCode", blog.getCode())// for fckeditor ...
    req.getSession().setAttribute("labels", blog.getLabels().toArray());
    return mapping.findForward("enter");
 
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

    req.getSession().setAttribute("labels", blog.getLabels().toArray());
    return mapping.findForward("enter");
 
 
  public ActionForward addArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Blog blog = blogMgr.getBlog(f.getBlogId());
    if (blog == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.BlogNotFound", f.getBlogId(), ""));
    }
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.WRITE_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    Article article = new Article();
    article.setTitle(f.getTitle());
    article.setContent(f.getContent());
    article.setAuthor(webUser);
    article.setCreatedAt(new Date());   
    article = blogMgr.addArticle(blog, article);
    blogMgr.setLabels(article, f.getLabels());
    blogMgr.updateArticle(article);
    LOGGER.info("User "+UserManagerBase.toString(webUser)+" added article #"+article.getId()+" ("+article.getTitle()+") to blog #"+blog.getId()+" ("+blog.getName()+")");
    return injectId(mapping.findForward("added"), f.getBlogId());
 
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

  public ActionForward editArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    String idParam = req.getParameter("id");
   
    Article article = blogMgr.getArticle(Long.parseLong(idParam));
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", idParam));
    }
    Blog blog = blogMgr.getBlog(article.getBlog().getId())// fetch blog, so we have it after session is closed
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
        || permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    req.getSession().setAttribute("blog", blog);
    req.getSession().setAttribute("blogCode", blog.getCode())// for fckeditor ...
    req.getSession().setAttribute("labels", blog.getLabels().toArray());   
    f.setArticleId(article.getId());
    f.setBlogId(article.getBlog().getId());
    f.setTitle(article.getTitle());
    f.setLabels(labelSetToString(article.getLabels()));
    f.setContent(article.getContent());   
    return mapping.findForward("edit");
  }
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

  public ActionForward modifyArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Article article = blogMgr.getArticle(f.getArticleId());
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", f.getArticleId(), ""));
    }
    Set<Long> permissions = getPermissions(article.getBlog(), webUser);
    if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
        || permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
   
    article.setTitle(f.getTitle());
    article.setContent(f.getContent());
    article.setModifiedBy(webUser);
    article.setModifiedAt(new Date());
    blogMgr.setLabels(article, f.getLabels());
    blogMgr.updateArticle(article);
    LOGGER.info("User "+UserManagerBase.toString(webUser)+" modified article #"+article.getId()+" ("+article.getTitle()+") of blog #"+article.getBlog().getId()+" ("+article.getBlog().getName()+")");
    return injectId(mapping.findForward("modified"), f.getArticleId());
  }
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

 
  public ActionForward deleteArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Article article = blogMgr.getArticle(f.getArticleId());
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", f.getArticleId(), ""));
    }
    Set<Long> permissions = getPermissions(article.getBlog(), webUser);
    if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
        || permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
   
    blogMgr.deleteArticle(article);
    LOGGER.info("User "+UserManagerBase.toString(webUser)+" deleted article #"+article.getId()+" ("+article.getTitle()+", "+article.getContent()+") of blog #"+article.getBlog().getId()+" ("+article.getBlog().getName()+")");
    return injectId(mapping.findForward("deleted"), f.getBlogId());
  }
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

    return injectId(mapping.findForward("deleted"), f.getBlogId());
  }
 
  @Override
  public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    return injectId(mapping.findForward("cancelled"), f.getBlogId());
  }
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

    return mapping.findForward("list");
  }
   
  @Override
  public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    return injectId(mapping.findForward("cancelled"), f.getBlogId());
  }
View Full Code Here

Examples of evolaris.framework.blog.web.form.BlogArticleForm

    }
    return super.executeAccordingToMethod(mapping, form, req, resp, method);
 
 
  public ActionForward enterArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    String label = req.getParameter("label");
    if (label != null && label.length() > 0) {
      f.setLabels(label)// preset game-style as a label
      req.getSession().setAttribute("mgblPresetLabel", label);
    }
    return super.enterArticle(mapping, form, req, resp);
  }   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.