Exemplo n.º 1
0
 /**
  * 生成卡片树
  *
  * @param rootMenuId
  */
 private String generateCardTrees(Dto pDto) {
   IReader sqlRunner = (IReader) SpringBeanLoader.getSpringBean("g4Reader");
   HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   SessionContainer sessionContainer = WebUtils.getSessionContainer(request);
   String userid = sessionContainer.getUserInfo().getUserid();
   Dto qDto = new BaseDto();
   qDto.put("userid", userid);
   List cardList = (List) pDto.get("cardList");
   String treesString = scriptStart + "Ext.onReady(function(){";
   for (int i = 0; i < cardList.size(); i++) {
     MenuVo cardVo = (MenuVo) cardList.get(i);
     qDto.put("menuid", cardVo.getMenuid());
     qDto.put("accountType", pDto.getAsString("accountType"));
     List menuList = armTagSupportService.getCardTreeList(qDto).getDefaultAList();
     String rootName =
         (String) sqlRunner.queryForObject("Organization.getMenuNameForCNPath", "01");
     Dto pathDto = new BaseDto();
     pathDto.put("01", rootName);
     Dto dto = new BaseDto();
     dto.put("menuList", generateMenuPathName(menuList, pathDto));
     dto.put("menuid", cardVo.getMenuid());
     TemplateEngine engine = TemplateEngineFactory.getTemplateEngine(TemplateType.VELOCITY);
     DefaultTemplate template = new FileTemplate();
     template.setTemplateResource(
         TagHelper.getTemplatePath(getClass().getName(), "CardTreesTag.tpl"));
     StringWriter writer = engine.mergeTemplate(template, dto);
     treesString = treesString + "\n" + writer.toString();
   }
   return treesString + "\n});" + scriptEnd;
 }
Exemplo n.º 2
0
 /**
  * 获取Viewport标记脚本
  *
  * @return 返回Viewport标记脚本
  */
 private String getPanelScript() {
   IReader g4Reader = (IReader) SpringBeanLoader.getSpringBean("g4Reader");
   // String rootName =
   // (String)g4Reader.queryForObject("getMenuNameForCNPath", "01");
   HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
   Dto dto = new BaseDto();
   dto.put("northTitle", northTitle);
   dto.put(
       "centerTitle",
       G4Utils.isEmpty(WebUtils.getParamValue("MENU_FIRST", request))
           ? "请配置"
           : WebUtils.getParamValue("MENU_FIRST", request));
   dto.put(
       "welcomePageTitle",
       G4Utils.isEmpty(WebUtils.getParamValue("WELCOME_PAGE_TITLE", request))
           ? "请配置"
           : WebUtils.getParamValue("WELCOME_PAGE_TITLE", request));
   dto.put("banner", request.getContextPath() + WebUtils.getParamValue("INDEX_BANNER", request));
   dto.put("westTitle", westTitle);
   dto.put("scriptStart", scriptStart);
   dto.put("scriptEnd", scriptEnd);
   dto.put("copyright", WebUtils.getParamValue("BOTTOM_COPYRIGHT", request));
   String activeOnTop = "true";
   if ("0".equals(WebUtils.getParamValue("WEST_CARDMENU_ACTIVEONTOP", request))) {
     activeOnTop = "false";
   }
   dto.put("activeOnTop", activeOnTop);
   SessionContainer sessionContainer = WebUtils.getSessionContainer(request);
   String userid = sessionContainer.getUserInfo().getUserid();
   Dto dto2 = new BaseDto();
   dto2.put("userid", userid);
   String account = sessionContainer.getUserInfo().getAccount();
   account = account == null ? "" : account;
   String accountType = ArmConstants.ACCOUNTTYPE_NORMAL;
   if (account.equalsIgnoreCase(WebUtils.getParamValue("DEFAULT_ADMIN_ACCOUNT", request))) {
     accountType = ArmConstants.ACCOUNTTYPE_SUPER;
   } else if (account.equalsIgnoreCase(
       WebUtils.getParamValue("DEFAULT_DEVELOP_ACCOUNT", request))) {
     accountType = ArmConstants.ACCOUNTTYPE_DEVELOPER;
   }
   dto2.put("accountType", accountType);
   dto.put("accountType", accountType);
   List cardList = armTagSupportService.getCardList(dto2).getDefaultAList();
   for (int i = 0; i < cardList.size(); i++) {
     MenuVo cardVo = (MenuVo) cardList.get(i);
     if (i != cardList.size() - 1) {
       cardVo.setIsNotLast("true");
     }
   }
   dto.put("date", G4Utils.getCurDate());
   dto.put("week", G4Utils.getWeekDayByDate(G4Utils.getCurDate()));
   dto.put("welcome", getWelcomeMsg());
   dto.put("cardList", cardList);
   dto.put("username", sessionContainer.getUserInfo().getUsername());
   dto.put("account", sessionContainer.getUserInfo().getAccount());
   Dto qDto = new BaseDto();
   qDto.put("deptid", sessionContainer.getUserInfo().getDeptid());
   dto.put("deptname", armTagSupportService.getDepartmentInfo(qDto).getAsString("deptname"));
   Dto themeDto = new BaseDto();
   themeDto.put("userid", WebUtils.getSessionContainer(request).getUserInfo().getUserid());
   Dto resultDto = new BaseDto();
   resultDto = armTagSupportService.getEauserSubInfo(themeDto);
   String theme = resultDto.getAsString("theme");
   theme = G4Utils.isEmpty(theme) ? "default" : theme;
   dto.put("theme", theme);
   dto.put("themeColor", getThemeColor(theme));
   TemplateEngine engine = TemplateEngineFactory.getTemplateEngine(TemplateType.VELOCITY);
   DefaultTemplate template = new FileTemplate();
   template.setTemplateResource(TagHelper.getTemplatePath(getClass().getName()));
   StringWriter writer = engine.mergeTemplate(template, dto);
   String treesString = generateCardTrees(dto);
   return treesString + "\n" + writer.toString();
 }