Author: jleroux
Date: Fri Jul 13 06:31:48 2007
New Revision: 555988
URL:
http://svn.apache.org/viewvc?view=rev&rev=555988Log:
A 1st patch (htmlwidget.patch 2 kb)from Adriam Crum "Make OFBiz more dial-up friendly" (
https://issues.apache.org/jira/browse/OFBIZ-642)
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?view=diff&rev=555988&r1=555987&r2=555988==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Fri Jul 13 06:31:48 2007
@@ -35,6 +35,8 @@
import org.w3c.dom.Element;
import freemarker.template.TemplateException;
+import freemarker.template.TemplateModelException;
+import freemarker.template.utility.StandardCompress;
/**
* Widget Library - Screen model HTML class
@@ -73,8 +75,18 @@
//Debug.logInfo("Rendering template at location [" + location + "] with context: \n" + context, module);
if (location.endsWith(".ftl")) {
+ StandardCompress compress = new StandardCompress();
+ String compressHTML = null;
+ Map parametersMap = (Map) context.get("parameters");
+ if (parametersMap != null) {
+ compressHTML = (String) parametersMap.get("compressHTML");
+ }
try {
- FreeMarkerWorker.renderTemplateAtLocation(location, context, writer);
+ if ("true".equals(compressHTML)) {
+ FreeMarkerWorker.renderTemplateAtLocation(location, context, compress.getWriter(writer, null));
+ } else {
+ FreeMarkerWorker.renderTemplateAtLocation(location, context, writer);
+ }
} catch (MalformedURLException e) {
String errMsg = "Error rendering included template at location [" + location + "]: " + e.toString();
Debug.logError(e, errMsg, module);
@@ -92,7 +104,7 @@
throw new IllegalArgumentException("Rending not yet support for the tempalte at location: " + location);
}
}
-
+
public static class HtmlTemplate extends ModelScreenWidget {
protected FlexibleStringExpander locationExdr;
@@ -174,4 +186,6 @@
}
}
}
+
+