Exemplo n.º 1
0
  /**
   * 得到评分结果(Grid显示)
   *
   * @return
   */
  public String getResult4Grid() {
    List<?> list;
    GridDataEncoder encoder;
    if ("1".equals(aspect)) {
      list = service.findResult4Author(channelIds, startTime, endTime);
      encoder =
          new GridDataEncoder(list, CMSConstants.GRID_TEMPLATE_SCORE_COUNT, new ScoreGridParser());
    } else if ("3".equals(aspect)) {
      // 没有文章的栏目不展示
      list = service.getResult4Channel(startTime, endTime);
      encoder = new GridDataEncoder(list, CMSConstants.GRID_TEMPLATE_SCORE_CHANNEL);
    } else {
      if ("site".equals(mode)) {
        list = service.findScoreInfoBySelectedChannels(channelIds, startTime, endTime, author);
        encoder =
            new GridDataEncoder(
                new Object[] {list, "0.0"},
                CMSConstants.GRID_TEMPLATE_CHANNEL_ARTICLE_SCORE,
                new ArticleScoreGridParser());
      } else {
        Object[] objs = service.findScoreInfoByArticle(articleId);
        list = (List<?>) ((Object[]) objs)[0];
        encoder =
            new GridDataEncoder(
                objs, CMSConstants.GRID_TEMPLATE_ARTICLE_SCORE, new ArticleScoreGridParser());
      }
    }

    // 目前一律一页展示,不分页
    String info = getPageInfo(page, 10000, list.size());
    return print(new String[] {"ScoreCountList", "PageList"}, new Object[] {encoder, info});
  }
Exemplo n.º 2
0
  /**
   * 得到评论信息
   *
   * @return
   */
  public String getCommentList() {
    PageInfo pageInfo = null;
    if (!EasyUtils.isNullOrEmpty(keywords)) {
      pageInfo = service.searchCommentList(keywords, page);
    } else {
      pageInfo = service.getCommentListByArticle(articleId, page);
    }

    GridDataEncoder gridEncoder =
        new GridDataEncoder(pageInfo.getItems(), CMSConstants.GRID_TEMPLATE_COMMENTS);
    return print(new String[] {"CommentList", "PageList"}, new Object[] {gridEncoder, pageInfo});
  }
Exemplo n.º 3
0
  /**
   * 得到文章打分结果(图表显示)
   *
   * @return
   */
  public String getScoreResult() {
    List<?> list = null;
    if ("site".equals(mode)) { // 选定栏目
      list = service.findScoreInfoBySelectedChannels(channelIds, startTime, endTime, author);
    } else if ("article".equals(mode)) { // 单篇文章
      list = (List<?>) service.findScoreInfoByArticle(articleId)[0];
    }

    if ("1".equals(type)) {
      drawPie(list);
    } else if ("0".equals(type)) {
      drawBar(list);
    }
    return XML;
  }
Exemplo n.º 4
0
  /** 保存评论信息。 供门户中文章页上填写评论信息时调用。 */
  public String saveComments() {
    if (articleId == null || commentContent == null)
      throw new BusinessException("文章ID或评论内容为空,评论失败!");

    service.saveComments(articleId, commentContent);
    return printSuccessMessage("感谢您的评论!");
  }
Exemplo n.º 5
0
  /** 初始化评论页面 */
  public String initCommentsSearchXForm() {
    PageInfo pageInfo = service.getCommentListByArticle(articleId, 1);

    XFormEncoder xFormEncoder = new XFormEncoder(CMSConstants.XFORM_TEMPLATE_COMMENTS_SEARCH);
    GridDataEncoder gridEncoder =
        new GridDataEncoder(pageInfo.getItems(), CMSConstants.GRID_TEMPLATE_COMMENTS);
    return print(
        new String[] {"SearchInfo", "CommentList", "PageList"},
        new Object[] {xFormEncoder, gridEncoder, pageInfo});
  }
Exemplo n.º 6
0
  /** 保存打分信息。 供门户中文章页上 打分 时调用。 */
  public String saveScoreInfo() {
    if (articleId == null || score == null) throw new BusinessException("评分失败,有非空数据项为空");

    ArticleScore scorerObj = new ArticleScore();
    scorerObj.setArticleId(articleId);
    scorerObj.setScoreTime(new Date());
    scorerObj.setScore(score);
    service.saveScoreInfo(scorerObj);

    return printSuccessMessage("感谢您的评分!");
  }
Exemplo n.º 7
0
 /**
  * 删除评论信息
  *
  * @return
  */
 public String delComment() {
   service.delComments(commentId);
   return printSuccessMessage("删除成功!");
 }