This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/release24.09 by this push:
     new 1173801809 Fixed: rest/control/main generates a 404 (OFBIZ-OFBIZ-12296)
1173801809 is described below

commit 1173801809a4accffcfb48a7c51576ed010e12cb
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Tue Nov 19 08:59:41 2024 +0100

    Fixed: rest/control/main generates a 404 (OFBIZ-OFBIZ-12296)
    
    As it's now explained at
    
https://nightlies.apache.org/ofbiz/trunk/plugins/rest-api/html5/rest-api.html
    
    the control/main part is not handled by the rest-api plugin.
    
    This handles that at the theme level in order to not generate
    rest/control/main
    but only rest
    
    Thanks: Pierre for report
---
 themes/bluelight/template/AppBarOpen.ftl           |  4 +-
 themes/flatgrey/template/AppBar.ftl                |  4 +-
 themes/helveticus/template/includes/TopAppBar.ftl  | 91 +++++++++++-----------
 .../rainbowstone/template/includes/TopAppBar.ftl   | 10 +--
 themes/tomahawk/template/AppBarOpen.ftl            |  4 +-
 5 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/themes/bluelight/template/AppBarOpen.ftl 
b/themes/bluelight/template/AppBarOpen.ftl
index 084f471eb5..b72ff30b7e 100644
--- a/themes/bluelight/template/AppBarOpen.ftl
+++ b/themes/bluelight/template/AppBarOpen.ftl
@@ -48,7 +48,7 @@ under the License.
               <#assign thisApp = StringUtil.wrapString(thisApp)>
               <#assign thisURL = thisApp>
               <#assign thisAppShortcutScreen = display.getAppShortcutScreen()!>
-              <#if thisApp != "/">
+              <#if thisApp != "/" && thisApp != "/rest">
                 <#assign thisURL = thisURL + "/control/main">
               </#if>
               <#if layoutSettings.suppressTab?? && display.name == 
layoutSettings.suppressTab>
@@ -68,7 +68,7 @@ under the License.
               </#if>
               <#assign thisApp = StringUtil.wrapString(thisApp)>
               <#assign thisURL = thisApp>
-              <#if thisApp != "/">
+              <#if thisApp != "/" && thisApp != "/rest">
                 <#assign thisURL = thisURL + "/control/main">
               </#if>
               <#if layoutSettings.suppressTab?? && display.name == 
layoutSettings.suppressTab>
diff --git a/themes/flatgrey/template/AppBar.ftl 
b/themes/flatgrey/template/AppBar.ftl
index 061cafc1d9..8f393b19f2 100644
--- a/themes/flatgrey/template/AppBar.ftl
+++ b/themes/flatgrey/template/AppBar.ftl
@@ -38,7 +38,7 @@ under the License.
         <#assign servletPath = 
Static["org.apache.ofbiz.webapp.WebAppUtil"].getControlServletPath(display)>
         <#if servletPath?has_content>
             <#assign thisURL = StringUtil.wrapString(servletPath)>
-            <#if thisApp != "/">
+            <#if thisApp != "/" && thisApp != "/rest">
               <#assign thisURL = thisURL + "main">
             </#if>
             <#if layoutSettings.suppressTab?? && display.name == 
layoutSettings.suppressTab>
@@ -66,7 +66,7 @@ under the License.
         </#if>
           <#assign servletPath = 
Static["org.apache.ofbiz.webapp.WebAppUtil"].getControlServletPath(display)>
           <#assign thisURL = StringUtil.wrapString(servletPath)>
-          <#if thisApp != "/">
+          <#if thisApp != "/" && thisApp != "/rest">
             <#assign thisURL = thisURL + "main">
           </#if>
         <#if appCount % 4 == 0>
diff --git a/themes/helveticus/template/includes/TopAppBar.ftl 
b/themes/helveticus/template/includes/TopAppBar.ftl
index 8a30b7b94d..3b83062ef0 100644
--- a/themes/helveticus/template/includes/TopAppBar.ftl
+++ b/themes/helveticus/template/includes/TopAppBar.ftl
@@ -68,7 +68,7 @@ under the License.
                     </#if>
                     <#assign thisApp = StringUtil.wrapString(thisApp)>
                     <#assign thisURL = thisApp>
-                    <#if thisApp != "/">
+                    <#if thisApp != "/" && thisApp != "/rest">
                         <#assign thisURL = thisURL + "/control/main">
                     </#if>
                     <#if layoutSettings.suppressTab?exists && display.name == 
layoutSettings.suppressTab>
@@ -111,7 +111,7 @@ under the License.
                     </#if>
                     <#assign thisApp = StringUtil.wrapString(thisApp)>
                     <#assign thisURL = thisApp>
-                    <#if thisApp != "/">
+                    <#if thisApp != "/" && thisApp != "/rest">
                         <#assign thisURL = thisURL + "/control/main">
                     </#if>
                     <#if appCount<=appMax>
@@ -157,7 +157,7 @@ under the License.
                 </#if>
                 <#assign thisApp = StringUtil.wrapString(thisApp)>
                 <#assign thisURL = thisApp>
-                <#if thisApp != "/">
+                <#if thisApp != "/" && thisApp != "/rest">
                     <#assign thisURL = thisURL + "/control/main">
                 </#if>
                 <#if layoutSettings.suppressTab?exists && display.name == 
layoutSettings.suppressTab>
@@ -169,8 +169,8 @@ under the License.
                         <span>
                             <svg fill="none" stroke="currentColor" viewBox="0 
0 24 24" xmlns="http://www.w3.org/2000/svg";>
                                 <path stroke-linecap="round" 
stroke-linejoin="round" stroke-width="1" d="M5 12h.01M12 12h.01M19 12h.01M6 
12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 
0 012 0z" />
-                            </svg>                        
-                        </span>                        
+                            </svg>
+                        </span>
                         <ul id="more-app-list">
                             <#assign moreApp = true>
                         </#if>
@@ -187,47 +187,50 @@ under the License.
         </#list>
         </#if>
         <#if displaySecondaryApps??>
-        <#list displaySecondaryApps as display>
-            <#assign thisApp = display.getContextRoot()>
-            <#assign permission = true>
-            <#assign selected = false>
-            <#assign permissions = display.getBasePermission()>
-            <#list permissions as perm>
-                <#if (perm != "NONE" && !security.hasEntityPermission(perm, 
"_VIEW", session))>
-                <#-- User must have ALL permissions in the base-permission 
list -->
-                    <#assign permission = false>
-                </#if>
-            </#list>
-            <#if permission == true>
-                <#if thisApp == contextPath || contextPath + "/" == thisApp>
-                    <#assign selected = true>
-                </#if>
-                <#assign thisApp = StringUtil.wrapString(thisApp)>
-                <#assign thisURL = thisApp>
-                <#if thisApp != "/">
-                    <#assign thisURL = thisURL + "/control/main">
-                </#if>
-                <#if appMax < appCount>
-                    <#if !moreApp>
-                    <div id="more-app">
-                        <span>
-                            <svg fill="none" stroke="currentColor" viewBox="0 
0 24 24" xmlns="http://www.w3.org/2000/svg";>
-                                <path stroke-linecap="round" 
stroke-linejoin="round" stroke-width="1" d="M5 12h.01M12 12h.01M19 12h.01M6 
12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 
0 012 0z" />
-                            </svg>                        
-                        </span>                    
-                        <ul id="more-app-list">
-                        <#assign moreApp = true>
+            <#list displaySecondaryApps as display>
+                <#assign thisApp = display.getContextRoot()>
+                <#assign permission = true>
+                <#assign selected = false>
+                <#assign permissions = display.getBasePermission()>
+                <#list permissions as perm>
+                    <#if (perm != "NONE" && 
!security.hasEntityPermission(perm, "_VIEW", session))>
+                    <#-- User must have ALL permissions in the base-permission 
list -->
+                        <#assign permission = false>
+                    </#if>
+                </#list>
+                <#if permission == true>
+                    <#if thisApp == contextPath || contextPath + "/" == 
thisApp>
+                        <#assign selected = true>
                     </#if>
-                    <li class="app-btn-sup<#if selected> selected</#if>">
-                        <a class="more-app-a" 
href="${thisURL}${StringUtil.wrapString(externalKeyParam)}"<#if 
uiLabelMap?exists> 
title="${uiLabelMap[display.description]}">${uiLabelMap[display.title]}<#else> 
title="${display.description}">${display.title}</#if></a>
-                        <#if selected>
-                            <#assign currentMoreApp = display>
+                    <#assign thisApp = StringUtil.wrapString(thisApp)>
+                    <#assign thisURL = thisApp>
+                    <#if thisApp != "/" && thisApp != "/rest">
+                        <#assign thisURL = thisURL + "/control/main">
+                    </#if>
+                    <#if thisApp == "/rest">
+                    </#if>
+
+                    <#if appMax < appCount>
+                        <#if !moreApp>
+                        <div id="more-app">
+                            <span>
+                                <svg fill="none" stroke="currentColor" 
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg";>
+                                    <path stroke-linecap="round" 
stroke-linejoin="round" stroke-width="1" d="M5 12h.01M12 12h.01M19 12h.01M6 
12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 
0 012 0z" />
+                                </svg>
+                            </span>
+                            <ul id="more-app-list">
+                            <#assign moreApp = true>
                         </#if>
-                    </li>
+                        <li class="app-btn-sup<#if selected> selected</#if>">
+                            <a class="more-app-a" 
href="${thisURL}${StringUtil.wrapString(externalKeyParam)}"<#if 
uiLabelMap?exists> 
title="${uiLabelMap[display.description]}">${uiLabelMap[display.title]}<#else> 
title="${display.description}">${display.title}</#if></a>
+                            <#if selected>
+                                <#assign currentMoreApp = display>
+                            </#if>
+                        </li>
+                    </#if>
+                    <#assign appCount = appCount + 1>
                 </#if>
-                <#assign appCount = appCount + 1>
-            </#if>
-        </#list>
+            </#list>
         </#if>
         <#if moreApp>
         </ul> <!-- more-app-list -->
@@ -239,7 +242,7 @@ under the License.
             <#assign thisApp = currentMoreApp.getContextRoot()>
             <#assign thisApp = StringUtil.wrapString(thisApp)>
             <#assign thisURL = thisApp>
-            <#if thisApp != "/">
+            <#if thisApp != "/" && thisApp != "/rest">
                 <#assign thisURL = thisURL + "/control/main">
             </#if>
             <li class="app-btn selected">
diff --git a/themes/rainbowstone/template/includes/TopAppBar.ftl 
b/themes/rainbowstone/template/includes/TopAppBar.ftl
index 14627ad2a7..83ebc4fa6e 100644
--- a/themes/rainbowstone/template/includes/TopAppBar.ftl
+++ b/themes/rainbowstone/template/includes/TopAppBar.ftl
@@ -67,7 +67,7 @@ under the License.
                         </#if>
                         <#assign thisApp = StringUtil.wrapString(thisApp)>
                         <#assign thisURL = thisApp>
-                        <#if thisApp != "/">
+                        <#if thisApp != "/" && thisApp != "/rest">
                             <#assign thisURL = thisURL + "/control/main">
                         </#if>
                         <#if layoutSettings.suppressTab?exists && display.name 
== layoutSettings.suppressTab>
@@ -111,7 +111,7 @@ under the License.
                         </#if>
                         <#assign thisApp = StringUtil.wrapString(thisApp)>
                         <#assign thisURL = thisApp>
-                        <#if thisApp != "/">
+                        <#if thisApp != "/" && thisApp != "/rest">
                             <#assign thisURL = thisURL + "/control/main">
                         </#if>
                         <#if appCount<=appMax>
@@ -157,7 +157,7 @@ under the License.
                     </#if>
                     <#assign thisApp = StringUtil.wrapString(thisApp)>
                     <#assign thisURL = thisApp>
-                    <#if thisApp != "/">
+                    <#if thisApp != "/" && thisApp != "/rest">
                         <#assign thisURL = thisURL + "/control/main">
                     </#if>
                     <#if layoutSettings.suppressTab?exists && display.name == 
layoutSettings.suppressTab>
@@ -200,7 +200,7 @@ under the License.
                     </#if>
                     <#assign thisApp = StringUtil.wrapString(thisApp)>
                     <#assign thisURL = thisApp>
-                    <#if thisApp != "/">
+                    <#if thisApp != "/" && thisApp != "/rest">
                         <#assign thisURL = thisURL + "/control/main">
                     </#if>
                     <#if appMax < appCount>
@@ -231,7 +231,7 @@ under the License.
             <#assign thisApp = currentMoreApp.getContextRoot()>
             <#assign thisApp = StringUtil.wrapString(thisApp)>
             <#assign thisURL = thisApp>
-            <#if thisApp != "/">
+            <#if thisApp != "/" && thisApp != "/rest">
                 <#assign thisURL = thisURL + "/control/main">
             </#if>
             <li class="app-btn selected">
diff --git a/themes/tomahawk/template/AppBarOpen.ftl 
b/themes/tomahawk/template/AppBarOpen.ftl
index e89250a908..b972f812fb 100644
--- a/themes/tomahawk/template/AppBarOpen.ftl
+++ b/themes/tomahawk/template/AppBarOpen.ftl
@@ -51,7 +51,7 @@ under the License.
               </#if>
               <#assign thisApp = StringUtil.wrapString(thisApp)>
               <#assign thisURL = thisApp>
-              <#if thisApp != "/">
+              <#if thisApp != "/" && thisApp != "/rest">
                 <#assign thisURL = thisURL + "/control/main">
               </#if>
               <#if layoutSettings.suppressTab?? && display.name == 
layoutSettings.suppressTab>
@@ -71,7 +71,7 @@ under the License.
               </#if>
               <#assign thisApp = StringUtil.wrapString(thisApp)>
               <#assign thisURL = thisApp>
-              <#if thisApp != "/">
+              <#if thisApp != "/" && thisApp != "/rest">
                 <#assign thisURL = thisURL + "/control/main">
               </#if>
               <#if layoutSettings.suppressTab?? && display.name == 
layoutSettings.suppressTab>

Reply via email to