svn commit: r1806742 - in /ofbiz/ofbiz-framework/trunk: framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java themes/common/template/macro/HtmlFormMacroLibrary.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1806742 - in /ofbiz/ofbiz-framework/trunk: framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java themes/common/template/macro/HtmlFormMacroLibrary.ftl

nmalin
Author: nmalin
Date: Wed Aug 30 21:40:33 2017
New Revision: 1806742

URL: http://svn.apache.org/viewvc?rev=1806742&view=rev
Log:
Fixed: HtmlFormMacroLibary.ftl contains direct call to widget.properties (OFBIZ-9138 Create a common theme)
Instead of use the properties on the current theme, some ftl macro present in the file HtmlFormMacroLibary.ftl used a directl call to widget.properties.
To help the code reader, the modelTheme has been set on the root ftl context, and the previous widget.properties call replace by modelTheme call

Modified:
    ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
    ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl

Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1806742&r1=1806741&r2=1806742&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java Wed Aug 30 21:40:33 2017
@@ -146,6 +146,7 @@ public final class MacroFormRenderer imp
         try {
             Environment environment = getEnvironment(writer);
             environment.setVariable("visualTheme", FreeMarkerWorker.autoWrap(visualTheme, environment));
+            environment.setVariable("modelTheme", FreeMarkerWorker.autoWrap(visualTheme.getModelTheme(), environment));
             Reader templateReader = new StringReader(macro);
             Template template = new Template(new UID().toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig());
             templateReader.close();

Modified: ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl?rev=1806742&r1=1806741&r2=1806742&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl Wed Aug 30 21:40:33 2017
@@ -69,8 +69,8 @@ under the License.
     require
   /><#t/>
   <#if ajaxEnabled?has_content && ajaxEnabled>
-    <#assign defaultMinLength = visualTheme.getModelTheme().getAutocompleterDefaultDelay()>
-    <#assign defaultDelay = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.autocompleter.defaultDelay", delegatorName)>
+    <#assign defaultMinLength = modelTheme.getAutocompleterDefaultMinLength()>
+    <#assign defaultDelay = modelTheme.getAutocompleterDefaultDelay()>
     <script language="JavaScript" type="text/javascript">ajaxAutoCompleter('${ajaxUrl}', false, ${defaultMinLength!2}, ${defaultDelay!300});</script><#lt/>
   </#if>
 </#macro>
@@ -642,7 +642,7 @@ Parameter: delegatorName, String, option
     <#local ajaxUrl = id + "," + ajaxUrl + ",ajaxLookup=Y" />
   </#if>
   <#if (!showDescription?has_content)>
-    <#local showDescriptionProp = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.lookup.showDescription", "N", delegatorName)>
+    <#local showDescriptionProp = modelTheme.getLookupShowDescription()>
     <#if "Y" == showDescriptionProp>
       <#local showDescription = "true" />
     <#else>
@@ -650,13 +650,13 @@ Parameter: delegatorName, String, option
     </#if>
   </#if>
   <#if (!position?has_content)>
-    <#local position = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.lookup.position", "topleft", delegatorName)>
+    <#local position = modelTheme.getLookupPosition()>
   </#if>
   <#if (!width?has_content)>
-    <#local width = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.lookup.width", "620", delegatorName)>
+    <#local width = modelTheme.getLookupWidth()>
   </#if>
   <#if (!height?has_content)>
-    <#local height = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.lookup.height", "500", delegatorName)>
+    <#local height = modelTheme.getLookupHeight()>
   </#if>
   <#if ajaxEnabled?has_content && ajaxEnabled>
     <script type="text/javascript">
@@ -693,8 +693,8 @@ Parameter: delegatorName, String, option
       );"></a><#rt>
     <#else>
       <#if ajaxEnabled?has_content && ajaxEnabled>
-        <#assign defaultMinLength = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.autocompleter.defaultMinLength", delegatorName)>
-        <#assign defaultDelay = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValueFromDelegatorName("widget", "widget.autocompleter.defaultDelay", delegatorName)>
+        <#assign defaultMinLength = modelTheme.getAutocompleterDefaultMinLength()>
+        <#assign defaultDelay = modelTheme.getAutocompleterDefaultDelay()>
         <#local ajaxUrl = ajaxUrl + "&amp;_LAST_VIEW_NAME_=" + lastViewName />
         <#if !ajaxUrl?contains("searchValueFieldName=")>
           <#if descriptionFieldName?has_content && showDescription == "true">