From 14cf3c06f064ed41b187bc5be4e2b9b93ff715e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 15 Mar 2007 18:48:14 +0000
Subject: [PATCH] Add support for landscape mode rendering. To use it, simply
 pass landscape:int=1 in the URL (can be done with an hidden integer field).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13438 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_pdf_style/report_pdf.xml             | 30 +++++++++++++++----
 .../erp5_pdf_style/report_view.xml            |  3 +-
 bt5/erp5_pdf_style/bt/revision                |  2 +-
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_pdf.xml b/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_pdf.xml
index 431b20f2e0..5fce741894 100644
--- a/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_pdf.xml
+++ b/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_pdf.xml
@@ -57,13 +57,15 @@
 <?xml version="1.0" encoding="utf-8" ?>\n
 <template filename="default.pdf"\n
           pagesize="A4"\n
-          landscape="0"\n
+          landscape="1"\n
           showboundary="1"\n
           leftmargin="1cm"\n
           rightmargin="1cm"\n
           topmargin="1cm"\n
           bottommargin="1cm"\n
-          allowsplitting="1">\n
+          allowsplitting="1"\n
+          tal:define="landscape python: int(request.get(\'landscape\', 0) or 0)"\n
+          tal:attributes="landscape landscape">\n
 \n
  <stylesheet>\n
 \n
@@ -164,14 +166,31 @@
 \n
   </stylesheet>\n
 \n
+  <pagetemplate tal:condition="landscape" id="FirstPage" nextid="FirstPage" startframe="content">\n
+    <static>\n
+      <infostring align="left" x="1cm" y= "20cm" size="8" font="Helvetica" color="(0,0,0)"\n
+                  tal:content="python: here.Localizer.erp5_ui.gettext(\'Printed by %(user)s at %(date)s\') % {\'user\':user.getUserName(), \'date\':DateTime()}" >Printed by</infostring>\n
+      <infostring align="left" x="26.5cm" y= "0.5cm" size="10" font="Helvetica" color="(0,0,0)" >Page %(page)s</infostring>\n
+    </static>\n
+    <frame id="content"\n
+           nextid="content"\n
+           x="1.8cm"\n
+           y="0.6cm"\n
+           width="26cm"\n
+           height="19.5cm"\n
+           leftpadding="0.1cm"\n
+           rightpadding="0.1cm"\n
+           toppadding="0.2cm"\n
+           bottompadding="0.5cm"\n
+           showBoundary="1"/>\n
+  </pagetemplate>\n
 \n
-  <pagetemplate id="FirstPage" nextid="FirstPage" startframe="content">\n
+  <pagetemplate tal:condition="not: landscape" id="FirstPage" nextid="FirstPage" startframe="content">\n
     <static>\n
-      <infostring align="left" x="1cm" y= "29cm" size="8" font="Helvetica" color="(0,0,0)"\n
+        <infostring align="left" x="1cm" y= "29cm" size="8" font="Helvetica" color="(0,0,0)"\n
                   tal:content="python: here.Localizer.erp5_ui.gettext(\'Printed by %(user)s at %(date)s\') % {\'user\':user.getUserName(), \'date\':DateTime()}" >Printed by</infostring>\n
       <infostring align="left" x="18cm" y= "0.5cm" size="10" font="Helvetica" color="(0,0,0)" >Page %(page)s</infostring>\n
     </static>\n
-\n
     <frame id="content"\n
            nextid="content"\n
            x="1cm"\n
@@ -183,7 +202,6 @@
            toppadding="0cm"\n
            bottompadding="0cm"\n
            showBoundary="0"/>\n
-\n
   </pagetemplate>\n
 \n
 </template>\n
diff --git a/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_view.xml b/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_view.xml
index 754a7fbd47..ed778741cc 100644
--- a/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_view.xml
+++ b/bt5/erp5_pdf_style/SkinTemplateItem/portal_skins/erp5_pdf_style/report_view.xml
@@ -58,7 +58,8 @@
 <document filename="erp5_list.pdf"\n
    xmlns:tal="http://xml.zope.org/namespaces/tal"\n
    xmlns:metal="http://xml.zope.org/namespaces/metal"\n
-   tal:define="global frame_width python:19"\n
+   tal:define="landscape python: int(request.get(\'landscape\', 0) or 0);\n
+               global frame_width python:landscape and 25.8 or 19"\n
    metal:define-macro="master">\n
   <title>List Print</title>\n
   <author>ERP5</author>\n
diff --git a/bt5/erp5_pdf_style/bt/revision b/bt5/erp5_pdf_style/bt/revision
index b393560759..410b14d2ce 100644
--- a/bt5/erp5_pdf_style/bt/revision
+++ b/bt5/erp5_pdf_style/bt/revision
@@ -1 +1 @@
-23
\ No newline at end of file
+25
\ No newline at end of file
-- 
2.30.9