Author: jaz
Date: Sat Nov 17 12:57:23 2007
New Revision: 596003
URL:
http://svn.apache.org/viewvc?rev=596003&view=revLog:
added code to allow adding objects to the FTL for survey rendering
Modified:
ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=596003&r1=596002&r2=596003&view=diff==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Sat Nov 17 12:57:23 2007
@@ -67,6 +67,7 @@
protected String responseId = null;
protected String partyId = null;
protected String surveyId = null;
+ protected Map templateContext = null;
protected Map passThru = null;
protected Map defaultValues = null;
protected boolean edit = false;
@@ -120,6 +121,27 @@
}
/**
+ * Adds an object to the FTL survey template context
+ * @param name
+ * @param value
+ */
+ public void addToTemplateContext(String name, Object value) {
+ if (templateContext == null) {
+ templateContext = FastMap.newInstance();
+ }
+ templateContext.put(name, value);
+ }
+
+ /**
+ * Removes an object from the FTL survey template context
+ * @param name
+ */
+ public void removeFromTemplateContext(String name) {
+ if (templateContext != null)
+ templateContext.remove(name);
+ }
+
+ /**
* Renders the Survey
* @return Writer object from the parsed Freemarker Template
* @throws SurveyWrapperException
@@ -163,7 +185,10 @@
}
}
- Map templateContext = FastMap.newInstance();
+ if (templateContext == null) {
+ templateContext = FastMap.newInstance();
+ }
+
FreeMarkerWorker.addAllOfbizTransforms(templateContext);
templateContext.put("partyId", partyId);
templateContext.put("survey", survey);