📄 rendersubcontentcachetransform.java
字号:
} public void renderSubContent() throws IOException { //TemplateHashModel dataRoot = env.getDataModel(); Timestamp fromDate = UtilDateTime.nowTimestamp(); List passedGlobalNodeTrail = (List)templateRoot.get("globalNodeTrail"); String editRequestName = (String)templateRoot.get("editRequestName"); //if (Debug.infoOn()) Debug.logInfo("in Render(3), editRequestName ." + editRequestName , module); GenericValue thisView = null; if (view != null) { thisView = view; } else if (passedGlobalNodeTrail.size() > 0) { Map map = (Map)passedGlobalNodeTrail.get(passedGlobalNodeTrail.size() - 1); if (Debug.infoOn()) Debug.logInfo("in Render(3), map ." + map , module); if (map != null) thisView = (GenericValue)map.get("value"); } //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, subContentId:" + templateRoot.get( "subContentId"), module); //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId:" + templateRoot.get( "contentId"), module); String mimeTypeId = (String) templateRoot.get("mimeTypeId"); Locale locale = (Locale) templateRoot.get("locale"); if (locale == null) locale = Locale.getDefault(); if (UtilValidate.isNotEmpty(editRequestName)) { String editStyle = getEditStyle(); openEditWrap(out, editStyle); } if (thisView != null) { try { ContentWorker.renderContentAsTextCache(delegator, null, out, templateRoot, thisView, locale, mimeTypeId); //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, after renderContentAsTextCache:", module); } catch (GeneralException e) { Debug.logError(e, "Error rendering content", module); throw new IOException("Error rendering thisView:" + thisView + " msg:" + e.toString()); } } if (UtilValidate.isNotEmpty(editRequestName)) { closeEditWrap(out, editRequestName); } //if (Debug.infoOn()) Debug.logInfo("in Render(4), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module); return; } public void openEditWrap(Writer out, String editStyle) throws IOException { String divStr = "<div class=\"" + editStyle + "\">"; out.write(divStr); } public void closeEditWrap(Writer out, String editRequestName) throws IOException { //if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(1):" + templateRoot.get( "contentId"), module); //if (Debug.infoOn()) Debug.logInfo("in Render(0), templateRoot ." + templateRoot , module); StringBuffer sb = new StringBuffer(); String fullRequest = editRequestName; String contentId = null; String contentIdTo = null; String contentAssocTypeId = null; String mapKey = null; String fromDate = null; if (!directAssocMode) { contentIdTo = (String)templateRoot.get("contentId"); contentAssocTypeId = (String)templateRoot.get("contentAssocTypeId"); mapKey = (String)templateRoot.get("mapKey"); fromDate = (String)templateRoot.get("fromDate"); if (Debug.infoOn()) Debug.logInfo("in Render(0), view ." + view , module); if (view != null) { ModelEntity modelEntity = view.getModelEntity(); if (UtilValidate.isEmpty(contentId) && modelEntity.getField("caContentId") != null ) contentId = view.getString("caContentId"); if (UtilValidate.isEmpty(contentId) && modelEntity.getField("contentId") != null ) contentId = view.getString("contentId"); if (UtilValidate.isEmpty(contentIdTo) && modelEntity.getField("caContentIdTo") != null ) contentIdTo = view.getString("caContentIdTo"); if (UtilValidate.isEmpty(contentIdTo) && modelEntity.getField("contentIdTo") != null ) contentIdTo = view.getString("contentIdTo"); if (UtilValidate.isEmpty(contentAssocTypeId) && modelEntity.getField("caContentAssocTypeId") != null ) contentAssocTypeId = view.getString("caContentAssocTypeId"); if (UtilValidate.isEmpty(contentAssocTypeId) && modelEntity.getField("contentAssocTypeId") != null ) contentAssocTypeId = view.getString("contentAssocTypeId"); if (UtilValidate.isEmpty(mapKey) && modelEntity.getField("caMapKey") != null ) mapKey = view.getString("caMapKey"); if (UtilValidate.isEmpty(mapKey) && modelEntity.getField("mapKey") != null ) mapKey = view.getString("mapKey"); if (UtilValidate.isEmpty(fromDate) && modelEntity.getField("caFromDate") != null ) fromDate = view.getString("caFromDate"); if (UtilValidate.isEmpty(fromDate) && modelEntity.getField("fromDate") != null ) fromDate = view.getString("fromDate"); } } else { contentId = (String)templateRoot.get("subContentId"); } if (Debug.infoOn()) Debug.logInfo("in Render(0), contentIdTo ." + contentIdTo , module); String delim = "?"; if (UtilValidate.isNotEmpty(contentId)) { fullRequest += delim + "contentId=" + contentId; delim = "&"; } if (UtilValidate.isNotEmpty(contentIdTo)) { fullRequest += delim + "contentIdTo=" + contentIdTo; delim = "&"; } if (UtilValidate.isNotEmpty(contentAssocTypeId)) { fullRequest += delim + "contentAssocTypeId=" + contentAssocTypeId; delim = "&"; } if (UtilValidate.isNotEmpty(mapKey)) { fullRequest += delim + "mapKey=" + mapKey; delim = "&"; } if (UtilValidate.isNotEmpty(fromDate)) { fullRequest += delim + "fromDate=" + fromDate; delim = "&"; } if (Debug.infoOn()) Debug.logInfo("in Render(2), contentIdTo ." + contentIdTo , module); WidgetWorker.appendOfbizUrl(sb, fullRequest, request, response); String url = sb.toString(); String link = "<a href=\"" + url + "\">Edit</a>"; out.write(link); String divStr = "</div>"; out.write(divStr); } public String getEditStyle() { String editStyle = (String)templateRoot.get("editStyle"); if (UtilValidate.isEmpty(editStyle)) { editStyle = UtilProperties.getPropertyValue("content", "defaultEditStyle"); } if (UtilValidate.isEmpty(editStyle)) { editStyle = "buttontext"; } return editStyle; } }; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -