You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2008/09/23 22:58:24 UTC

svn commit: r698346 - in /ofbiz/trunk/framework: common/config/ common/data/ common/entitydef/ common/script/org/ofbiz/common/ common/script/org/ofbiz/common/permission/ common/servicedef/ common/webcommon/WEB-INF/ common/webcommon/includes/ common/wid...

Author: adrianc
Date: Tue Sep 23 13:58:23 2008
New Revision: 698346

URL: http://svn.apache.org/viewvc?rev=698346&view=rev
Log:
Visual Themes framework - for more information see https://issues.apache.org/jira/browse/OFBIZ-1885.

This commit provides a means to swap out the current UI theme for another one. Alternate style sheets, templates, JavScript files, etc can be used to give OFBiz a completely different look.

Right now the plan is to have "theme libraries" that can be dropped in the hot-deploy folder. Work still needs to be done to connect web stores and product catalogs to the visual theme framework.

Users can select their preferred theme in the back-office applications.

Added:
    ofbiz/trunk/framework/common/webcommon/includes/listVisualThemes.ftl   (with props)
Modified:
    ofbiz/trunk/framework/common/config/CommonUiLabels.xml
    ofbiz/trunk/framework/common/data/CommonSecurityData.xml
    ofbiz/trunk/framework/common/data/CommonTypeData.xml
    ofbiz/trunk/framework/common/entitydef/entitymodel.xml
    ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
    ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml
    ofbiz/trunk/framework/common/servicedef/services.xml
    ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/trunk/framework/common/webcommon/includes/footer.ftl
    ofbiz/trunk/framework/common/webcommon/includes/header.ftl
    ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl
    ofbiz/trunk/framework/common/widget/CommonScreens.xml
    ofbiz/trunk/framework/common/widget/LookupScreens.xml
    ofbiz/trunk/framework/images/webapp/images/maincss.css

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Tue Sep 23 13:58:23 2008
@@ -7522,6 +7522,27 @@
         <value xml:lang="th">ไม่มีการตั้งค่ากลุ่มภาษี</value>
         <value xml:lang="zh">没有设置营业税税务机关会员。</value>
     </property>
+    <property key="VisualThemeIdNotFound">
+        <value xml:lang="en">Visual Theme ID not found.</value>
+    </property>
+    <property key="VisualThemeInvalidRecord">
+        <value xml:lang="en">Invalid Visual Theme resource record found: visualThemeId = ${visualThemeId}, resourceTypeEnumId = ${resourceTypeEnumId}.</value>
+    </property>
+    <property key="VisualThemes">
+        <value xml:lang="en">Visual Themes</value>
+        <value xml:lang="it">Tema grafico</value>
+    </property>
+    <property key="VisualThemeNoScreenshots">
+        <value xml:lang="en">No Screenshots</value>
+        <value xml:lang="it">Anteprima non disponibile</value>
+    </property>
+    <property key="VisualThemeResourcesNotFound">
+        <value xml:lang="en">Visual Theme resources not found.</value>
+    </property>
+    <property key="VisualThemeSelected">
+        <value xml:lang="en">Selected Visual Theme</value>
+        <value xml:lang="it">Tema grafico selezionato</value>
+    </property>
     <property key="WebTools">
         <value xml:lang="ar">أدوات</value>
         <value xml:lang="de">Web-Werkzeuge</value>

Modified: ofbiz/trunk/framework/common/data/CommonSecurityData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/CommonSecurityData.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/data/CommonSecurityData.xml (original)
+++ ofbiz/trunk/framework/common/data/CommonSecurityData.xml Tue Sep 23 13:58:23 2008
@@ -24,11 +24,20 @@
     <SecurityPermission description="Create operations in the Common Component." permissionId="COMMON_CREATE"/>
     <SecurityPermission description="Update operations in the Common Component." permissionId="COMMON_UPDATE"/>
     <SecurityPermission description="Delete operations in the Common Component." permissionId="COMMON_DELETE"/>
