Author: jaz
Date: Tue Feb 27 19:38:41 2007 New Revision: 512592 URL: http://svn.apache.org/viewvc?view=rev&rev=512592 Log: added sub-content rendering so CMS can render HTML meta-tags Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?view=diff&rev=512592&r1=512591&r2=512592 ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Tue Feb 27 19:38:41 2007 @@ -61,6 +61,7 @@ import bsh.EvalError; import freemarker.ext.dom.NodeModel; +import javolution.util.FastMap; //import com.clarkware.profiler.Profiler; /** @@ -1235,7 +1236,25 @@ } if (templateContext == null) { - templateContext = new HashMap(); + templateContext = FastMap.newInstance(); + } + + // render all sub-content; place in template context under mapKey name + List subContent = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, + "contentAssocTypeId", "SUB_CONTENT"), UtilMisc.toList("-fromDate")); + subContent = EntityUtil.filterByDate(subContent); + + if (subContent != null && subContent.size() > 0) { + Iterator i = subContent.iterator(); + while (i.hasNext()) { + GenericValue contentAssoc = (GenericValue) i.next(); + String contentIdTo = contentAssoc.getString("contentIdTo"); + String key = contentAssoc.getString("mapKey"); + String textData = ContentWorker.renderContentAsTextCache(delegator, contentIdTo, FastMap.newInstance(), null, locale, mimeTypeId); + if (UtilValidate.isNotEmpty(textData)) { + templateContext.put(key, textData); + } + } } // TODO: what should we REALLY do here? looks like there is no decision between Java and Service style error handling... Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?view=diff&rev=512592&r1=512591&r2=512592 ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Tue Feb 27 19:38:41 2007 @@ -625,9 +625,12 @@ // prepare the map for preRenderedContent Map prc = FastMap.newInstance(); - String mapKey = (String) context.get("mapKey"); String textData = (String) context.get("textData"); - prc.put("body", textData); + String mapKey = (String) context.get("mapKey"); + if (mapKey != null) { + prc.put(mapKey, textData); + } + prc.put("body", textData); // used for default screen defs context.put("preRenderedContent", prc); ScreenRenderer screens = (ScreenRenderer) context.get("screens"); |
Free forum by Nabble | Edit this page |