Package evolaris.framework.blog.web

Examples of evolaris.framework.blog.web.DisplayableArticle


    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    req.setAttribute("blog", blog);
    req.getSession().setAttribute("blogCode", blog.getCode())// for fckeditor ...
    DisplayableArticle da = new DisplayableArticle(article, true);
    if (da.getTitle() == null || da.getTitle().trim().length()==0) {
      da.setTitle(getLocalizedMessage("BloggingWeb", "blog.noTitle"));
    }
    req.setAttribute("article", da);
    // anonymous users must not edit existing entries,
    // users with WRITE permission may edit their own articles only,
    // users with EDIT_OTHERS permission may also edit articles of others   
    req.setAttribute("mayEditArticle", webUser != null && ((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION)) ||  permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION)));
    req.setAttribute("mayAddComment", permissions.contains(PermissionManager.ADD_COMMENT_PERMISSION));
    if (article.getAuthor() != null) {
      session.load(User.class, article.getAuthor().getId());
    }
    List<DisplayableComment> comments = new ArrayList<DisplayableComment>();
    for (Comment c : article.getComments()) {
      if(viewReleasedCommentsOnly && c.getReviewStatus() != 1){
       
      } else {
        DisplayableComment dc = new DisplayableComment(c);
        comments.add(dc);
      }
    }
    da.setCommentCount(comments.size());
    req.setAttribute("commentList", comments);
    req.setAttribute("dateArchiveList", blogMgr.getArchives(blog));
    req.setAttribute("labelCloud", blogMgr.getLabelCloud(blog, webUser, null, 20));
    req.setAttribute("previousarticle", blogMgr.getPreviousArticle(article));   
    req.setAttribute("nextarticle", blogMgr.getNextArticle(article));
View Full Code Here


          display = false;
        }
      }
     
      if(display){
        DisplayableArticle da = new DisplayableArticle(a, true)
        if (da.getTitle() == null || da.getTitle().trim().length()==0) {
          da.setTitle(getLocalizedMessage("BloggingWeb", "blog.noTitle"));
        }
        displayArticles.add(da);
      }

    }
View Full Code Here

      item.addElement("link").setText(baseUrl + "/viewBlog.do?method=view&id="+blog.getId());
      item.addElement("guid").setText(blog.getId()+"-accessdenied");
    } else {
      int n = 0;
      for (Article a : blog.getArticles()) {
        DisplayableArticle da = new DisplayableArticle(a);
        Element item = channel.addElement("item");
        String title = getLocalizedMessage("BloggingWeb", "blog.rssArticleEntry", a.getTitle(), da.getAuthorName());
        item.addElement("title").setText(denull(title));
        item.addElement("author").setText(denull(da.getAuthorName()));
        item.addElement("description").addCDATA(denull(a.getContent()));
        item.addElement("link").setText(baseUrl+"/viewBlogArticle.do?method=view&id="+a.getId());
        item.addElement("guid").setText(blog.getId()+"-"+a.getId());
        n++;
        if (n >= articles) {
View Full Code Here

          permissions = new HashSet<Long>();
        }
        blogPermissions.put(a.getBlog().getId(), permissions);
      }
      if (permissions.contains(PermissionManager.READ_PERMISSION)) {
        DisplayableArticle e = new DisplayableArticle(a, true);
        entries.add(e);
      }
    }       
    req.setAttribute("articleList", entries);
    req.setAttribute("label", labelParam);
View Full Code Here

      Blog gameStyleBlog = blogMgr.getBlog("mgblgamestyles", blog.getGroup());
      req.getSession().removeAttribute("mgblCurrentGameStyle");
      req.getSession().removeAttribute("mgblCurrentGameStyleBelongsToSearchResult");
      for (Article style : gameStyleBlog.getArticles()) {
        if (label.getLabel().equals(style.getTitle())) {
          req.getSession().setAttribute("mgblCurrentGameStyle", new DisplayableArticle(style));
          List<Long> searchResults = (List<Long>)req.getSession().getAttribute("mgblSearchResults");
          if (searchResults != null && searchResults.contains(style.getId())) {
            req.getSession().setAttribute("mgblCurrentGameStyleBelongsToSearchResult", Boolean.TRUE);
          }
          break;
View Full Code Here

   
    ActionForward fwd = super.view(mapping, form, req, resp);
   
    req.getSession().removeAttribute("belongsToCurrentGameStyle");
    req.getSession().removeAttribute("currentGameStyleLabelId");
    DisplayableArticle game = (DisplayableArticle)req.getAttribute("article");
    DisplayableArticle currentGameStyle = (DisplayableArticle)req.getSession().getAttribute("mgblCurrentGameStyle");
    if (currentGameStyle != null && game.getLabels() != null && game.getLabels().size() > 0) {
      for (CloudEntry label : game.getLabels()) {
        if (label.getLabel().equals(currentGameStyle.getTitle())) {
          req.getSession().setAttribute("belongsToCurrentGameStyle", Boolean.TRUE);
          req.getSession().setAttribute("currentGameStyleLabelId", label.getId());
          break;
        }
      }
View Full Code Here

    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getResources(req).getMessage("um.insufficientRights"));
    }
    req.setAttribute("blog", blog);
    DisplayableArticle displayableArticle = new DisplayableArticle(article, true)
    req.setAttribute("article", displayableArticle);
    req.setAttribute("mayEditArticle", permissions.contains(PermissionManager.WRITE_PERMISSION));
    req.setAttribute("mayAddComment", permissions.contains(PermissionManager.ADD_COMMENT_PERMISSION));
    if (article.getAuthor() != null) {
      session.load(User.class, article.getAuthor().getId());
    }
    List<DisplayableComment> comments = new ArrayList<DisplayableComment>();
    for (Comment c : article.getComments()) {
      DisplayableComment dc = new DisplayableComment(c);
      comments.add(dc);
    }
    req.setAttribute("commentList", comments);

    // list of game instances
    Blog gameBlog = blogMgr.getBlog("mgblgameinstances", blog.getGroup());
    List<DisplayableArticle> gameList = new ArrayList<DisplayableArticle>();
    Label label = blogMgr.getLabel(gameBlog, article.getTitle());
    if (label == null) {
      // do some self healing magic ...
      label = new Label();
      label.setLabel(article.getTitle());
      blogMgr.addLabel(gameBlog, label);
    }
    Collection<Article> gameArticles = blogMgr.getArchivedArticles(gameBlog, label);
    for (Article gameArticle : gameArticles) {
      DisplayableArticle entry = new DisplayableArticle(gameArticle);
      gameList.add(entry);
    }
    req.setAttribute("gameList", gameList);
    req.setAttribute("gameblog", gameBlog);
    req.setAttribute("label", label);
View Full Code Here

TOP

Related Classes of evolaris.framework.blog.web.DisplayableArticle

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.