+    <SecurityPermission description="Create Visual Themes and Visual Theme Resources." permissionId="VISUALTHEME_CREATE"/>
+    <SecurityPermission description="Update Visual Themes and Visual Theme Resources." permissionId="VISUALTHEME_UPDATE"/>
+    <SecurityPermission description="Delete Visual Themes and Visual Theme Resources." permissionId="VISUALTHEME_DELETE"/>
+    <SecurityPermission description="ALL operations on Visual Themes and Visual Theme Resources." permissionId="VISUALTHEME_ADMIN"/>
 
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="COMMON_CREATE"/>
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="COMMON_DELETE"/>
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="COMMON_UPDATE"/>
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="COMMON_VIEW"/>
+    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="VISUALTHEME_CREATE"/>
+    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="VISUALTHEME_UPDATE"/>
+    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="VISUALTHEME_DELETE"/>
+
+    <SecurityGroupPermission groupId="FULLADMIN" permissionId="VISUALTHEME_ADMIN"/>
 
     <SecurityGroupPermission groupId="VIEWADMIN" permissionId="COMMON_VIEW"/>
 

Modified: ofbiz/trunk/framework/common/data/CommonTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/CommonTypeData.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/data/CommonTypeData.xml (original)
+++ ofbiz/trunk/framework/common/data/CommonTypeData.xml Tue Sep 23 13:58:23 2008
@@ -93,4 +93,26 @@
 
     <!-- User preferences seed data -->
     <UserPrefGroupType userPrefGroupId="GLOBAL_PREFERENCES" description="Global preferences"/>
+    <UserPreference userLoginId="_NA_" userPrefTypeId="VISUAL_THEME" userPrefGroupId="GLOBAL_PREFERENCES" userPrefValue="DEFAULT"/>
+
+    <!-- Visual Themes seed data -->
+    <EnumerationType description="Visual Theme Resource Type (stylesheet, javascript file, etc)" enumTypeId="VT_RES_TYPE" hasTable="N"/>
+    <Enumeration enumId="VT_STYLESHEET" description="Style Sheet URL" enumTypeId="VT_RES_TYPE" sequenceId="01"/>
+    <Enumeration enumId="VT_RTL_STYLESHEET" description="Right-to-Left (RTL) Style Sheet URL" enumTypeId="VT_RES_TYPE" sequenceId="02"/>
+    <Enumeration enumId="VT_SHORTCUT_ICON" description="Shortcut Icon URL" enumTypeId="VT_RES_TYPE" sequenceId="03"/>
+    <Enumeration enumId="VT_EXTRA_HEAD" description="Additional &lt;tt&gt;&lt;head&gt;&lt;/tt&gt; Element Markup" enumTypeId="VT_RES_TYPE" sequenceId="04"/>
+    <Enumeration enumId="VT_HDR_IMAGE_URL" description="Masthead/Branding Logo Image URL" enumTypeId="VT_RES_TYPE" sequenceId="05"/>
+    <Enumeration enumId="VT_HDR_TMPLT_LOC" description="Header Template Location" enumTypeId="VT_RES_TYPE" sequenceId="06"/>
+    <Enumeration enumId="VT_HDR_JAVASCRIPT" description="Header JavaScript File URL" enumTypeId="VT_RES_TYPE" sequenceId="07"/>
+    <Enumeration enumId="VT_FTR_TMPLT_LOC" description="Footer Template Location" enumTypeId="VT_RES_TYPE" sequenceId="08"/>
+    <Enumeration enumId="VT_FTR_JAVASCRIPT" description="Footer JavaScript File URL" enumTypeId="VT_RES_TYPE" sequenceId="09"/>
+    <Enumeration enumId="VT_SCREENSHOT" description="Theme Preview Screenshot" enumTypeId="VT_RES_TYPE" sequenceId="10"/>
+    <VisualTheme visualThemeId="DEFAULT" description="OFBiz Standard Floating Layout"/>
+    <VisualThemeResource visualThemeId="DEFAULT" resourceTypeEnumId="VT_STYLESHEET" resourceValue="/images/maincss.css" sequenceId="01"/>
+    <VisualThemeResource visualThemeId="DEFAULT" resourceTypeEnumId="VT_RTL_STYLESHEET" resourceValue="/images/mainrtl.css" sequenceId="01"/>
+    <VisualThemeResource visualThemeId="DEFAULT" resourceTypeEnumId="VT_SHORTCUT_ICON" resourceValue="/images/ofbiz.ico" sequenceId="01"/>
+    <VisualThemeResource visualThemeId="DEFAULT" resourceTypeEnumId="VT_HDR_IMAGE_URL" resourceValue="/images/ofbiz_logo.jpg" sequenceId="01"/>
+    <VisualThemeResource visualThemeId="DEFAULT" resourceTypeEnumId="VT_HDR_TMPLT_LOC" resourceValue="component://common/webcommon/includes/header.ftl" sequenceId="01"/>
+    <VisualThemeResource visualThemeId="DEFAULT" resourceTypeEnumId="VT_FTR_TMPLT_LOC" resourceValue="component://common/webcommon/includes/footer.ftl" sequenceId="01"/>
+
 </entity-engine-xml>

