コード例 #1
0
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    Integer siteId = getSiteId(params);
    if (siteId == null) {
      siteId = FrontUtils.getSite(env).getId();
    }
    Integer ctgId = getCtgId(params);
    Boolean enabled = getEnabled(params);
    if (enabled == null) {
      enabled = true;
    }
    List<CmsFriendlink> list = cmsFriendlinkMng.getList(siteId, ctgId, enabled);

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_LIST, DEFAULT_WRAPPER.wrap(list));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    body.render(env.getOut());
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
コード例 #2
0
 @SuppressWarnings("unchecked")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   CmsSite site = FrontUtils.getSite(env);
   String content = DirectiveUtils.getString(PARAM_CONTENT, params);
   if ("1".equals(content)) {
     String sysPage = DirectiveUtils.getString(PARAM_SYS_PAGE, params);
     String userPage = DirectiveUtils.getString(PARAM_USER_PAGE, params);
     if (!StringUtils.isBlank(sysPage)) {
       String tpl = TPL_STYLE_PAGE_CONTENT + sysPage + TPL_SUFFIX;
       env.include(tpl, UTF8, true);
     } else if (!StringUtils.isBlank(userPage)) {
       String tpl = getTplPath(site.getSolutionPath(), TPLDIR_STYLE_PAGE, userPage);
       env.include(tpl, UTF8, true);
     } else {
       // 没有包含分页
     }
   } else {
     FrontUtils.includePagination(site, params, env);
   }
 }