svn commit: r1806148 - in /ofbiz/ofbiz-framework/trunk: framework/common/webcommon/WEB-INF/common-controller.xml themes/common/template/includes/ListVisualThemes.ftl

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

svn commit: r1806148 - in /ofbiz/ofbiz-framework/trunk: framework/common/webcommon/WEB-INF/common-controller.xml themes/common/template/includes/ListVisualThemes.ftl

nmalin
Author: nmalin
Date: Fri Aug 25 09:53:56 2017
New Revision: 1806148

URL: http://svn.apache.org/viewvc?rev=1806148&view=rev
Log:
Implemented: Continue the common-theme upload (OFBIZ-9138 Create a common theme)
Five step these step break all the UI
#8 Migrate the ListVisualThemes screen to use theme definition instead information from the VisualTheme entity

Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/ofbiz-framework/trunk/themes/common/template/includes/ListVisualThemes.ftl

Modified: ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml?rev=1806148&r1=1806147&r2=1806148&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Fri Aug 25 09:53:56 2017
@@ -118,6 +118,20 @@ under the License.
     <!-- Common Mappings used for Set user organization -->
     <request-map uri="ListSetCompanies"><security https="true" auth="false"/><response name="success" type="view" value="ListSetCompanies" save-last-view="true"/></request-map>
 
+    <!-- Change theme-->
+    <request-map uri="selectTheme">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="setUserPreference"/>
+        <response name="success" type="request" value="setSessionTheme"/>
+        <response name="error" type="request" value="main"/>
+    </request-map>
+    <request-map uri="setSessionTheme">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.apache.ofbiz.common.CommonEvents" invoke="setSessionTheme"/>
+        <response name="success" type="view-last" value="main"/>
+        <response name="error" type="request" value="main"/>
+    </request-map>
+
     <!-- User preference mapping -->
     <request-map uri="setUserPreference">
         <security https="true" auth="true"/>

Modified: ofbiz/ofbiz-framework/trunk/themes/common/template/includes/ListVisualThemes.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/template/includes/ListVisualThemes.ftl?rev=1806148&r1=1806147&r2=1806148&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common/template/includes/ListVisualThemes.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common/template/includes/ListVisualThemes.ftl Fri Aug 25 09:53:56 2017
@@ -52,33 +52,31 @@ margin: 1em;
     <br class="clear"/>
   </div>
   <li class="h2" style="padding-top:1em">${uiLabelMap.CommonVisualThemeUsage}</li>
+  <#assign currentVisualThemeId = visualTheme.getVisualThemeId()/>
   <#if visualThemes?has_content>
-    <#assign orderByList = Static["org.apache.ofbiz.base.util.UtilMisc"].toList("visualThemeId")/>
     <table cellspacing="0" class="basic-table">
       <#list visualThemes as visualTheme>
-        <#assign screenshots = delegator.findByAnd("VisualThemeResource", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap(
-            "visualThemeId", "${visualTheme.visualThemeId}",
-            "resourceTypeEnumId", "VT_SCREENSHOT"), orderByList, false)>
-        <tr<#if visualTheme.visualThemeId == visualThemeId> class="selected"</#if>>
+        <#assign visualThemeId = visualTheme.getVisualThemeId()/>
+        <tr<#if visualThemeId == currentVisualThemeId> class="selected"</#if>>
           <td>
-            <form name="SetUserPreferences_${visualTheme.visualThemeId}" method="post"
-                action="<@ofbizUrl>setUserPreference</@ofbizUrl>">
+            <form name="SetUserPreferences_${visualThemeId}" method="post"
+                action="<@ofbizUrl>selectTheme</@ofbizUrl>">
               <input type="hidden" name="userPrefGroupTypeId" value="GLOBAL_PREFERENCES"/>
               <input type="hidden" name="userPrefTypeId" value="VISUAL_THEME"/>
-              <input type="hidden" name="userPrefValue" value="${visualTheme.visualThemeId}"/>
+              <input type="hidden" name="userPrefValue" value="${visualThemeId}"/>
             </form>
-            <a href="javascript:document.forms['SetUserPreferences_${visualTheme.visualThemeId}'].submit()">
-              ${visualTheme.get("description", locale)?default(visualTheme.visualThemeId)}
+            <a href="javascript:document.forms['SetUserPreferences_${visualThemeId}'].submit()">
+              ${visualTheme.getDisplayName(context)?default(visualThemeId)} ${visualTheme.getDescription(context)!}
             </a>
           </td>
           <td>
-            <#if visualTheme.visualThemeId == visualThemeId>${uiLabelMap.CommonVisualThemeSelected}<#else>&nbsp;</#if>
+            <#if visualThemeId == currentVisualThemeId>${uiLabelMap.CommonVisualThemeSelected}<#else>&nbsp;</#if>
           </td>
           <td>
-            <#if screenshots?has_content>
-              <#list screenshots as screenshot>
-                <a id="single_image" href="<@ofbizContentUrl>${screenshot.resourceValue}</@ofbizContentUrl>"><img
-                    src="<@ofbizContentUrl>${screenshot.resourceValue}</@ofbizContentUrl>" width="150"
+            <#if visualTheme.getScreenshots()?has_content>
+              <#list visualTheme.getScreenshots() as screenshot>
+                <a id="single_image" href="<@ofbizContentUrl>${screenshot}</@ofbizContentUrl>"><img
+                    src="<@ofbizContentUrl>${screenshot}</@ofbizContentUrl>" width="150"
                     alt=""/></a>
               </#list>
             <#else>