Modified: ofbiz/trunk/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitymodel.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/common/entitydef/entitymodel.xml Tue Sep 23 13:58:23 2008
@@ -42,6 +42,7 @@
   <!--  - org.ofbiz.common.period -->
   <!--  - org.ofbiz.common.status -->
   <!--  - org.ofbiz.common.uom -->
+  <!--  - org.ofbiz.common.theme -->
   <!-- ========================================================= -->
 
 
@@ -516,4 +517,37 @@
       <prim-key field="userPrefGroupId"/>
     </entity>
 
+    <!-- ============================ -->
+    <!-- org.ofbiz.common.theme -->
+    <!-- ============================ -->
+
+    <entity entity-name="VisualTheme"
+            package-name="org.ofbiz.common.theme"
+            title="Defines a Visual Theme">
+      <description>The VisualTheme entity contains one entry per visual theme.</description>
+      <field name="visualThemeId" type="id-ne"></field>
+      <field name="description" type="description"></field>
+      <prim-key field="visualThemeId"/>
+    </entity>
+
+    <entity entity-name="VisualThemeResource"
+            package-name="org.ofbiz.common.theme"
+            title="Contains All Visual Theme Resources">
+      <description>The VisualThemeResource entity contains visual theme
+          resources. Each visual theme can have any number of resources.</description>
+      <field name="visualThemeId" type="id-ne"></field>
+      <field name="resourceTypeEnumId" type="id-ne"></field>
+      <field name="sequenceId" type="id-ne"><description>Controls the loading order of duplicate resource types</description></field>
+      <field name="resourceValue" type="value"><description>Contains the resource value</description></field>
+      <prim-key field="visualThemeId"/>
+      <prim-key field="resourceTypeEnumId"/>
+      <prim-key field="sequenceId"/>
+      <relation type="one" fk-name="VT_RES_THEME" rel-entity-name="VisualTheme">
+          <key-map field-name="visualThemeId"/>
+      </relation>
+      <relation type="one" fk-name="VT_RES_TYPE_ENUM" rel-entity-name="Enumeration">
+          <key-map field-name="resourceTypeEnumId" rel-field-name="enumId"/>
+      </relation>
+    </entity>
+
 </entitymodel>

Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Tue Sep 23 13:58:23 2008
@@ -174,4 +174,34 @@
             <field-to-result field-name="parameters.hasStarted" result-name="hasStarted"/>
         </if-not-empty>
     </simple-method>
+
+    <simple-method method-name="getVisualThemeResources" short-description="Get visual theme resources" login-required="false">
+        <set field="visualThemeId" from-field="parameters.visualThemeId"/>
+        <if-empty field="visualThemeId">
+            <add-error><fail-property property="VisualThemeIdNotFound" resource="CommonUiLabels"/></add-error>
+            <check-errors/>
+        </if-empty>
+        <set field="themeResources" from-field="parameters.themeResources"/>
+        <entity-condition list-name="resourceList" entity-name="VisualThemeResource" use-cache="true">
+            <condition-expr field-name="visualThemeId" env-name="visualThemeId"/>
+            <order-by field-name="resourceTypeEnumId"/>
+            <order-by field-name="sequenceId"/>
+        </entity-condition>
+        <if-empty field="resourceList">
+            <add-error><fail-property property="VisualThemeResourcesNotFound" resource="CommonUiLabels"/></add-error>
+            <check-errors/>
+        </if-empty>
+        <iterate list-name="resourceList" entry-name="resourceRecord">
+            <set field="resourceTypeEnumId" from-field="resourceRecord.resourceTypeEnumId"/>
+            <set field="resourceValue" from-field="resourceRecord.resourceValue"/>
+            <if-empty field="resourceValue">
+                <property-to-field field-name="warningMsg" property="VisualThemeInvalidRecord" resource="CommonUiLabels"/>
+                <log level="warning" message="${warningMsg}"/>
+                <else>
+                    <set field="themeResources.${resourceTypeEnumId}[]" from-field="resourceValue"/>
+                </else>
+            </if-empty>
+        </iterate>
+        <field-to-result field-name="themeResources"/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml Tue Sep 23 13:58:23 2008
@@ -77,4 +77,10 @@
             </else>
         </if>
     </simple-method>
