Author: adrianc
Date: Sat Dec  8 09:25:08 2007
New Revision: 602516

URL: http://svn.apache.org/viewvc?rev=602516&view=rev
Log:
Added new FOP templates and decorator. The new FOP decorator operates more like 
the screen GlobalDecorator. Parameters can be passed to templates via the 
layoutSettings Map, and there is an assortment of standard page size templates.

This improvement was proposed in Jira - 
https://issues.apache.org/jira/browse/OFBIZ-1410. Many thanks to Jacopo for his 
great suggestions.

Added:
    ofbiz/trunk/framework/common/webcommon/includes/fo/
    ofbiz/trunk/framework/common/webcommon/includes/fo/basic-footer.fo.ftl
    ofbiz/trunk/framework/common/webcommon/includes/fo/basic-header.fo.ftl
    ofbiz/trunk/framework/common/webcommon/includes/fo/end.fo.ftl
    ofbiz/trunk/framework/common/webcommon/includes/fo/pm-11x17.fo.ftl
    ofbiz/trunk/framework/common/webcommon/includes/fo/pm-legal.fo.ftl
    ofbiz/trunk/framework/common/webcommon/includes/fo/pm-letter.fo.ftl
    ofbiz/trunk/framework/common/webcommon/includes/fo/start.fo.ftl
