svn commit: r1814116 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java

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

svn commit: r1814116 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java

jleroux@apache.org
Author: jleroux
Date: Thu Nov  2 21:58:37 2017
New Revision: 1814116

URL: http://svn.apache.org/viewvc?rev=1814116&view=rev
Log:
Fixed: Error on first access to Online Help
(OFBIZ-9925)

There are maybe better fixes but adding a default theme when it's null works

Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java
    ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java?rev=1814116&r1=1814115&r2=1814116&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java Thu Nov  2 21:58:37 2017
@@ -47,6 +47,7 @@ import org.apache.ofbiz.entity.util.Enti
 import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.webapp.control.RequestHandler;
 import org.apache.ofbiz.webapp.website.WebSiteWorker;
+import org.apache.ofbiz.widget.model.ThemeFactory;
 import org.apache.ofbiz.widget.renderer.FormStringRenderer;
 import org.apache.ofbiz.widget.renderer.ScreenRenderer;
 import org.apache.ofbiz.widget.renderer.VisualTheme;
@@ -290,6 +291,10 @@ public class CmsEvents {
                 try {
                     writer = response.getWriter();
                     // TODO: replace "screen" to support dynamic rendering of different output
+                    if (visualTheme == null) {
+                        String defaultVisualThemeId = EntityUtilProperties.getPropertyValue("general", "VISUAL_THEME", delegator);
+                        visualTheme = ThemeFactory.getVisualThemeFromId(defaultVisualThemeId);  
+                    }                    
                     FormStringRenderer formStringRenderer = new MacroFormRenderer(visualTheme.getModelTheme().getFormRendererLocation("screen"), request, response);
                     templateMap.put("formStringRenderer", formStringRenderer);
 

Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java?rev=1814116&r1=1814115&r2=1814116&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java Thu Nov  2 21:58:37 2017
@@ -59,6 +59,7 @@ import org.apache.ofbiz.widget.cache.Scr
 import org.apache.ofbiz.widget.cache.WidgetContextCacheKey;
 import org.apache.ofbiz.widget.model.ModelScreen;
 import org.apache.ofbiz.widget.model.ScreenFactory;
+import org.apache.ofbiz.widget.model.ThemeFactory;
 import org.xml.sax.SAXException;
 
 import freemarker.ext.jsp.TaglibFactory;
@@ -214,8 +215,11 @@ public class ScreenRenderer {
         context.put("timeZone", UtilHttp.getTimeZone(request));
 
         // ========== setup values that are specific to OFBiz webapps
-
         VisualTheme visualTheme = UtilHttp.getVisualTheme(request);
+        if (visualTheme == null) {
+            String defaultVisualThemeId = EntityUtilProperties.getPropertyValue("general", "VISUAL_THEME", (Delegator) request.getAttribute("delegator"));
+            visualTheme = ThemeFactory.getVisualThemeFromId(defaultVisualThemeId);  
+        }
         context.put("visualTheme", visualTheme);
         context.put("modelTheme", visualTheme.getModelTheme());
         context.put("request", request);