+
+    <simple-method method-name="visualThemePermissionCheck" short-description="Visual Theme permission logic">
+        <set field="primaryPermission" value="VISUALTHEME"/>
+        <call-simple-method method-name="genericBasePermissionCheck"/>
+    </simple-method>
+    
 </simple-methods>

Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Tue Sep 23 13:58:23 2008
@@ -478,4 +478,68 @@
         <description>User preference copy permission checking.</description>
         <implements service="permissionInterface"/>
     </service>
+
+    <!-- Visual theme services -->    
+    <service name="getVisualThemeResources" engine="simple"
+            location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getVisualThemeResources">
+        <description>Get a visual theme resources Map. Call with visualThemeId String, 
+            and optional themeResources Map. Returns themeResources Map - a
+            Map of Lists, where the resourceTypeEnumId is the key and the value
+            is a List of resourceValue Strings for that resourceTypeEnumId.
+        </description>
+        <attribute name="visualThemeId" type="String" mode="IN" optional="false"/>
+        <attribute name="themeResources" type="Map" mode="IN" optional="true"/>
+        <attribute name="themeResources" type="Map" mode="OUT" optional="false"/>
+    </service>
+    
+    <service name="createVisualTheme" default-entity-name="VisualTheme" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a Visual Theme</description>
+        <permission-service service-name="visualThemePermissionCheck" main-action="CREATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+    </service>
+
+    <service name="updateVisualTheme" default-entity-name="VisualTheme" engine="entity-auto" invoke="update" auth="true">
+        <description>Update a Visual Theme</description>
+        <permission-service service-name="visualThemePermissionCheck" main-action="UPDATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+
+    <service name="deleteVisualTheme" default-entity-name="VisualTheme" engine="entity-auto" invoke="delete" auth="true">
+        <description>Delete a Visual Theme</description>
+        <permission-service service-name="visualThemePermissionCheck" main-action="DELETE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+
+    <service name="createVisualThemeResource" default-entity-name="VisualThemeResource" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a Visual Theme Resource</description>
+        <permission-service service-name="visualThemePermissionCheck" main-action="CREATE"/>
+        <attribute name="visualThemeId" type="String" mode="IN" optional="false"/>
+        <attribute name="resourceTypeEnumId" type="String" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+    </service>
+
+    <service name="updateVisualThemeResource" default-entity-name="VisualThemeResource" engine="entity-auto" invoke="update" auth="true">
+        <description>Update a Visual Theme Resource</description>
+        <permission-service service-name="visualThemePermissionCheck" main-action="UPDATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+
+    <service name="deleteVisualThemeResource" default-entity-name="VisualThemeResource" engine="entity-auto" invoke="delete" auth="true">
+        <description>Delete a Visual Theme Resource</description>
+        <permission-service service-name="visualThemePermissionCheck" main-action="DELETE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+
+    <!-- ==============Permission Checking Service============= -->
+    <service name="visualThemePermissionCheck" engine="simple"
+        location="org/ofbiz/common/permission/CommonPermissionServices.xml" invoke="visualThemePermissionCheck">
+        <description>Visual Theme Permission Checking Logic</description>
+        <implements service="permissionInterface"/>
+    </service>
+
 </services>

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Tue Sep 23 13:58:23 2008
@@ -120,6 +120,12 @@
         <response name="success" type="view" value="help" />
     </request-map>
 
