use of com.netsteadfast.greenstep.model.MenuResultObj in project bamboobsc by billchen198318.
the class IndexAction method execute.
@ControllerMethodAuthority(programId = "CORE_INDEX")
public String execute() throws Exception {
try {
MenuResultObj menuData = MenuSupportUtils.getMenuData(super.getBasePath(), super.getHttpServletRequest().getSession().getId(), UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()));
comboButtonMenuData = menuData.getHtmlData();
dialogData = menuData.getDialogHtmlData();
treeJsonData = MenuSupportUtils.getMenuTreeJsonDataStr(super.getBasePath(), UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()));
} catch (Exception e) {
e.printStackTrace();
} finally {
if (!ApplicationSiteUtils.checkLoginUrlWithAllSysHostConfig(getHttpServletRequest())) {
showConfigHost = YesNo.YES;
}
}
return SUCCESS;
}
use of com.netsteadfast.greenstep.model.MenuResultObj in project bamboobsc by billchen198318.
the class MenuGenerateAction method generateMenuJs.
/**
* 下拉選單要用的 javascript
*
* @return
* @throws Exception
*/
public String generateMenuJs() throws Exception {
try {
MenuResultObj menuData = MenuSupportUtils.getMenuData(super.getBasePath(), super.getHttpServletRequest().getSession().getId(), UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()));
this.inputStream = new ByteArrayInputStream(menuData.getJavascriptData().getBytes());
} catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
}
use of com.netsteadfast.greenstep.model.MenuResultObj in project bamboobsc by billchen198318.
the class MenuSupportUtils method getMenuData.
/**
* 取回下拉選單(預設系統)
*
* @param basePath
* @return
* @throws ServiceException
* @throws Exception
*/
public static MenuResultObj getMenuData(String basePath, String jsessionId, String localeCode) throws ServiceException, Exception {
if (LocaleLanguageUtils.getMap().get(localeCode) == null) {
localeCode = LocaleLanguageUtils.getDefault();
}
Map<String, String> orderParams = new HashMap<String, String>();
orderParams.put("name", "asc");
List<TbSys> sysList = sysService.findListByParams(null, null, orderParams);
if (sysList == null || sysList.size() < 1) {
// 必需要有 TB_SYS 資料
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
MenuResultObj resultObj = new MenuResultObj();
StringBuilder jsSb = new StringBuilder();
StringBuilder htmlSb = new StringBuilder();
StringBuilder dlgSb = new StringBuilder();
jsSb.append("var ").append(Constants.GS_GET_APPLICATION_NAME_SCRIPT_OBJ).append(" = new Object(); ").append("\n");
jsSb.append("function ").append(Constants.GS_GET_APPLICATION_NAME_SCRIPT_FN).append(" { ").append("\n");
jsSb.append(" var name = ").append(Constants.GS_GET_APPLICATION_NAME_SCRIPT_OBJ).append("[progId];").append("\n");
jsSb.append(" if (name == null) { ").append("\n");
jsSb.append(" return progId; ").append("\n");
jsSb.append(" } ").append("\n");
jsSb.append(" return name; ").append("\n");
jsSb.append("} ").append("\n");
for (TbSys sys : sysList) {
Map<String, String> menuData = getMenuData(basePath, sys, jsessionId, localeCode);
jsSb.append(StringUtils.defaultString(menuData.get(MENU_ITEM_JAVASCRIPT)));
htmlSb.append(StringUtils.defaultString(menuData.get(MENU_ITEM_HTML)));
dlgSb.append(StringUtils.defaultString(menuData.get(MENU_ITEM_DIALOG)));
}
resultObj.setJavascriptData(jsSb.toString());
resultObj.setHtmlData(htmlSb.toString());
resultObj.setDialogHtmlData(dlgSb.toString());
return resultObj;
}
use of com.netsteadfast.greenstep.model.MenuResultObj in project bamboobsc by billchen198318.
the class MenuGenerateAction method generateMenu.
/**
* 下拉選單
*
* @return
* @throws Exception
*/
public String generateMenu() throws Exception {
try {
MenuResultObj menuData = MenuSupportUtils.getMenuData(super.getBasePath(), super.getHttpServletRequest().getSession().getId(), UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()));
this.inputStream = new ByteArrayInputStream(menuData.getHtmlData().getBytes());
} catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
}
Aggregations