Exemplo n.º 1
0
  @RequiresPermissions("cms:article:view")
  @RequestMapping(value = "form")
  public String form(Article article, Model model) {
    // 如果当前传参有子节点,则选择取消传参选择
    if (article.getCategory() != null && StringUtils.isNotBlank(article.getCategory().getId())) {
      List<Category> list =
          categoryService.findByParentId(article.getCategory().getId(), Site.getCurrentSiteId());
      if (list.size() > 0) {
        article.setCategory(null);
      } else {
        article.setCategory(categoryService.get(article.getCategory().getId()));
      }
    }
    article.setArticleData(articleDataService.get(article.getId()));
    model.addAttribute("article", article);
    CmsUtils.addViewConfigAttribute(model, article.getCategory());

    if (0 == article.getMsgType()) {
      return "modules/cms/articleForm";
    } else if (1 == article.getMsgType()) {
      return "modules/cms/articleSingleForm";
    } else if (2 == article.getMsgType()) {
      return "modules/cms/articleManyForm";
    }

    return "modules/cms/articleForm";
  }
Exemplo n.º 2
0
 private List<String> getTplContent() {
   List<String> tplList =
       fileTplService.getNameListByPrefix(
           siteService.get(Site.getCurrentSiteId()).getSolutionPath());
   tplList = TplUtils.tplTrim(tplList, Article.DEFAULT_TEMPLATE, "");
   return tplList;
 }