+    <!-- Visual theme mapping -->
+    <request-map uri="LookupVisualThemes">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="LookupVisualThemes" />
+    </request-map>
+
     <!-- View Mappings -->
     <view-map name="error" page="/error/error.jsp"/>
     <view-map name="login" type="screen" page="component://common/widget/CommonScreens.xml#login"/>
@@ -128,6 +134,7 @@
 
     <view-map name="LookupLocales" type="screen" page="component://common/widget/LookupScreens.xml#LookupLocales"/>
     <view-map name="LookupTimezones" type="screen" page="component://common/widget/LookupScreens.xml#LookupTimezones"/>
+    <view-map name="LookupVisualThemes" type="screen" page="component://common/widget/LookupScreens.xml#LookupVisualThemes"/>
 
     <view-map name="ajaxAutocompleteOptions" type="screen" page="component://common/widget/CommonScreens.xml#ajaxAutocompleteOptions"/>
     <view-map name="help" type="screen" page="component://common/widget/CommonScreens.xml#help"/>

Modified: ofbiz/trunk/framework/common/webcommon/includes/footer.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/footer.ftl?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/footer.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/footer.ftl Tue Sep 23 13:58:23 2008
@@ -60,5 +60,10 @@
     <p>Copyright (c) 2001-${nowTimestamp?string("yyyy")} The Apache Software Foundation - <a href="http://www.apache.org" target="_blank">www.apache.org</a><br />
     Powered by <a href="http://ofbiz.apache.org" target="_blank">Apache OFBiz</a></p>
 </div>
+<#if layoutSettings.VT_FTR_JAVASCRIPT?has_content>
+    <#list layoutSettings.VT_FTR_JAVASCRIPT as javaScript>
+        <script type="text/javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
+    </#list>
+</#if>
 </body>
 </html>

Modified: ofbiz/trunk/framework/common/webcommon/includes/header.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/header.ftl?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/header.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/header.ftl Tue Sep 23 13:58:23 2008
@@ -31,7 +31,12 @@
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <title>${layoutSettings.companyName}: <#if (page.titleProperty)?has_content>${uiLabelMap[page.titleProperty]}<#else>${(page.title)?if_exists}</#if></title>
     <#if layoutSettings.shortcutIcon?has_content>
-      <link rel="shortcut icon" href="<@o...@ofbizContentUrl>" />    
+      <#assign shortcutIcon = layoutSettings.shortcutIcon/>
+    <#elseif layoutSettings.VT_SHORTCUT_ICON?has_content>    
+      <#assign shortcutIcon = layoutSettings.VT_SHORTCUT_ICON.get(0)/>
+    </#if>
+    <#if shortcutIcon?has_content>
+      <link rel="shortcut icon" href="<@o...@ofbizContentUrl>" />
     </#if>
     <#if layoutSettings.javaScripts?has_content>
         <#--layoutSettings.javaScripts is a list of java scripts. -->
@@ -40,17 +45,25 @@
         <#list layoutSettings.javaScripts as javaScript>
             <#if javaScriptsSet.contains(javaScript)>
                 <#assign nothing = javaScriptsSet.remove(javaScript)/>
-                <script language="javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
+                <script type="text/javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
             </#if>
         </#list>
     </#if>
+    <#if layoutSettings.VT_HDR_JAVASCRIPT?has_content>
+        <#list layoutSettings.VT_HDR_JAVASCRIPT as javaScript>
+            <script type="text/javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
+        </#list>
+    </#if>
     <#if layoutSettings.styleSheets?has_content>
         <#--layoutSettings.styleSheets is a list of style sheets. So, you can have a user-specified "main" style sheet, AND a component style sheet.-->
         <#list layoutSettings.styleSheets as styleSheet>
             <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
         </#list>
-    <#else>
-        <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+    </#if>
+    <#if layoutSettings.VT_STYLESHEET?has_content>
+        <#list layoutSettings.VT_STYLESHEET as styleSheet>
+            <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+        </#list>
     </#if>
     <#if layoutSettings.rtlStyleSheets?has_content && langDir == "rtl">
         <#--layoutSettings.rtlStyleSheets is a list of rtl style sheets.-->
@@ -58,7 +71,17 @@
             <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
         </#list>
     </#if>
+    <#if layoutSettings.VT_RTL_STYLESHEET?has_content && langDir == "rtl">
+        <#list layoutSettings.VT_RTL_STYLESHEET as styleSheet>
+            <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+        </#list>
+    </#if>
     ${layoutSettings.extraHead?if_exists}
+    <#if layoutSettings.VT_EXTRA_HEAD?has_content>
+        <#list layoutSettings.VT_EXTRA_HEAD as extraHead>
+            ${extraHead}
+        </#list>
+    </#if>
 </head>
 <#if layoutSettings.headerImageLinkUrl?exists>
   <#assign logoLinkURL = "${layoutSettings.headerImageLinkUrl}">
@@ -75,8 +98,8 @@
     <ul>
       <#if (userPreferences.COMPACT_HEADER)?default("N") == "Y">
         <li class="logo-area">
-          <#if layoutSettings.shortcutIcon?has_content>
-            <a href="<@o...@ofbizUrl>"><img src="<@o...@ofbizContentUrl>"/></a>
+          <#if shortcutIcon?has_content>
+            <a href="<@o...@ofbizUrl>"><img src="<@o...@ofbizContentUrl>"/></a>
           </#if>
         </li>
         <li>
@@ -94,13 +117,21 @@
         </li>
       <#else>
         <#if layoutSettings.headerImageUrl?exists>
-          <li class="logo-area"><a href="<@o...@ofbizUrl>"><img alt="${layoutSettings.companyName}" src="<@o...@ofbizContentUrl>"/></a></li>
-        <#else>
-          <li class="logo-area"><a href="<@o...@ofbizUrl>"><img alt="${layoutSettings.companyName}" src="<@o...@ofbizContentUrl>"/></a></li>
+          <#assign headerImageUrl = layoutSettings.headerImageUrl>
+        <#elseif layoutSettings.commonHeaderImageUrl?exists>
+          <#assign headerImageUrl = layoutSettings.commonHeaderImageUrl>
+        <#elseif layoutSettings.VT_HDR_IMAGE_URL?exists>
+          <#assign headerImageUrl = layoutSettings.VT_HDR_IMAGE_URL.get(0)>
+        </#if>
+        <#if headerImageUrl?exists>
+          <li class="logo-area"><a href="<@o...@ofbizUrl>"><img alt="${layoutSettings.companyName}" src="<@o...@ofbizContentUrl>"/></a></li>
         </#if>
         <li class="control-area"<#if layoutSettings.headerRightBackgroundUrl?has_content> background="${layoutSettings.headerRightBackgroundUrl}"</#if>>
           <#if userLogin?exists>
-            <p class="expanded"><a href="setUserPreference?userPrefGroupId=GLOBAL_PREFERENCES&amp;userPrefTypeId=COMPACT_HEADER&amp;userPrefValue=Y">&nbsp;&nbsp;</a></p>
+            <p class="expanded">
+              <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.VisualThemes}</a>
+              <a href="setUserPreference?userPrefGroupId=GLOBAL_PREFERENCES&amp;userPrefTypeId=COMPACT_HEADER&amp;userPrefValue=Y">&nbsp;&nbsp;</a>
+            </p>
           </#if>
           <p>
           <#if person?has_content>

Added: ofbiz/trunk/framework/common/webcommon/includes/listVisualThemes.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/listVisualThemes.ftl?rev=698346&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/listVisualThemes.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/listVisualThemes.ftl Tue Sep 23 13:58:23 2008
@@ -0,0 +1,64 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<style type="text/css">
+.screenlet {
+margin: 1em;
+}
+</style>
+
+<div class="screenlet">
+  <div class="screenlet-title-bar">
+    <ul>
+      <li class="h3">${uiLabelMap.VisualThemes}</li>
+      <li><a href="<@o...@ofbizUrl>">${uiLabelMap.CommonCancel}</a></li>
+    </ul>
+    <br class="clear"/>
+  </div>
+  <#if visualThemes?has_content>
+    <#assign orderByList = Static["org.ofbiz.base.util.UtilMisc"].toList("visualThemeId")/> 
+    <table cellspacing="0" class="basic-table">
+      <#list visualThemes as visualTheme>
+        <#assign screenshots = delegator.findByAnd("VisualThemeResource", Static["org.ofbiz.base.util.UtilMisc"].toMap(
+                                        "visualThemeId", "${visualTheme.visualThemeId}",
+                                        "resourceTypeEnumId", "VT_SCREENSHOT"), orderByList)>
+        <tr<#if visualTheme.visualThemeId == visualThemeId> class="selected"</#if>>
+          <td>
+            <#-- Not too sure about displaying the theme ID - it might confuse the users -->
+            <#-- <a href="<@o...@ofbizUrl>">${visualTheme.description} [${visualTheme.visualThemeId}]</a> -->
+            <a href="<@o...@ofbizUrl>">${visualTheme.description}</a>
+          </td>
+          <td>
+            <#if visualTheme.visualThemeId == visualThemeId>${uiLabelMap.VisualThemeSelected}<#else>&nbsp;</#if>
+          </td>
+          <td>
+            <#if screenshots?has_content>
+              <#list screenshots as screenshot>
+                <#-- We will want to specify length and width attributes for the img element - so they appear as thumbnails. Not sure what size yet. -->
+                <a href="<@o...@ofbizContentUrl>"><img src="<@o...@ofbizContentUrl>"/></a>
+              </#list>
+           <#else>
+              ${uiLabelMap.VisualThemeNoScreenshots}
+            </#if>
+          </td>
+        </tr>
+      </#list>
+    </table>
+  </#if>
+</div>

Propchange: ofbiz/trunk/framework/common/webcommon/includes/listVisualThemes.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl Tue Sep 23 13:58:23 2008
@@ -18,7 +18,12 @@
 under the License.
 -->
 
-<html xmlns="http://www.w3.org/1999/xhtml">
+<#assign docLangAttr = locale.toString()?replace("_", "-")>
+<#assign langDir = "ltr">
+<#if "ar.iw"?contains(docLangAttr?substring(0, 2))>
+    <#assign langDir = "rtl">
+</#if>
+<html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <title>${title}</title>
@@ -27,7 +32,26 @@
     <script language="javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
     <script language="javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
     <script language="javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script>
-    <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+    <#if layoutSettings.styleSheets?has_content>
+        <#list layoutSettings.styleSheets as styleSheet>
+            <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+        </#list>
+    </#if>
+    <#if layoutSettings.VT_STYLESHEET?has_content>
+        <#list layoutSettings.VT_STYLESHEET as styleSheet>
+            <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+        </#list>
+    </#if>
+    <#if layoutSettings.rtlStyleSheets?has_content && langDir == "rtl">
+        <#list layoutSettings.rtlStyleSheets as styleSheet>
+            <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+        </#list>
+    </#if>
+    <#if layoutSettings.VT_RTL_STYLESHEET?has_content && langDir == "rtl">
+        <#list layoutSettings.VT_RTL_STYLESHEET as styleSheet>
+            <link rel="stylesheet" href="<@o...@ofbizContentUrl>" type="text/css"/>
+        </#list>
+    </#if>
 
     <script language="JavaScript" type="text/javascript">
         // This code inserts the value lookedup by a popup window back into the associated form element

Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Tue Sep 23 13:58:23 2008
@@ -113,29 +113,29 @@
     <screen name="GlobalDecorator">
         <section>
             <actions>
-                <!-- The default (global) stylesheet is added to the list of stylesheets to the first position -->
-                <set field="layoutSettings.styleSheets[+0]" value="/images/maincss.css" global="true"/>
-                <set field="layoutSettings.rtlStyleSheets[+0]" value="/images/mainrtl.css" global="true"/>
                 <!-- The default (global) java scripts -->
-                <!-- NOTE: this should be included on each screen that uses it to avoid including it in all screens: <set field="layoutSettings.javaScripts[]" value="/images/dojo/dojo.js" global="true"/> -->
                 <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/scriptaculous.js" global="true"/>                
                 <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/prototype.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/calendar_date_select.js" global="true"/>
