📄 editrendersubcontenttransform.java
字号:
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, subContentDataResourceView contentId/drDataResourceId:"
+ subContentDataResourceView.get("contentId") + " / "
+ subContentDataResourceView.get("drDataResourceId"), module);
dataResourceIdTemp = (String) subContentDataResourceView.get("drDataResourceId");
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent(0), dataResourceIdTemp ." + dataResourceIdTemp, module);
subContentIdSubTemp = (String) subContentDataResourceView.get("contentId");
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent(0), subContentIdSubTemp ." + subContentIdSubTemp, module);
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent(0), mimeTypeIdTemp." + mimeTypeIdTemp, module);
if (UtilValidate.isEmpty(subDataResourceTypeIdTemp)) {
subDataResourceTypeIdTemp = (String) subContentDataResourceView.get("drDataResourceTypeId");
}
if (UtilValidate.isEmpty(mimeTypeIdTemp)) {
mimeTypeIdTemp = (String) subContentDataResourceView.get("mimeTypeId");
if (UtilValidate.isEmpty(mimeTypeIdTemp) && UtilValidate.isNotEmpty(contentId)) { // will need these below
try {
parentContent = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId));
if (parentContent != null) {
mimeTypeIdTemp = (String) parentContent.get("mimeTypeId");
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, parentContentId: " + parentContent.get("contentId"), module);
}
} catch (GenericEntityException e) {
throw new RuntimeException(e.getMessage());
}
}
}
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent(2), mimeTypeIdTemp." + mimeTypeIdTemp, module);
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, subContentId/Sub." + subContentIdSubTemp, module);
ctx.put("subContentId", subContentIdSubTemp);
ctx.put("drDataResourceId", dataResourceIdTemp);
ctx.put("subContentDataResourceView", subContentDataResourceView);
ctx.put("mimeTypeId", mimeTypeIdTemp);
//request.setAttribute("drDataResourceId", subContentDataResourceView.get("drDataResourceId"));
} else {
ctx.put("subContentId", null);
ctx.put("drDataResourceId", null);
ctx.put("subContentDataResourceView", null);
ctx.put("mimeTypeId", null);
//request.setAttribute("drDataResourceId", null);
}
final String dataResourceId = dataResourceIdTemp;
final String subContentIdSub = subContentIdSubTemp;
//final GenericValue finalSubContentView = subContentDataResourceView;
//final GenericValue content = parentContent;
final Map templateContext = ctx;
//if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, templateContext:"+templateContext,module);
final String mimeTypeId = mimeTypeIdTemp;
final String subDataResourceTypeId = subDataResourceTypeIdTemp;
return new Writer(out) {
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, buf:" + buf.toString(), module);
}
public void flush() throws IOException {
out.flush();
}
public void close() throws IOException {
String wrappedFTL = buf.toString();
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, wrappedFTL:" + wrappedFTL, module);
if (editTemplate != null && editTemplate.equalsIgnoreCase("true")) {
if (UtilValidate.isNotEmpty(wrapTemplateId)) {
templateContext.put("wrappedFTL", wrappedFTL);
//ServletContext servletContext = (ServletContext)request.getSession().getServletContext();
//String rootDir = servletContext.getRealPath("/");
if (Debug.verboseOn()) Debug.logVerbose("in EditRenderSubContent, rootDir:" + rootDir, module);
templateContext.put("webSiteId", webSiteId);
templateContext.put("https", https);
templateContext.put("rootDir", rootDir);
Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
templateRoot.put("wrapDataResourceId", dataResourceId);
templateRoot.put("wrapDataResourceTypeId", subDataResourceTypeId);
templateRoot.put("wrapContentIdTo", contentId);
templateRoot.put("wrapSubContentId", subContentIdSub);
templateRoot.put("wrapMimeTypeId", mimeTypeId);
templateRoot.put("wrapMapKey", mapKey);
templateRoot.put("context", templateContext);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, wrapDataResourceId:" + dataResourceId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, wrapDataResourceTypeId:" + subDataResourceTypeId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, wrapContentIdTo:" + contentId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, wrapSubContentId:" + subContentIdSub, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, wrapMimeTypeId:" + mimeTypeId, module);
//if (Debug.verboseOn()) Debug.logVerbose("in ERSC, wrapMapKey:" + mapKey,module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, calling renderContentAsText, wrapTemplateId:" + wrapTemplateId, module);
try {
ContentWorker.renderContentAsText(delegator, wrapTemplateId, out, templateRoot, null, locale, mimeTypeId);
} catch (IOException e) {
Debug.logError(e, "Error rendering content" + e.getMessage(), module);
throw new IOException("Error rendering content" + e.toString());
} catch (GeneralException e2) {
Debug.logError(e2, "Error rendering content" + e2.getMessage(), module);
throw new IOException("Error rendering content" + e2.toString());
}
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, after renderContentAsText", module);
Map ctx = (Map) FreeMarkerWorker.getWrappedObject("context", env);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, contentId:" + ctx.get("contentId"), module);
templateContext.put("contentId", contentId);
templateContext.put("locale", locale);
templateContext.put("mapKey", null);
templateContext.put("subContentId", null);
templateContext.put("templateContentId", null);
templateContext.put("subDataResourceTypeId", null);
templateContext.put("mimeTypeId", null);
templateContext.put("wrappedFTL", null);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, after.", module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, mapKey:" + mapKey, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, subContentId:" + subContentId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, subDataResourceTypeId:" + subDataResourceTypeId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, contentId:" + contentId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, mimeTypeId:" + mimeTypeId, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, locale:" + locale, module);
if (Debug.verboseOn()) Debug.logVerbose("in ERSC, contentId2." + ctx.get("contentId"), module);
}
} else {
out.write(wrappedFTL);
}
}
};
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -