svn commit: r1814063 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java themes/README.md themes/common/widget/Theme.xml

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

svn commit: r1814063 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java themes/README.md themes/common/widget/Theme.xml

jleroux@apache.org
Author: jleroux
Date: Thu Nov  2 11:18:33 2017
New Revision: 1814063

URL: http://svn.apache.org/viewvc?rev=1814063&view=rev
Log:
Fixed: The online help is broken
(OFBIZ-9837)

When you get to cmssite/cms/APACHE_OFBIZ_HTML in trunk HEAD you get this error:
ERROR in error page, (infinite loop or error page not found with name
[/error/error.jsp])

It because the related code does not use the Common Theme. And also because
the Css styles missed in themes/common/widget/Theme.xml

While fixing that I also fixed few points of the Common Theme documentation
in the main README.md file

Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
    ofbiz/ofbiz-framework/trunk/themes/README.md
    ofbiz/ofbiz-framework/trunk/themes/common/widget/Theme.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java?rev=1814063&r1=1814062&r2=1814063&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java Thu Nov  2 11:18:33 2017
@@ -681,24 +681,10 @@ public class DataResourceWorker  impleme
                 }
 
             } else if ("XSLT".equals(dataTemplateTypeId)) {
-                File sourceFileLocation = null;
                 File targetFileLocation = new File(System.getProperty("ofbiz.home")+"/runtime/tempfiles/docbook.css");
-                if (templateContext.get("visualThemeId") != null) {
-                    Map<String, Object> layoutSettings  = UtilGenerics.checkMap(templateContext.get("layoutSettings"));
-                    List<String> docbookStyleSheets = UtilGenerics.checkList(layoutSettings.get("VT_DOCBOOKSTYLESHEET"));
-                    String docbookStyleLocation = docbookStyleSheets.get(0);
-                    sourceFileLocation = new File(System.getProperty("ofbiz.home")+"/themes"+docbookStyleLocation);
-                }
-                if (sourceFileLocation != null && sourceFileLocation.exists()) {
-                    UtilMisc.copyFile(sourceFileLocation,targetFileLocation);
-                } else {
-                    String defaultVisualThemeId = EntityUtilProperties.getPropertyValue("general", "VISUAL_THEME", delegator);
-                    if (defaultVisualThemeId != null) {
-                        GenericValue themeValue = EntityQuery.use(delegator).from("VisualThemeResource").where("visualThemeId", defaultVisualThemeId, "resourceTypeEnumId", "VT_DOCBOOKSTYLESHEET", "sequenceId", "01").cache().queryOne();
-                        sourceFileLocation = new File(System.getProperty("ofbiz.home") + "/themes" + themeValue.get("resourceValue"));
-                        UtilMisc.copyFile(sourceFileLocation,targetFileLocation);
-                    }
-                }
+                String docbookStylesheet = modelTheme.getProperty("VT_DOCBOOKSTYLESHEET").toString();
+                File sourceFileLocation = new File(System.getProperty("ofbiz.home") + "/themes" + docbookStylesheet.substring(1, docbookStylesheet.length() - 1));
+                UtilMisc.copyFile(sourceFileLocation,targetFileLocation);
                 // get the template data for rendering
                 String templateLocation = DataResourceWorker.getContentFile(dataResource.getString("dataResourceTypeId"), dataResource.getString("objectInfo"), (String) templateContext.get("contextRoot")).toString();
                 // render the XSLT template and file

Modified: ofbiz/ofbiz-framework/trunk/themes/README.md
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/README.md?rev=1814063&r1=1814062&r2=1814063&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/README.md (original)
+++ ofbiz/ofbiz-framework/trunk/themes/README.md Thu Nov  2 11:18:33 2017
@@ -20,14 +20,14 @@ Apache OFBiz® Themes
 ====================
 
 # What is a theme
-A Theme is an ofbiz component that define all elements necessary to render all information generated by the screen engine through a embed technology.
+A Theme is an ofbiz component that defines all elements necessary to render all information generated by the screen engine through an embedded technology.
 Currently themes presents in Apache OFBiz use html5/jquery/css to do that.
 
 To realize this, a theme can define some properties that can be necessary, can define its own ftl macro to render the different modelScreen elements and can define its own screen decorator to prepare the final user screen structure for the technology used by the theme.
 # How to define it
 A theme is a standard component, present in the directory themes or plugins with a file definition present on widget/Theme.xml and support the [widget-theme.xsd](http://ofbiz.apache.org/dtds/widget-theme.xsd)
 
-To offer the possibility for the end users to select the theme throw the select theme screen, the theme need to load on the entity VisualTheme one or more entries related to this theme
+To offer the possibility for end users to select the theme through the "Select Theme Screen", the theme need to load the entity VisualTheme and one or more entries related to this theme.
 
 # Structure of Theme.xml
 The theme definition file help OFBiz to know what specific rendering the Theme want to use.
@@ -41,7 +41,7 @@ Defined like that
         <visual-theme id="MY_THEME"/>
     </visual-themes>
 ```
-You need to define in the database an entry on VisualTheme entity for each visual-theme id defined there.
+You need to define in the database an entry in VisualTheme Entity for each visual-theme id defined.
 ```xml
 <entity-engine-xml>
     <VisualTheme visualThemeId="MY_THEME" visualThemeSetId="BACKOFFICE" description="My theme - Example (based on flatgrey)"/>
@@ -53,9 +53,8 @@ The second important (but not mandatory)
 ```xml
    <extends location="component://common-theme/widget/Theme.xml"/>
 ```
-This element indicate that your theme copies from the extend theme all information not present in its file definition.
-If this element isn't present in your theme, you will need to define all information present in common-theme to be sure that OFBiz miss nothing for a correct run.
-Otherwise some functionnalities can be broken.
+This element indicates that your theme copies from the extend theme all information not present in its file definition.
+If this element isn't present in your theme, you will need to define all information present in common-theme to be sure that OFBiz misses nothing for a correct run. Otherwise some functionnalities can be broken...
 >_Note_: It's highly recommended to extend the common-theme to be sure that your theme works correctly and to surcharge only what you need.
 
 The four following blocks are optionnal if you define an extends theme
@@ -80,7 +79,7 @@ This block contains all properties that
 ```
 
 ## Theme's specific properties
-This block contains all properties specific to this theme. In general these are some propreties present on ftl template, that are initialized by the theme and can be surchaged by another theme through the extends elements.
+This block contains all properties specific to this theme. In general these are some properties present on ftl template, that are initialized by the theme and can be surchaged by another theme through the extends elements.
 ```xml
         <property name="jgrowlPosition" value="center" type="String"/><!--possible value: top-left, top-right, bottom-left, bottom-right, center-->
         <property name="jgrowlWidth" value="800" type="Integer"/>
@@ -100,12 +99,12 @@ This block defines for each technology i
         ...
    </templates>
 ```
->_Note_: If you want surcharge some few macros, you can just create desired macros and import the others from common-theme (at the file beginning) like that : ```<#include "component://common-theme/template/macro/HtmlFormMacroLibrary.ftl"/>```
+>_Note_: If you want surcharge some macros, you can just create the desired macros and import the others from common-theme (at the top of file) like that : ```<#include "component://common-theme/template/macro/HtmlFormMacroLibrary.ftl"/>```
 
 ## Screen library
-This block defines where OFBiz can find all official screen definition in framework/common
+This block defines where OFBiz can find all official screens definitions in framework/common
 
-Normally, you don't need to change this file except if you need to define a default screen style that doesn't exist in the OOTB. If you need to extend an existing one, you have to do it in the theme directory.
+Normally, you don't need to change this file except if you need to define a default screen style that doesn't exist  OOTB. If you need to extend an existing one, you have to do it in the theme directory.
 
 To define a new default screen style, you have to add it in this file, and point to the screen decorator in common-theme to define your default screen style as the default one.
 
@@ -124,17 +123,19 @@ To define a new default screen style, yo
         </general-screen>
     </common-screens>
 ```
-Screens are separated on three type :
-* structural-decorator : contains all decorator that organise all the screens structure
+Screens are separated in three types :
+* structural-decorator : contains all decorators that organise the screens structures
 * embed-decorator : decorator used only on sub screens
-* general-screen : list all generic inter application screens
+* general-screen : list all generic inter applications screens
 # The common-theme
 This is the root theme that contains all information to ensure a good basic theme for OFBiz.
 Currently it keeps all old themes system for backward compatibility with ftl template managed by the entity **VisualThemeResource**
+
 # Create your own theme
-As a theme is a component, you can create a new theme like a plugin. You can see more information on this subject [on the ofbiz README](https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk/README.md)
-After creating component, you can add the two minimal information :
-* Theme.xml file in **plugins/my-theme/widget/** with mininal trame :
+As a theme is a component, you can create a new theme like a plugin.
+
+After creating a component, you can add the two minimal information :
+* Theme.xml file in **plugins/my-theme/widget/** with minimal information :
 ```xml
 <theme name="my-theme"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -150,9 +151,9 @@ After creating component, you can add th
     <VisualTheme visualThemeId="MY_THEME" visualThemeSetId="BACKOFFICE"/>
 </entity-engine-xml>
 ```
-The present of VisualTheme entity help to indicate what theme is available on your instance, specially helpful for tenant installation.
+The presence of VisualTheme entity helps to indicate which theme is available in your instance, specially helpful for tenant installations.
 
-For display your theme in OFBiz theme library, you can complete information on each visual theme like
+To display your theme in OFBiz theme library, you can complete the information on each visual theme like
 ```
 <theme name="my-theme"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -185,7 +186,7 @@ To start, extends the common-theme :
     <extends location="component://common-theme/widget/Theme.xml"/>
 </theme>
 ```
-Now your theme should be operational but without particularity.
+Now your theme should be operational, but without particularity.
 
 You can surcharge a ftl macro, to do this create your own ftl macro file in **plugins/my-theme/templates/macro/HtmlFormMacroLibrary.ftl** with
 
@@ -219,19 +220,19 @@ Now indicate to your theme that you want
     </templates>
 </theme>
 ```
-and check the result when you select your theme. Ok ok the result isn't really interesting but it's to understand how it works.
+and check the result when you select your theme. The result isn't really interesting but it's to understand how it works.
 
 ## create from scratch
 TODO
 
 # Backware compatibility with OFBiz 16.11 and above
 ## How themes worked before
-Before the theme management by model definition, all configuration has been present in database through entity VisualTheme and VisualThemeRessource.
-These ressources has been load on layoutProperties variable and learn directly by decorator screen and ftl template.
+Before the theme management by model definition, all configurations have been present in the database through entity **VisualTheme** and **VisualThemeRessource**.
+These ressources were loaded in a **layoutProperties** variable and used directly by decorator screens and ftl templates.
 
 ## Now with the common-theme
-All this logical is currently present on the common-theme template to keep the backward compatibility, but the VisualThemeRessource is now useless and properties has been migrate to the Theme definition in the part **theme-properties**
-### Example with Bluelight
+All this logic is still present in the common-theme template to keep backward compatibility, but the VisualThemeRessource is now useless and properties have been migrated to the Theme definition in the part **theme-properties**
+### Example with BlueLight
 The blue light theme has been these properties in VisualThemeRessource :
 
 ```xml
@@ -297,13 +298,13 @@ And on theme definition
         <property name="VT_MSG_TMPLT_LOC" value="component://bluelight/template/Messages.ftl"/>
     </theme-properties>
 ```
-Values with **/images/...** has been move to the common-theme that bluelight extends, the theme definition keep only what the theme use more the extended theme.
+Values with **/images/...** have been moved to the common-theme that bluelight extends, the theme definition keeps only what the theme adds to the extended theme.
 
->_Note_ property name support the FlexibleMapAccessor syntax, so you can continue to populate a list (VT_STYLESHEET['add']), reset a list (VT_STYLESHEET[]) or add an element on the top list (VT_STYLESHEET[+0]) because some time the order librry load is important
+>_Note_ property name supports the FlexibleMapAccessor syntax, so you can continue to populate a list (VT_STYLESHEET['add']), reset a list (VT_STYLESHEET[]) or add an element on the top list (VT_STYLESHEET[+0]) because some time the order libraries loading is important
 
 ### Migrate you own theme
-Easily, create you Theme.xml and move your VisualThemeResource in **theme-properties** like bluelight example.
-Maybe you need to update you template because the modelTheme return ressources not always as list. So :
+Easily, create you Theme.xml and move your VisualThemeResource in **theme-properties** like in the BlueLight example above.
+Maybe you will need to update your template because the modelTheme return ressources not always as list. So :
 `<property name="VT_HDR_TMPLT_LOC" value="component://bluelight/template/Header.ftl"/>` -> return a String with `component://bluelight/template/Header.ftl`
 `<property name="VT_STYLESHEET['add'] value="..."` -> return a List<String>
 

Modified: ofbiz/ofbiz-framework/trunk/themes/common/widget/Theme.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/widget/Theme.xml?rev=1814063&r1=1814062&r2=1814063&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common/widget/Theme.xml (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common/widget/Theme.xml Thu Nov  2 11:18:33 2017
@@ -45,17 +45,18 @@ under the License.
     </widget-properties>
 
     <theme-properties> <!--specific properties dedicate to this theme -->
+        <!--jgrowl properties-->    
         <property name="jgrowlPosition" value="center" type="String"/><!--possible value: top-left, top-right, bottom-left, bottom-right, center-->
         <property name="jgrowlWidth" value="800" type="Integer"/>
         <property name="jgrowlHeight" value="" type="Integer"/>
         <property name="jgrowlSpeed" value="100" type="Integer"/>
-        <!--template location-->
+        <!--templates location-->
         <property name="VT_SHORTCUT_ICON" value="/images/ofbiz.ico"/>
         <property name="VT_HDR_TMPLT_LOC" value="component://flatgrey/template/Header.ftl"/><!--use flatgrey to wait the new design-->
         <property name="VT_FTR_TMPLT_LOC" value="component://flatgrey/template/Footer.ftl"/>
         <property name="VT_NAV_TMPLT_LOC" value="component://flatgrey/template/AppBar.ftl"/>
         <property name="VT_MSG_TMPLT_LOC" value="component://common-theme/template/includes/Messages.ftl"/>
-        <!--javascript lib-->
+        <!--javascript libs-->
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/jquery-1.11.0.min.js"/>
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/jquery-migrate-1.2.1.js"/>
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/ui/js/jquery-ui-1.10.3.min.js"/>
@@ -76,7 +77,13 @@ under the License.
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/jsTree/jquery.jstree.js"/>
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/ui/js/jquery.cookie-1.4.0.js"/>
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/plugins/date/FromThruDateCheck.js"/>
-        <!--Css style-->
+        <property name="VT_HDR_JAVASCRIPT['add']" value="/flatgrey/js/application.js"/>
+        <!--Css styles-->
+        <property name="VT_STYLESHEET['add']" value="/flatgrey/style.css"/>
+        <property name="VT_STYLESHEET['add']" value="/flatgrey/javascript.css"/>
+        <property name="VT_HELPSTYLESHEET['add']" value="/flatgrey/help.css"/>
+        <property name="VT_DOCBOOKSTYLESHEET['add']" value="/flatgrey/webapp/flatgrey/docbook.css"/>
+        <property name="VT_RTL_STYLESHEET['add']" value="/flatgrey/stylertl.css"/>
     </theme-properties>
 
     <templates><!-- Freemarker template use by this theme to render widget model-->