-                <!-- The default (global) shortcut icon -->
-                <set field="layoutSettings.shortcutIcon" value="/images/ofbiz.ico" global="true"/>
-                <!-- The default (global) logo -->
-                <set field="layoutSettings.commonHeaderImageUrl" value="/images/ofbiz_logo.jpg" global="true"/>
                 <set field="layoutSettings.commonHeaderImageLinkUrl" from-field="layoutSettings.commonHeaderImageLinkUrl" default-value="main" global="true"/>
                 <service service-name="getUserPreferenceGroup">
                     <field-map field-name="userPrefGroupId" value="GLOBAL_PREFERENCES"/>
                 </service>
                 <set field="userPreferences" from-field="userPrefMap" global="true"/>
+                <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" default-value="DEFAULT" global="true"/>
+                <service service-name="getVisualThemeResources">
+                    <field-map field-name="visualThemeId"/>
+                    <field-map field-name="themeResources" env-name="layoutSettings"/>
+                </service>
+                <set field="layoutSettings" from-field="themeResources" default-value="${layoutSettings}" global="true"/>
+                <set field="headerTemplateLocation" from-field="layoutSettings.VT_HDR_TMPLT_LOC[0]" default-value="component://common/webcommon/includes/header.ftl"/>
+                <set field="footerTemplateLocation" from-field="layoutSettings.VT_FTR_TMPLT_LOC[0]" default-value="component://common/webcommon/includes/footer.ftl"/>
             </actions>
             <widgets>
                 <!-- render header -->
-                <platform-specific><html><html-template location="component://common/webcommon/includes/header.ftl"/></html></platform-specific>
+                <platform-specific><html><html-template location="${headerTemplateLocation}"/></html></platform-specific>
                 <!-- render appbar -->
                 <platform-specific><html><html-template location="component://common/webcommon/includes/appbar.ftl"/></html></platform-specific>
                 
@@ -175,7 +175,7 @@
                         <if-empty field-name="applicationFooterTemplate"/>
                     </condition>
                     <widgets>
-                        <platform-specific><html><html-template location="component://common/webcommon/includes/footer.ftl"/></html></platform-specific>
+                        <platform-specific><html><html-template location="${footerTemplateLocation}"/></html></platform-specific>
                     </widgets>
                     <fail-widgets>
                          <platform-specific><html><html-template location="${applicationFooterTemplate}"/></html></platform-specific>
@@ -190,6 +190,13 @@
         <section>
             <actions>
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="userPreferences" from-field="userPrefMap" global="true"/>
+                <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" default-value="DEFAULT" global="true"/>
+                <service service-name="getVisualThemeResources">
+                    <field-map field-name="visualThemeId"/>
+                    <field-map field-name="themeResources" env-name="layoutSettings"/>
+                </service>
+                <set field="layoutSettings" from-field="themeResources" default-value="${layoutSettings}" global="true"/>
             </actions>
             <widgets>
                 <platform-specific><html><html-template location="component://common/webcommon/includes/lookup.ftl"/></html></platform-specific>

Modified: ofbiz/trunk/framework/common/widget/LookupScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/LookupScreens.xml?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/LookupScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/LookupScreens.xml Tue Sep 23 13:58:23 2008
@@ -84,4 +84,26 @@
             </widgets>
         </section>
     </screen>
+
+    <!-- Visual Themes Lookup Screen -->
+    <screen name="LookupVisualThemes">
+        <section>
+            <actions>
+                <set field="title" value="${uiLabelMap.VisualThemes}"/>
+                <entity-condition entity-name="VisualTheme" list-name="visualThemes"/>
+            </actions>
+            <widgets>
+               <decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml">
+                <decorator-section name="body">
+                    <platform-specific>
+                        <html>
+                            <html-template location="component://common/webcommon/includes/listVisualThemes.ftl"/>
+                        </html>
+                    </platform-specific>
+                </decorator-section>
+              </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
 </screens>

Modified: ofbiz/trunk/framework/images/webapp/images/maincss.css
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/maincss.css?rev=698346&r1=698345&r2=698346&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/maincss.css (original)
+++ ofbiz/trunk/framework/images/webapp/images/maincss.css Tue Sep 23 13:58:23 2008
@@ -897,6 +897,7 @@
 background: url(/images/collapse.gif) no-repeat right;
 min-height: 10px;
 min-width: 10px;
+padding: 0 0.4em 0 0.4em;
 }
 
 #masthead ul .control-area .collapsed {