[ofbiz-framework] branch trunk updated: Fixed: Error wIth Flat Grey theme related to rest component (OFBIZ-12093)

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

[ofbiz-framework] branch trunk updated: Fixed: Error wIth Flat Grey theme related to rest component (OFBIZ-12093)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 333b896  Fixed: Error wIth Flat Grey theme related to rest component (OFBIZ-12093)
333b896 is described below

commit 333b896eef41e8f79c4bbbec5fe2ee5aac26078a
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Fri Dec 18 10:38:26 2020 +0100

    Fixed: Error wIth Flat Grey theme related to rest component (OFBIZ-12093)
   
    When you use the Flat Grey theme (useful for RTL languages) you see an error in
    the main menu (component choise). It's related to the rest component not using a
    controller.
   
    Fixes is simple and has not side effect: instead of throwing an exception simply
    log a warning and return an empty string
---
 .../java/org/apache/ofbiz/webapp/WebAppUtil.java   |  5 ++--
 themes/flatgrey/template/AppBar.ftl                | 34 ++++++++++++----------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppUtil.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppUtil.java
index b5da194..80cbfe5 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppUtil.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppUtil.java
@@ -96,8 +96,9 @@ public final class WebAppUtil {
             }
         }
         if (servletMapping == null) {
-            throw new IllegalArgumentException("org.apache.ofbiz.webapp.control.ControlServlet mapping not found in "
-                    + webAppInfo.location().resolve(WEB_APP_FILE_NAME));
+            Debug.logWarning("org.apache.ofbiz.webapp.control.ControlServlet mapping not found in "
+                    + webAppInfo.location().resolve(WEB_APP_FILE_NAME), MODULE);
+            return "";
         }
         servletMapping = servletMapping.replace("*", "");
         String servletPath = webAppInfo.getContextRoot().concat(servletMapping);
diff --git a/themes/flatgrey/template/AppBar.ftl b/themes/flatgrey/template/AppBar.ftl
index 893c8e7..061cafc 100644
--- a/themes/flatgrey/template/AppBar.ftl
+++ b/themes/flatgrey/template/AppBar.ftl
@@ -36,24 +36,26 @@ under the License.
           <#assign selected = true>
         </#if>
         <#assign servletPath = Static["org.apache.ofbiz.webapp.WebAppUtil"].getControlServletPath(display)>
-        <#assign thisURL = StringUtil.wrapString(servletPath)>
-        <#if thisApp != "/">
-          <#assign thisURL = thisURL + "main">
-        </#if>
-        <#if layoutSettings.suppressTab?? && display.name == layoutSettings.suppressTab>
-          <#-- do not display this component-->
-        <#else>
-          <#if appCount % 4 == 0>
-            <#if firstApp>
-              <li class="first">
-              <#assign firstApp = false>
+        <#if servletPath?has_content>
+            <#assign thisURL = StringUtil.wrapString(servletPath)>
+            <#if thisApp != "/">
+              <#assign thisURL = thisURL + "main">
+            </#if>
+            <#if layoutSettings.suppressTab?? && display.name == layoutSettings.suppressTab>
+              <#-- do not display this component-->
             <#else>
-              </li>
-              <li>
+              <#if appCount % 4 == 0>
+                <#if firstApp>
+                  <li class="first">
+                  <#assign firstApp = false>
+                <#else>
+                  </li>
+                  <li>
+                </#if>
+              </#if>
+              <a href="${thisURL}${StringUtil.wrapString(externalKeyParam)}"<#if selected> class="selected"</#if><#if uiLabelMap??> title="${uiLabelMap[display.description]}">${uiLabelMap[display.title]}<#else> title="${display.description}">${display.title}</#if></a>
+              <#assign appCount = appCount + 1>
             </#if>
-          </#if>
-          <a href="${thisURL}${StringUtil.wrapString(externalKeyParam)}"<#if selected> class="selected"</#if><#if uiLabelMap??> title="${uiLabelMap[display.description]}">${uiLabelMap[display.title]}<#else> title="${display.description}">${display.title}</#if></a>
-          <#assign appCount = appCount + 1>
         </#if>
       </#list>
       <#list displaySecondaryApps as display>