Modified:
    ofbiz/trunk/framework/common/widget/CommonScreens.xml

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/basic-footer.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/basic-footer.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/basic-footer.fo.ftl 
(added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/basic-footer.fo.ftl Sat 
Dec  8 09:25:08 2007
@@ -0,0 +1,24 @@
+<#--
+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.
+-->
+<#escape x as x?xml>
+        <fo:static-content flow-name="xsl-region-after" 
font-size="${(layoutSettings.footerFontSize)?default("8pt")}">
+            <fo:block text-align="center" border-top="thin solid 
black">Copyright (c) 2001-${nowTimestamp?string("yyyy")} The Apache Software 
Foundation</fo:block>
+            <fo:block text-align="center">${uiLabelMap.CommonPage} 
<fo:page-number/></fo:block>
+        </fo:static-content>
+</#escape>

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/basic-header.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/basic-header.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/basic-header.fo.ftl 
(added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/basic-header.fo.ftl Sat 
Dec  8 09:25:08 2007
@@ -0,0 +1,25 @@
+<#--
+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.
+-->
+<#escape x as x?xml>
+        <fo:static-content flow-name="xsl-region-before">
+          <fo:block 
font-size="${(layoutSettings.headerFontSize)?default("14pt")}" 
text-align="center" margin-bottom="14pt">
+            ${(layoutSettings.documentTitle)?if_exists}
+          </fo:block>
+        </fo:static-content>
+</#escape>

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/end.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/end.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/end.fo.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/end.fo.ftl Sat Dec  8 
09:25:08 2007
@@ -0,0 +1,20 @@
+<#--
+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.
+-->
+  </fo:page-sequence>
+</fo:root>

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/pm-11x17.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/pm-11x17.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/pm-11x17.fo.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/pm-11x17.fo.ftl Sat Dec  
8 09:25:08 2007
@@ -0,0 +1,35 @@
+<#--
+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.
+-->
+    <fo:simple-page-master master-name="11x17-portrait"
+        page-width="11in" page-height="17in"
+        margin-top="0.5in" margin-bottom="0.5in"
+        margin-left="0.5in" margin-right="0.5in">
+      <fo:region-body margin-top="1in" margin-bottom="0.5in"/>
+      <fo:region-before extent="1in"/>
+      <fo:region-after extent="0.5in" />
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="11x17-landscape"
+        page-width="17in" page-height="11in"
+        margin-top="0.5in" margin-bottom="0.5in"
+        margin-left="0.5in" margin-right="0.5in">
+      <fo:region-body margin-top="1in" margin-bottom="0.5in"/>
+      <fo:region-before extent="1in"/>
+      <fo:region-after extent="0.5in" />
+    </fo:simple-page-master>

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/pm-legal.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/pm-legal.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/pm-legal.fo.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/pm-legal.fo.ftl Sat Dec  
8 09:25:08 2007
@@ -0,0 +1,35 @@
+<#--
+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.
+-->
+    <fo:simple-page-master master-name="legal-portrait"
+        page-width="8.5in" page-height="14in"
+        margin-top="0.5in" margin-bottom="0.5in"
+        margin-left="0.5in" margin-right="0.5in">
+      <fo:region-body margin-top="1in" margin-bottom="0.5in"/>
+      <fo:region-before extent="1in"/>
+      <fo:region-after extent="0.5in" />
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="legal-landscape"
+        page-width="14in" page-height="8.5in"
+        margin-top="0.5in" margin-bottom="0.5in"
+        margin-left="0.5in" margin-right="0.5in">
+      <fo:region-body margin-top="1in" margin-bottom="0.5in"/>
+      <fo:region-before extent="1in"/>
+      <fo:region-after extent="0.5in" />
+    </fo:simple-page-master>

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/pm-letter.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/pm-letter.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/pm-letter.fo.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/pm-letter.fo.ftl Sat Dec 
 8 09:25:08 2007
@@ -0,0 +1,35 @@
+<#--
+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.
+-->
+    <fo:simple-page-master master-name="letter-portrait"
+        page-width="8.5in" page-height="11in"
+        margin-top="0.5in" margin-bottom="0.5in"
+        margin-left="0.5in" margin-right="0.5in">
+      <fo:region-body margin-top="1in" margin-bottom="0.5in"/>
+      <fo:region-before extent="1in"/>
+      <fo:region-after extent="0.5in" />
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="letter-landscape"
+        page-width="11in" page-height="8.5in"
+        margin-top="0.5in" margin-bottom="0.5in"
+        margin-left="0.5in" margin-right="0.5in">
+      <fo:region-body margin-top="1in" margin-bottom="0.5in"/>
+      <fo:region-before extent="1in"/>
+      <fo:region-after extent="0.5in" />
+    </fo:simple-page-master>

Added: ofbiz/trunk/framework/common/webcommon/includes/fo/start.fo.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/fo/start.fo.ftl?rev=602516&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/fo/start.fo.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/fo/start.fo.ftl Sat Dec  8 
09:25:08 2007
@@ -0,0 +1,42 @@
+<#--
+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.
+-->
+<#escape x as x?xml>
+<?xml version="1.0" encoding="UTF-8"?>
+<#if layoutSettings.styleSheets?has_content>
+  <#--layoutSettings.styleSheets is a list of style sheets -->
+  <#list layoutSettings.styleSheets as styleSheet>
+    <?xml-stylesheet type="text/xsl" 
href="<@ofbizContentUrl>${styleSheet}</@ofbizContentUrl>"?>
+  </#list>
+</#if>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";
+    font-family="${(layoutSettings.defaultFontFamily)?default("Helvetica, 
sans-serif")}"
+    font-size="${(layoutSettings.defaultFontSize)?default("12pt")}">
+  <fo:layout-master-set>
+<#if layoutSettings.pageMasters?has_content>
+  <#--layoutSettings.pageMasters is a list of fo page master element ftl 
templates -->
+  <#list layoutSettings.pageMasters as pageMaster>
+    <#include pageMaster/>
+  </#list>
+<#else>
+  <#include "component://common/webcommon/includes/fo/pm-letter.fo.ftl"/>
+</#if>
+  </fo:layout-master-set>
+  <#assign masterReference = 
(layoutSettings.masterReference)?default("letter-portrait")/>
+  <fo:page-sequence master-reference="${masterReference}">
+</#escape>

Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=602516&r1=602515&r2=602516&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sat Dec  8 09:25:08 
2007
@@ -232,6 +232,26 @@
         </section>
     </screen>
 
+    <!-- Decorator for xsl-fo rendering -->
+    <screen name="GlobalFoDecorator">
+        <section>
+            <actions>
+                <set field="layoutSettings.commonHeaderImageUrl" 
value="/images/ofbiz_logo.jpg"/>
+            </actions>
+            <widgets>
+                <platform-specific>
+                    <html>
+                        <html-template 
location="component://common/webcommon/includes/fo/start.fo.ftl"/>
+                        <html-template 
location="component://common/webcommon/includes/fo/basic-header.fo.ftl"/>
+                        <html-template 
location="component://common/webcommon/includes/fo/basic-footer.fo.ftl"/>
+                    </html>
+                </platform-specific>
+                <decorator-section-include name="body"/>
+                <platform-specific><html><html-template 
location="component://common/webcommon/includes/fo/end.fo.ftl"/></html></platform-specific>
+            </widgets>
+        </section>
+    </screen>
+
     <!-- Default "error" page for XSL-FO based output. -->
     <screen name="FoError">
         <section>


Reply via email to