Commit 7e52d4c1 authored by Sven Franck's avatar Sven Franck

erp5_corporate_identity: switch to relative urls, fix logo display and bundle methods

parent 18e2fb17
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722505.7</string> </value>
<value> <string>ts13789790.07</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>b082265511e27ef7507e800e698e56bf</string> </value>
<value> <string>c073e61e928439f3ff1e588ef65b18f8</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722533.35</string> </value>
<value> <string>ts13789820.77</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>1c3a728cd854ed13659d8e79b85f3d7e</string> </value>
<value> <string>e5077cffb8d1bbcbbba470bfda754149</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>161657</int> </value>
<value> <int>225303</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722559.78</string> </value>
<value> <string>ts13789839.14</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>d6478bedc23c668b1996b6523c02318f</string> </value>
<value> <string>e209139b2ba4bc2e9c8b715100ea4779</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722370.96</string> </value>
<value> <string>ts13789657.68</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>37664a694b348e215bb96710822232b6</string> </value>
<value> <string>cdad30ea3226ede907ec14c4d87fb409</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>115075</int> </value>
<value> <int>115072</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722391.78</string> </value>
<value> <string>ts13789676.29</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>7691e9098983a1309a0a2ad1d0f4dec8</string> </value>
<value> <string>ca506b20725f3e67de4a51c5fc2f07fe</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722410.76</string> </value>
<value> <string>ts13789699.52</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>107e356232e572912cae0196acfc4716</string> </value>
<value> <string>b81020cb00dc1b24737541077ca181d8</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>114763</int> </value>
<value> <int>114758</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722205.21</string> </value>
<value> <string>ts13788680.84</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>8f5f7281daac07858170b95aa47bdd86</string> </value>
<value> <string>35ad54fb748f2aef2c22a727a3222d61</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722226.89</string> </value>
<value> <string>ts13788701.84</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>a5c640a150ff808e2519e1fb29f6c28d</string> </value>
<value> <string>2a6c5e2699aef239bad7fdc0e6cdc9ba</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722250.31</string> </value>
<value> <string>ts13788719.55</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>107b3c4889b4c79d7fc1d099ebc513cb</string> </value>
<value> <string>2457a63c4451b8a2e6a8d20aea5a76a6</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13722271.94</string> </value>
<value> <string>ts13788743.08</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>b9903f7443e5849605f8bba3deccb376</string> </value>
<value> <string>8c3a1b8279454a227b321eb72b8fd235</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13721849.98</string> </value>
<value> <string>ts13788512.43</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>2bcd458cf554ba9f28f86290e194d182</string> </value>
<value> <string>89658644c4199dc1d82a86342dace456</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>375419</int> </value>
<value> <int>375449</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13721889.26</string> </value>
<value> <string>ts13788550.31</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>ca55222f8d723027186748a9d7769fa4</string> </value>
<value> <string>41b8096bc20b6274d77e4a32781c282e</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>377558</int> </value>
<value> <int>377610</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13721912.27</string> </value>
<value> <string>ts13788570.79</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>806ffe636dbc47b19b918052c7297936</string> </value>
<value> <string>7ca08ea5a70c322280863db3f64677c4</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>380427</int> </value>
<value> <int>380524</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13721868.75</string> </value>
<value> <string>ts13788529.29</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>25ffde2e3c542ef9b5ef811376fa80f9</string> </value>
<value> <string>48c3465cad298aa0efca058a241080fe</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>389000</int> </value>
<value> <int>389069</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts13721936.22</string> </value>
<value> <string>ts13788588.97</string> </value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>e3eb482db03a11c678246a45d266f500</string> </value>
<value> <string>4a3cf3db8d1e4a24bc34efe7a2187898</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -125,7 +125,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>390830</int> </value>
<value> <int>390896</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>558046d1290e00487a9835ee0e6d440c</string> </value>
<value> <string>d4ddf673e1dae10ba10d90658769f16e</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>d317e0d93ec6020acd9b9c433311958d</string> </value>
<value> <string>c8e06866d6563eff4aa810f9b1d66a56</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>f8885137c806be79f56d0cffa9c3aa4c</string> </value>
<value> <string>a3605185b2430989588f5d1b4f4c95be</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>b5fc74cb2c53902c831c6fcc98689708</string> </value>
<value> <string>0873fbea8ea06f2c81281e068f982ddc</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>1e5370f93577e890e8ad3428a2b1a313</string> </value>
<value> <string>c77d0b48adfaa9ff90f91cc0acdd2528</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>75a6511004c08fb35a46f7cef756bb53</string> </value>
<value> <string>5257c0081fbcdcb119af1a3f8a3d1470</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>5056be7093ca84463b1293f1c8c1005e</string> </value>
<value> <string>8f861f02d8f8c3615ef7125d8e9b0f0b</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>f46927a0248c50816ab7fb81ed47a011</string> </value>
<value> <string>8b1dd925d002bf92daea40042d299dde</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>f3244723f2699880f2ed04096f193214</string> </value>
<value> <string>0fbb901f0f4e83555c34baee88fde9c2</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>f8119289dc10ce3127a6314977b3cdb5</string> </value>
<value> <string>008b10b0bcae56bedc29d64a9d590577</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>3cb8a947e344e59a91b759e02223ae99</string> </value>
<value> <string>7c416f2315387781b100c50ca5727153</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......
......@@ -14,7 +14,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>template_zuite</string> </value>
<value> <string>template_test_zuite</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -7,8 +7,7 @@
<title>Template Test Book</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_book_input_001_en_html/book_css/book.css" />
<link rel="stylesheet" href="book_css/book.css" />
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
var vars={};
......
......@@ -7,8 +7,7 @@
<title>Template Test Book</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_book_input_002_de_html/book_css/book.css" />
<link rel="stylesheet" href="book_css/book.css" />
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
var vars={};
......
......@@ -8,8 +8,7 @@
<title>Template Test Leaflet</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_leaflet_input_001_en_html/leaflet_css/leaflet.css" />
<link rel="stylesheet" href="leaflet_css/leaflet.css" />
<style type="text/css">html .ci-leaflet #left-summary:before {background: url("None") center no-repeat;background-size: contain;}html .ci-leaflet #legalese:before {background: url("common_images/fallback.png") center no-repeat;background-size: contain;content: "";display: block;height: 60px;}</style>
......@@ -203,7 +202,9 @@
<div class="ci-leaflet-footer">
<div class="ci-leaflet-container-left">
<div class="ci-leaflet-footer-image-wrapper">
<img alt="Logo" src="common_images/fallback.png" />
</div>
</div>
<div class="ci-leaflet-container-center">Template.Test.Leaflet-001-en</div>
......
......@@ -8,8 +8,7 @@
<title>Template Test Leaflet</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_leaflet_input_001_en_html/leaflet_css/leaflet.css" />
<link rel="stylesheet" href="leaflet_css/leaflet.css" />
<style type="text/css">html .ci-leaflet #left-summary:before {background: url("None") center no-repeat;background-size: contain;}html .ci-leaflet #legalese:before {background: url("https://softinst73908.host.vifib.net/erp5/organisation_module/template_test_association/default_image?format=png") center no-repeat;background-size: contain;content: "";display: block;height: 60px;}</style>
......@@ -163,8 +162,10 @@
<div class="ci-leaflet-footer">
<div class="ci-leaflet-container-left">
<div class="ci-leaflet-footer-image-wrapper">
<img alt="Logo"
src="https://softinst73908.host.vifib.net/erp5/organisation_module/template_test_association/default_image?format=png&amp;display=thumbnail" />
</div>
</div>
<div class="ci-leaflet-container-center">Template.Test.Leaflet-001-en</div>
......
......@@ -8,8 +8,7 @@
<title>Template Test Leaflet</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_leaflet_input_002_de_html/leaflet_css/leaflet.css" />
<link rel="stylesheet" href="leaflet_css/leaflet.css" />
<style type="text/css">html .ci-leaflet #left-summary:before {background: url("None") center no-repeat;background-size: contain;}html .ci-leaflet #legalese:before {background: url("common_images/fallback.png") center no-repeat;background-size: contain;content: "";display: block;height: 60px;}</style>
......@@ -203,7 +202,9 @@
<div class="ci-leaflet-footer">
<div class="ci-leaflet-container-left">
<div class="ci-leaflet-footer-image-wrapper">
<img alt="Logo" src="common_images/fallback.png" />
</div>
</div>
<div class="ci-leaflet-container-center">Template.Test.Leaflet-002-de</div>
......
......@@ -7,8 +7,7 @@
<title>Template Test Letter</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_letter_input_001_en_html/letter_css/letter.css" />
<link rel="stylesheet" href="letter_css/letter.css" />
</head>
<body class="ci-letter">
......
......@@ -7,8 +7,7 @@
<title>Template Test Letter</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_letter_input_002_en_html/letter_css/letter.css" />
<link rel="stylesheet" href="letter_css/letter.css" />
</head>
<body class="ci-letter">
......
......@@ -7,8 +7,7 @@
<title>Template Test Letter</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_letter_input_003_en_html/letter_css/letter.css" />
<link rel="stylesheet" href="letter_css/letter.css" />
</head>
<body class="ci-letter">
......
......@@ -7,8 +7,7 @@
<title>Template Test Letter</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_letter_input_004_de_html/letter_css/letter.css" />
<link rel="stylesheet" href="letter_css/letter.css" />
</head>
<body class="ci-letter">
......
......@@ -13,8 +13,7 @@
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_slideshow_input_001_en_html/slide_css/slide.css" />
<link rel="stylesheet" href="slide_css/slide.css" />
<style type="text/css">.ci-slideshow-intro.present:not(.slide-background):before {content: "";background: #FFF url("common_images/fallback.png") center no-repeat;background-size: auto 120px;}</style>
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
......
......@@ -13,8 +13,7 @@
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_slideshow_input_001_en_html/slide_css/slide.css" />
<link rel="stylesheet" href="slide_css/slide.css" />
<style type="text/css">.ci-slideshow-intro.present:not(.slide-background):before {content: "";background: #FFF url("common_images/fallback.png") center no-repeat;background-size: auto 120px;}</style>
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
......@@ -38,7 +37,7 @@
<div class="ci-slideshow-container-left">
<div class="ci-slideshow-footer-image-wrapper">
<img alt=""
src="Template.Test.Image.Logo.Alternativ?format=png&amp;display=small&amp;display=thumbnail" />
src="Template.Test.Image.Logo.Alternativ?format=png&amp;display=thumbnail" />
</div>
</div>
<div class="ci-slideshow-container-center"></div>
......
......@@ -13,8 +13,7 @@
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" href="default_themes/themes.css" />
<link rel="stylesheet"
href="https://softinst73908.host.vifib.net/erp5/web_page_module/template_test_slideshow_input_002_en_html/slide_css/slide.css" />
<link rel="stylesheet" href="slide_css/slide.css" />
<style type="text/css">.ci-slideshow-intro.present:not(.slide-background):before {content: "";background: #FFF url("common_images/fallback.png") center no-repeat;background-size: auto 120px;}</style>
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
......
"""
================================================================================
Lookup a (hardcoded) custom parameter (default image, css-path etc)
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# parameter Parameter to lookup
customHandler = getattr(context, "WebPage_getCustomParameter", None)
if customHandler is not None:
return customHandler(parameter=parameter)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>parameter=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getCustomTemplateParameter</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
================================================================================
Lookup a (hardcoded) custom parameter (default image, css-path etc)
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# parameter Parameter to lookup
# override_data Portal Type or relative url passed along
customProxyHandler = getattr(context, "WebPage_getCustomProxyParameter", None)
if customProxyHandler is not None:
source_data = override_data or context.getUid()
return customProxyHandler(parameter=parameter, source_data=source_data)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>parameter=None, override_data=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getCustomTemplateProxyParameter</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,32 +3,13 @@
Create a destination dict for filling templates
================================================================================
"""
blank = ''
from Products.PythonScripts.standard import html_quote
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
# parameters:
# ------------------------------------------------------------------------------
# destination: Can be set if called from Event
# override_destination_person_title: Title of person to use
# override_destination_organisation_title: Title of organisation to use
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or context.getUid()
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or context.getUid()
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or context.getUid()
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
blank = ''
# ---------------------------- Set Destination --------------------------------
# destination => Web Page = follow-up Organisation or Person, Event
......@@ -41,19 +22,19 @@ if destination is None:
# destination person
if override_destination_person_title is not None or override_destination_person_title is blank:
destination_person_list = getCommonProxyParameter("override_person", override_destination_person_title)
destination_person_list = context.Base_getCustomTemplateProxyParameter("override_person", override_destination_person_title)
if len(destination_person_list) == 0:
destination_person_list = getCommonProxyParameter("person", None)
destination_person_list = context.Base_getCustomTemplateProxyParameter("person", None)
if len(destination_person_list) > 0:
destination_person = destination_person_list[0]
# destination organisation
if override_destination_organisation_title is not None or override_destination_organisation_title is blank:
destination_organisation_list = getCommonProxyParameter("override_organisation", override_destination_organisation_title)
destination_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", override_destination_organisation_title)
if len(destination_organisation_list) == 0:
destination_organisation_list = getCommonProxyParameter("organisation", None)
destination_organisation_list = context.Base_getCustomTemplateProxyParameter("organisation", None)
if len(destination_organisation_list) == 0 and destination_person is not None:
destination_organisation_list = getCommonProxyParameter("source", destination_person.get("uid")) or []
destination_organisation_list = context.Base_getCustomTemplateProxyParameter("source", destination_person.get("uid")) or []
if len(destination_organisation_list) > 0:
destination_organisation = destination_organisation_list[0]
......@@ -64,6 +45,6 @@ if destination is None:
# destination => event
else:
destination_uid = context.restrictedTraverse(destination).getUid()
destination = getCommonProxyParameter("destination", destination_uid)[0]
destination = context.Base_getCustomTemplateProxyParameter("destination", destination_uid)[0]
return destination
......@@ -3,36 +3,22 @@
Create a source dict for filling templates
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# source: Can be set if called from Event
# override_logo_reference Logo to use instead of organisation logo
# override_source_person_title: Title of person to use
# override_source_organisation_title: Title of organisation to use
# theme_logo_url Theme logo url to use if no logo found
blank = ''
from Products.PythonScripts.standard import html_quote
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or context.getUid()
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or context.getUid()
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or context.getUid()
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
# ------------------------------- Set Source ----------------------------------
source_logo_url = None
if source is None:
default_company_title=context.Base_getCustomTemplateParameter("default_company_title")
default_bank_account_uid=context.Base_getCustomTemplateParameter("default_bank_account_uid")
contributor_title_string = blank
source_person = None
source_person_list = []
......@@ -43,29 +29,29 @@ if source is None:
# source person
if override_source_person_title is not None or override_source_person_title is blank:
source_person_list = getCommonProxyParameter("override_person", override_source_person_title)
source_person_list = context.Base_getCustomTemplateProxyParameter("override_person", override_source_person_title)
if len(source_person_list) == 0:
source_person_list = getCommonProxyParameter("author", None) or []
source_person_list = context.Base_getCustomTemplateProxyParameter("author", None) or []
if len(source_person_list) > 0:
source_person = source_person_list[0]
contributor_title_string = ', '.join(x.get("name", blank) for x in source_person_list)
# source organisation
if override_source_organisation_title is not None or override_source_organisation_title is blank:
source_organisation_list = getCommonProxyParameter("override_organisation", override_source_organisation_title)
source_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", override_source_organisation_title)
if len(source_organisation_list) == 0:
source_organisation_uid = getCustomParameter("source_organisation_uid", None)
source_organisation_uid = context.Base_getCustomTemplateParameter("default_source_organisation_uid")
if source_organisation_uid:
source_organisation_list = getCommonProxyParameter("sender", source_organisation_uid) or []
source_organisation_list = context.Base_getCustomTemplateProxyParameter("sender", source_organisation_uid) or []
if len(source_organisation_list) == 0 and default_company_title:
source_organisation_list = getCommonProxyParameter("override_organisation", default_company_title) or []
source_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", default_company_title) or []
if len(source_organisation_list) == 0 and source_person is not None:
for organisation_candidate in source_person_list:
organisation_candidate_list = getCommonProxyParameter("source", organisation_candidate.get("uid")) or []
organisation_candidate_list = context.Base_getCustomTemplateProxyParameter("source", organisation_candidate.get("uid")) or []
if len(organisation_candidate_list) > 0:
source_organisation_list = organisation_candidate_list
break
#source_organisation_list = getCommonProxyParameter("source", source_person.get("uid")) or []
#source_organisation_list = context.Base_getCustomTemplateProxyParameter("source", source_person.get("uid")) or []
if len(source_organisation_list) > 0:
source_organisation = source_organisation_list[0]
......@@ -77,11 +63,11 @@ if source is None:
# source => event
else:
source_uid =context.restrictedTraverse(source).getUid()
source = getCommonProxyParameter("source", source_uid)[0]
source = context.Base_getCustomTemplateProxyParameter("source", source_uid)[0]
# override specific bank account (no default to pick correct one if multiple exist)
if default_bank_account_uid is not None:
override_bank_account_list = getCommonProxyParameter("bank", default_bank_account_uid) or []
override_bank_account_list = context.Base_getCustomTemplateProxyParameter("bank", default_bank_account_uid) or []
if len(override_bank_account_list) > 0:
override_bank_account = override_bank_account_list[0]
source["bank"] = override_bank_account.get("bank")
......@@ -90,7 +76,7 @@ if default_bank_account_uid is not None:
# XXX images stored on organisation (as do images in skin folders)
if override_logo_reference:
source_logo_url = html_quote(override_logo_reference) + "?format=png&display=small"
source_logo_url = html_quote(override_logo_reference) + "?format=png"
source_set = True
if source_logo_url is None:
source_logo_url = source.get("logo_url", blank)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>source=None, override_logo_reference=None, override_source_person_title=None, override_source_organisation_title=None, default_company_title=None, default_bank_account_uid=None, theme_logo_url=None</string> </value>
<value> <string>source=None, override_logo_reference=None, override_source_person_title=None, override_source_organisation_title=None, theme_logo_url=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -3,55 +3,36 @@
Create a theme dict for filling templates
================================================================================
"""
blank = ''
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
# parameters:
# ------------------------------------------------------------------------------
# format Output format for building css paths
# css_path Path for template css
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or context.getUid()
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or context.getUid()
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or context.getUid()
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
blank = ''
# ------------------------------- Set Theme -----------------------------------
# XXX images in portal_skins folders don't convert with ?params. Only format
# is kept in Base_convertHtmlToSingleFile
img = getCommonParameter("fallback_image", blank)
img = context.Base_getCustomTemplateParameter("fallback_image") or blank
pdf = ".pdf" if format == "pdf" else blank
css = "default_theme_css_url"
font = "default_theme_font_css_url_list"
param = "?format=png"
theme_logo_alt = "Default Logo"
default_company_title = getCustomParameter("default_company_title", None)
default_company_title = context.Base_getCustomTemplateParameter("default_company_title")
theme_logo = None
theme_logo_url = None
theme_logo_description = blank
theme = (
getCommonProxyParameter("theme", None) or
custom_theme or
context.Base_getCustomTemplateProxyParameter("theme") or
context.Base_getCustomTemplateParameter("theme") or
default_company_title
)
if theme is not None:
logo_prefix = getCustomParameter("default_logo_prefix", None)
logo_prefix = context.Base_getCustomTemplateParameter("default_logo_prefix")
theme = theme.lower()
if logo_prefix:
theme_logo_url = logo_prefix + theme.capitalize()
......@@ -67,9 +48,9 @@ if theme is None:
theme_dict = {}
theme_dict["theme"] = theme
theme_dict["theme_logo_description"] = theme_logo_description
theme_dict["theme_logo_url"] = (theme_logo_url + param) if theme_logo_url is not None else getCommonParameter("fallback_image", None)
theme_dict["template_css_url"] = ''.join([url, css_path, pdf, ".css"])
theme_dict["fallback_img_url"] = ''.join([url, '/', img])
theme_dict["theme_css_font_list"] = getCustomParameter(font, None) or []
theme_dict["theme_css_url"] = getCustomParameter(css, None) or getCommonParameter(css, None) or blank
theme_dict["theme_logo_url"] = (theme_logo_url + param) if theme_logo_url is not None else context.Base_getCustomTemplateParameter("fallback_image")
theme_dict["template_css_url"] = css_path + pdf + ".css"
theme_dict["fallback_img_url"] = context.Base_getCustomTemplateParameter("fallback_image") or blank
theme_dict["theme_css_font_list"] = context.Base_getCustomTemplateParameter(font) or []
theme_dict["theme_css_url"] = context.Base_getCustomTemplateParameter(css) or context.Base_getCustomTemplateParameter(css) or blank
return theme_dict
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>custom_theme=None, override_batch_mode=None, format=None, css_path=None, url=None</string> </value>
<value> <string>format=None, css_path=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
"""
================================================================================
Clean parameters which can be "" or "0" if passed through http
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# parameter Parameter to lookup
if param == "" or param == None or param == 0 or param == str(0):
return None
else:
return param
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>param=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_setToNone</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
================================================================================
Add image size conversion only if image is not the default image
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# path Image path to embed
# XXX replace this with clear defintion of possible values for dialog params
# XXX Note, this is necessary, because it seems images scored in skin folders
# cannot convert (neither format nor size) and in wkhtmltopdf fail if a
# conversion parameter is provided.
if path.find("common") > -1:
return path
else:
return path + "&display=thumbnail"
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>path=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_setUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -33,13 +33,27 @@ if doc_save == 1:
source_reference=''.join([doc_reference, '.pdf']),
file=doc_pdf_file
)
if getattr(context, "aggregate", None) is not None:
# try setting aggregate, eg event attachments
try:
context.setAggregate(document.getRelativeUrl())
except:
pass
# try setting predecessor/related document to later distinguish this
# document from other documents related to the event
try:
document.setPredecessorValueList([event])
except:
pass
message = context.Base_translateString(
'%(portal_type)s created successfully as PDF Document.' % {
'portal_type': document.getTranslatedPortalType()
}
)
# XXX redirect = true?
return document.Base_redirect(
keep_items=dict(portal_status_message=message)
)
......
"""
================================================================================
Return common parameter across all templates
Return custom hardcoded parameters
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# parameter Parameter to lookup
if parameter == "fallback_image":
return "common_images/fallback.png"
if parameter == "default_theme_css_url":
return "default_themes/themes.css"
if parameter == "wkhtmltopdf_rendering_fix":
return """
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebPage_getCommonParameter</string> </value>
<value> <string>WebPage_getCustomParameter</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -160,7 +160,7 @@ def getSubstringFromProduct(my_candidate, my_as_is):
return software_title.split(software_match_string)[0].lower()
def callSelf(my_parameter, my_source_id, my_flag_site):
return context.WebPage_getCommonProxyParameter(
return context.WebPage_getCustomProxyParameter(
parameter=my_parameter,
source_uid=my_source_id,
flag_site=my_flag_site
......
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebPage_getCommonProxyParameter</string> </value>
<value> <string>WebPage_getCustomProxyParameter</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -70,21 +70,37 @@ html{
.ci-leaflet .ci-leaflet-footer {
position: static;
}
.ci-leaflet .ci-leaflet-footer div {
.ci-leaflet .ci-leaflet-footer .ci-leaflet-container-left,
.ci-leaflet .ci-leaflet-footer .ci-leaflet-container-center,
.ci-leaflet .ci-leaflet-footer .ci-leaflet-container-right {
display: inline-block;
vertical-align: middle;
width: 33%;
text-align: center;
}
@media(max-width: 720px) {
.ci-leaflet .ci-leaflet-footer div {
.ci-leaflet .ci-leaflet-footer .ci-leaflet-container-left,
.ci-leaflet .ci-leaflet-footer .ci-leaflet-container-center,
.ci-leaflet .ci-leaflet-footer .ci-leaflet-container-right{
width: 31%;
}
}
.ci-leaflet-footer .ci-leaflet-footer-image-wrapper {
min-height: 20mm;
display: inline;
vertical-align: middle;
}
.ci-leaflet-footer .ci-leaflet-footer-image-wrapper img {
display: inline-block;
width: auto;
height: 50px;
}
/*
.ci-leaflet .ci-leaflet-container-left img {
max-height: 2.5em;
min-width: initial;
}
*/
.ci-leaflet .ci-leaflet-container-left {
text-align: left;
}
......
......@@ -86,10 +86,23 @@ html{
width: 33%;
text-align: center;
}
.ci-leaflet-footer .ci-leaflet-footer-image-wrapper {
min-height: 20mm;
display: inline;
vertical-align: middle;
}
.ci-leaflet-footer .ci-leaflet-footer-image-wrapper img {
display: inline-block;
width: auto;
height: 14mm;
}
/*
.ci-leaflet .ci-leaflet-container-left img {
max-width: 120px;
height: initial;
}
*/
.ci-leaflet .ci-leaflet-container-left {
text-align: left;
}
......
......@@ -286,7 +286,7 @@ html .ci-slideshow .ci-slideshow-footer > div {
.ci-slideshow-footer-image-wrapper img {
display: inline-block;
width: auto;
height: auto;
height: 50px;
}
html .ci-slideshow .ci-slideshow-container-left {
......
......@@ -151,7 +151,7 @@ section {
.ci-slideshow-footer .ci-slideshow-container-left .ci-slideshow-footer-image-wrapper img {
display: inline-block;
width: auto;
height: auto;
height: 14mm;
}
.ci-slideshow-footer .ci-slideshow-container-left {
text-align: left;
......
......@@ -26,86 +26,54 @@ MAIN FILE: generate report (book header/footer and report content)
# requirement_relative_url XXX sale order has no direct relation to requirement
import re
from Products.PythonScripts.standard import html_quote
from base64 import b64encode
from datetime import datetime
blank = ''
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or doc_uid
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or doc_uid
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or doc_uid
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
# ------------------ HTML cleanup/converter methods ----------------------------
def translateText(snip):
return doc_localiser.erp5_ui.gettext(snip, lang=doc_language).encode('utf-8').strip()
def setOverrideParam(my_context, my_override, my_param):
if my_override is not None and my_override is not blank:
return html_quote(my_override)
try:
return getattr(my_context, my_param) or None
except:
return blank
# XXX how to set checkbox correctly?
def setToNone(param):
if param == blank or param == None or param == 0 or param == str(0):
return None
else:
return param
# -------------------------- Setup ---------------------------------------------
doc = context
doc_download = None #XXX not yet implemented
doc_save = setToNone(kw.get('document_save', None))
doc_display_header = setToNone(kw.get('display_header', None))
doc_display_comment = setToNone(kw.get('display_comment', None))
doc_display_detail = setToNone(kw.get('display_detail', None))
doc_display_depth = setToNone(kw.get('display_depth', None))
doc_save = doc.Base_setToNone(param=kw.get('document_save', None))
doc_display_header = doc.Base_setToNone(param=kw.get('display_header', None))
doc_display_comment = doc.Base_setToNone(param=kw.get('display_comment', None))
doc_display_detail = doc.Base_setToNone(param=kw.get('display_detail', None))
doc_display_depth = doc.Base_setToNone(param=kw.get('display_depth', None))
override_document_title = kw.get('document_title', None)
override_document_version = kw.get('document_version', None)
override_document_reference = kw.get('document_reference', None)
override_document_language = kw.get('document_language', None)
override_batch_mode = setToNone(kw.get('batch_mode', None))
override_batch_mode = doc.Base_setToNone(param=kw.get('batch_mode', None))
doc_report_name = kw.get('report_name', None)
doc_report_title = kw.get('report_title', None)
doc_format = doc.Base_setToNone(param=kw.get('format', None)) or 'html'
doc_requirement_relative_url = kw.get('requirement_relative_url', None)
doc_format = setToNone(kw.get('format', None)) or 'html'
# -------------------------- Document Parameters ------------------------------
doc = context
doc_localiser = doc.getPortalObject().Localizer
doc_language = setToNone(setOverrideParam(doc, override_document_language, "language")) or "en"
doc_uid = doc.getUid()
doc_localiser = doc.getPortalObject().Localizer
doc_relative_url = doc.getRelativeUrl()
doc_rendering_fix = getCommonParameter('wkhtmltopdf_rendering_fix', None) or blank
doc_title = setToNone(setOverrideParam(doc, override_document_title, "title")) or blank
doc_short_title = setToNone(setOverrideParam(doc, doc_report_title, "short_title")) or blank
doc_version = setToNone(setOverrideParam(doc, override_document_version, "version")) or "001"
doc_rendering_fix = doc.Base_getCustomTemplateParameter('wkhtmltopdf_rendering_fix') or blank
doc_report = getattr(doc, doc_report_name)
doc_aggregate_list = []
doc_absolute_url = doc.getAbsoluteUrl()
doc_revision = "1"
doc_modification_date = DateTime()
doc_short_date = doc_modification_date.strftime('%Y-%m-%d')
# XXX sigh for passing "" around
doc_reference = html_quote(override_document_reference) if doc.Base_setToNone(override_document_reference) is not None else doc.Base_setToNone(doc.getReference()) or blank
doc_short_title = html_quote(doc_report_title) if doc.Base_setToNone(doc_report_title) is not None else doc.Base_setToNone(doc.getShortTitle()) or blank
doc_version = html_quote(override_document_version) if doc.Base_setToNone(override_document_version) is not None else doc.Base_setToNone(getattr(doc, "version", None)) or "001"
doc_title = html_quote(override_document_title) if doc.Base_setToNone(override_document_title) is not None else doc.Base_setToNone(doc.getTitle()) or blank
doc_language = html_quote(override_document_language) if doc.Base_setToNone(override_document_language) is not None else doc.Base_setToNone(doc.getLanguage())
doc_content = doc_report(
display_report=True,
display_depth=doc_display_depth,
......@@ -115,17 +83,12 @@ doc_content = doc_report(
requirement_url=doc_requirement_relative_url,
report_title=translateText(doc_report_title)
)
doc_aggregate_list = []
doc_absolute_url = doc.getAbsoluteUrl()
doc_reference = setToNone(setOverrideParam(doc, override_document_reference, "reference")) or blank
doc_revision = "1"
doc_modification_date = DateTime()
doc_short_date = doc_modification_date.strftime('%Y-%m-%d')
# test overrides
if override_batch_mode is not None:
doc_modification_date = DateTime("1976-11-04")
doc_revision = "1"
if doc_language is not None: # and doc_format == "pdf":
if doc_language is not None:
doc.REQUEST['AcceptLanguage'].set(doc_language, 10)
if doc_language is None:
doc_language = blank
......@@ -133,21 +96,13 @@ if doc_reference is blank:
doc_reference = "Report." + doc_title.replace(" ", ".")
doc_full_reference = '-'.join([doc_reference, doc_version, doc_language])
# --------------------------- Layout Parameters --------------------------------
doc_theme = doc.Base_getThemeDict(
custom_theme=getCustomParameter("theme", None),
override_batch_mode=override_batch_mode,
format=doc_format,
url=doc_absolute_url,
css_path="/book_css/book"
)
# ------------------------------- Theme ----------------------------------------
doc_theme = doc.Base_getThemeDict(format=doc_format, css_path="book_css/book")
# --------------------------- Source/Destination -------------------------------
doc_source = doc.Base_getSourceDict(
override_source_person_title=None,
override_source_organisation_title=None,
default_company_title=getCustomParameter("default_company_title", None),
default_bank_account_uid=getCustomParameter("default_bank_account_uid", None),
theme_logo_url=doc_theme.get("theme_logo_url", None)
)
......@@ -164,7 +119,7 @@ if doc_format == "html":
book_theme_css_font_list=doc_theme.get("theme_css_font_list"),
book_theme_css_url=doc_theme.get("theme_css_url"),
book_template_css_url=doc_theme.get("template_css_url"),
book_logo_url=doc_source.get("enhanced_logo_url") + '&display=thumbnail',
book_logo_url=doc.Base_setUrl(path=doc_source.get("enhanced_logo_url")),
book_logo_title=doc_source.get("theme_logo_description"),
book_short_title=doc_short_title,
book_reference=doc_reference,
......@@ -211,7 +166,7 @@ if doc_format == "pdf":
book_theme_css_font_list=doc_theme.get("theme_css_font_list"),
book_theme_css_url=doc_theme.get("theme_css_url"),
book_template_css_url=doc_theme.get("template_css_url"),
book_logo_url=doc_source.get("enhanced_logo_url") + '&display=thumbnail',
book_logo_url=doc.Base_setUrl(path=doc_source.get("enhanced_logo_url")),
book_logo_title=doc_source.get("theme_logo_description"),
book_short_title=doc_short_title,
book_reference=doc_reference,
......@@ -226,7 +181,7 @@ if doc_format == "pdf":
book_language=doc_language,
book_theme_css_font_list=doc_theme.get("theme_css_font_list"),
book_theme_css_url=doc_theme.get("theme_css_url"),
book_theme_logo_url=doc_source.get("enhanced_logo_url") + '&display=thumbnail',
book_theme_logo_url=doc.Base_setUrl(path=doc_source.get("enhanced_logo_url")),
book_theme_logo_alt=doc_theme.get("theme_logo_description"),
book_template_css_url=doc_theme.get("template_css_url"),
book_full_reference=doc_full_reference,
......@@ -240,7 +195,7 @@ if doc_format == "pdf":
embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_content, allow_script=True)
footer_embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_foot, allow_script=True)
pdf_file = context.Base_cloudoooDocumentConvert(embedded_html_data, "html", "pdf", conversion_kw=dict(
pdf_file = doc.Base_cloudoooDocumentConvert(embedded_html_data, "html", "pdf", conversion_kw=dict(
encoding="utf8",
margin_top=40,
margin_bottom=20,
......
......@@ -42,7 +42,7 @@ Generates the complete book (only called in HTML version)
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
var vars={};
......
......@@ -27,7 +27,7 @@ Creates the Book content.
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head>
<body class="ci-book ci-book-content">
<tal:block metal:use-macro="context/WebPage_createBookContent/macros/book_content" />
......
......@@ -24,7 +24,7 @@ Creates the Book cover.
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head>
<body class="ci-book">
<tal:block metal:use-macro="context/WebPage_createBookCover/macros/book_cover" />
......
......@@ -23,7 +23,7 @@ Creates the Book footer.
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head>
<body class="ci-book" onload="setPlaceholdersWithUrlParameters()">
<tal:block metal:use-macro="context/WebPage_createBookFooter/macros/book_footer" />
......
......@@ -28,7 +28,7 @@ Creates the Book header.
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
var vars={};
......
......@@ -25,7 +25,7 @@ Creates the Book sections (version, authors, etc).
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head>
<body class="ci-book" tal:condition="python: book_include_history is not None">
<tal:block metal:use-macro="context/WebPage_createBookTableOfHistory/macros/book_history" />
......
......@@ -32,7 +32,7 @@ Creates the Tables of references.
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: ''.join([book_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head>
<body class="ci-book" tal:condition="python: book_include_reference is not None">
<tal:block metal:use-macro="context/WebPage_createBookTableOfReferences/macros/book_references" />
......
......@@ -37,75 +37,28 @@ from datetime import datetime
blank = ''
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or book_uid
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or book_uid
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or book_uid
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
# ------------------ HTML cleanup/converter methods ----------------------------
def translateText(snip):
return book_localiser.erp5_ui.gettext(snip, lang=book_language).encode('utf-8').strip()
def setOverrideParam(my_context, my_override, my_param):
if my_override is not None and my_override is not blank:
return html_quote(my_override)
try:
return getattr(my_context, my_param) or None
except:
return blank
# XXX how to set checkbox correctly?
def setToNone(param):
if param == blank or param == None or param == 0 or param == str(0):
return None
else:
return param
# XXX change url so convert does not fail
def setUrl(path):
if path.find("common") > -1:
return path
else:
return path + "&display=thumbnail"
# -------------------------- Setup ---------------------------------------------
book = context
book_format = setToNone(kw.get('format', None)) or 'html'
book_format = book.Base_setToNone(param=kw.get('format', None)) or 'html'
book_transformation = kw.get('transformation', None)
book_download = setToNone(kw.get('document_download', None))
book_save = setToNone(kw.get('document_save', None))
book_display_svg = setToNone(kw.get('display_svg', None))
book_download = book.Base_setToNone(param=kw.get('document_download', None))
book_save = book.Base_setToNone(param=kw.get('document_save', None))
book_display_svg = book.Base_setToNone(param=kw.get('display_svg', None))
book_include_content_table = kw.get('include_content_table', None)
if book_include_content_table is None:
book_include_content_table = 1
else:
book_include_content_table = setToNone(book_include_content_table)
book_include_content_table = book.Base_setToNone(param=book_include_content_table)
book_include_history_table = setToNone(kw.get('include_history_table', None))
book_include_reference_table = setToNone(kw.get('include_reference_table', None))
book_include_linked_content = setToNone(kw.get('include_linked_content', None))
book_include_report_content = setToNone(kw.get('include_report_content', None))
book_include_history_table = book.Base_setToNone(param=kw.get('include_history_table', None))
book_include_reference_table = book.Base_setToNone(param=kw.get('include_reference_table', None))
book_include_linked_content = book.Base_setToNone(param=kw.get('include_linked_content', None))
book_include_report_content = book.Base_setToNone(param=kw.get('include_report_content', None))
override_source_person_title = kw.get('override_source_person_title', None)
override_source_organisation_title = kw.get("override_source_organisation_title", None)
......@@ -115,7 +68,7 @@ override_document_title = kw.get('override_document_title', None)
override_document_version = kw.get('override_document_version', None)
override_document_reference = kw.get('override_document_reference', None)
override_logo_reference = kw.get('override_logo_reference', None)
override_batch_mode = setToNone(kw.get('batch_mode', None))
override_batch_mode = book.Base_setToNone(param=kw.get('batch_mode', None))
# -------------------------- Document Parameters ------------------------------
book_form = book.REQUEST
......@@ -124,26 +77,29 @@ book_portal_type = book.getPortalType()
book_uid = book.getUid()
book_relative_url = book.getRelativeUrl()
book_prefix = "Book."
book_rendering_fix = getCommonParameter('wkhtmltopdf_rendering_fix', None) or blank
book_rendering_fix = book.Base_getCustomTemplateParameter('wkhtmltopdf_rendering_fix') or blank
book_dialog_id = book_form.get('dialog_id', None)
book_title = setOverrideParam(book, override_document_title, "title")
book_short_title = setOverrideParam(book, override_document_short_title, "short_title")
book_version = setOverrideParam(book, override_document_version, "version")
book_description = setOverrideParam(book, override_document_description, "description")
book_content = book.getTextContent()
book_language = setToNone(book.getLanguage())
book_aggregate_list = []
book_absolute_url = book.getAbsoluteUrl()
book_reference = (html_quote(override_document_reference) if override_document_reference else book.getReference()) or blank
book_revision = book.getRevision()
book_modification_date = book.getModificationDate()
book_language = book.Base_setToNone(param=book.getLanguage())
# XXX sigh for passing "" around
book_reference = html_quote(override_document_reference) if book.Base_setToNone(override_document_reference) is not None else book.Base_setToNone(book.getReference())
book_short_title = html_quote(override_document_short_title) if book.Base_setToNone(override_document_short_title) is not None else book.Base_setToNone(book.getShortTitle())
book_version = html_quote(override_document_version) if book.Base_setToNone(override_document_version) is not None else book.Base_setToNone(book.getVersion()) or "001"
book_description = html_quote(override_document_description) if book.Base_setToNone(override_document_description) is not None else book.Base_setToNone(book.getDescription())
book_title = html_quote(override_document_title) if book.Base_setToNone(override_document_title) is not None else book.Base_setToNone(book.getTitle())
# override for tests
if override_batch_mode is not None:
book_modification_date = DateTime("1976-11-04")
book_revision = "1"
book_short_date = book_modification_date.strftime('%Y-%m-%d')
if book_language is not None: #and book_format == "pdf":
if book_language is not None:
book.REQUEST['AcceptLanguage'].set(book_language, 10)
if book_language is None:
book_language = blank
......@@ -151,22 +107,14 @@ if book_reference is None:
book_reference = book_prefix + book_title.replace(" ", ".")
book_full_reference = '-'.join([book_reference, book_version, book_language])
# --------------------------- Layout Parameters --------------------------------
book_theme = book.Base_getThemeDict(
custom_theme=getCustomParameter("theme", None),
override_batch_mode=override_batch_mode,
format=book_format,
url=book_absolute_url,
css_path="/book_css/book"
)
# ------------------------------- Theme ----------------------------------------
book_theme = book.Base_getThemeDict(format=book_format, css_path="book_css/book")
# --------------------------- Source/Destination -------------------------------
book_source = book.Base_getSourceDict(
override_source_person_title=override_source_person_title,
override_source_organisation_title=override_source_organisation_title,
override_logo_reference=override_logo_reference,
default_company_title=getCustomParameter("default_company_title", None),
default_bank_account_uid=getCustomParameter("default_bank_account_uid", None),
theme_logo_url=book_theme.get("theme_logo_url", None)
)
......@@ -267,7 +215,6 @@ for image in re.findall('(<img.*?/>)', book_content):
# ========================== Format: mhtml/html ================================
if book_format == "html" or book_format == "mhtml":
book.REQUEST.RESPONSE.setHeader("Content-Type", "text/html;")
book_output = book.WebPage_createBook(
book_theme=book_theme.get("theme"),
book_title=book_title,
......@@ -282,7 +229,7 @@ if book_format == "html" or book_format == "mhtml":
book_signature_list=book_signature_list,
book_version_list=book_version_list,
book_distribution_list=book_distribution_list,
book_logo_url=setUrl(book_source.get("enhanced_logo_url")),
book_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url")),
book_logo_title=book_theme.get("theme_logo_description"),
book_reference=book_reference,
book_revision=book_revision,
......@@ -294,8 +241,22 @@ if book_format == "html" or book_format == "mhtml":
book_table_of_content=book_table_of_content
)
if book_format == "html":
return book_output
return book.Base_finishWebPageCreation(
doc_download=book_download,
doc_save=book_save,
doc_version=book_version,
doc_title=book_title,
doc_relative_url=book_relative_url,
doc_aggregate_list=book_aggregate_list,
doc_language=book_language,
doc_modification_date=book_modification_date,
doc_reference=book_reference,
doc_full_reference=book_full_reference,
doc_html_file=book_output
)
if book_format == "mhtml":
context.REQUEST.RESPONSE.setHeader("Content-Type", "text/html;")
return book.Base_convertHtmlToSingleFile(book_output, allow_script=True)
# ============================= Format: pdf ====================================
......@@ -318,7 +279,7 @@ if book_format == "pdf":
book_language=book_language,
book_theme_css_font_list=book_theme.get("theme_css_font_list"),
book_theme_css_url=book_theme.get("theme_css_url"),
book_theme_logo_url=setUrl(book_source.get("enhanced_logo_url")),
book_theme_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url")),
book_theme_logo_alt=book_theme.get("theme_logo_alt"),
book_template_css_url=book_theme.get("template_css_url"),
book_include_history=book_include_history_table,
......@@ -347,7 +308,7 @@ if book_format == "pdf":
book_theme_css_font_list=book_theme.get("theme_css_font_list"),
book_theme_css_url=book_theme.get("theme_css_url"),
book_template_css_url=book_theme.get("template_css_url"),
book_logo_url=setUrl(book_source.get("enhanced_logo_url")),
book_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url")),
book_logo_title=book_theme.get("theme_logo_description"),
book_short_title=book_short_title,
book_reference=book_reference,
......@@ -362,7 +323,7 @@ if book_format == "pdf":
book_language=book_language,
book_theme_css_font_list=book_theme.get("theme_css_font_list"),
book_theme_css_url=book_theme.get("theme_css_url"),
book_theme_logo_url=setUrl(book_source.get("enhanced_logo_url")),
book_theme_logo_url=book.Base_setUrl(path=book_source.get("enhanced_logo_url")),
book_theme_logo_alt=book_theme.get("theme_logo_description"),
book_template_css_url=book_theme.get("template_css_url"),
book_full_reference=book_full_reference,
......@@ -387,7 +348,7 @@ if book_format == "pdf":
embedded_html_data = book.Base_convertHtmlToSingleFile(book_content, allow_script=True)
footer_embedded_html_data = book.Base_convertHtmlToSingleFile(book_foot, allow_script=True)
pdf_file = context.Base_cloudoooDocumentConvert(embedded_html_data, "html", "pdf", conversion_kw=dict(
pdf_file = book.Base_cloudoooDocumentConvert(embedded_html_data, "html", "pdf", conversion_kw=dict(
encoding="utf8",
margin_top=40,
margin_bottom=20,
......
......@@ -42,8 +42,8 @@ Generates the complete leaflet
<tal:block tal:repeat="font_url leaflet_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" />
<link rel="stylesheet" tal:attributes="href leaflet_template_css_url" />
<tal:block tal:condition="python: leaflet_css is not None">
<style type="text/css" tal:content="python: leaflet_css"></style>
</tal:block>
......
......@@ -23,8 +23,8 @@ Generate leaflet content
<tal:block tal:repeat="font_url leaflet_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" />
<link rel="stylesheet" tal:attributes="href leaflet_template_css_url" />
<tal:block tal:condition="python: leaflet_css is not None">
<style type="text/css" tal:content="python: leaflet_css"></style>
</tal:block>
......
......@@ -25,8 +25,8 @@ Generate the leaflet footer
<tal:block tal:repeat="font_url leaflet_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" />
<link rel="stylesheet" tal:attributes="href leaflet_template_css_url" />
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
var vars={};
......@@ -51,7 +51,9 @@ Generate the leaflet footer
<div class="ci-leaflet-footer">
<div class="ci-leaflet-container-left">
<tal:block tal:condition="python: leaflet_logo_url != ''">
<img alt="Logo" tal:attributes="src python: leaflet_logo_url" />
<div class="ci-leaflet-footer-image-wrapper">
<img tal:attributes="src python: leaflet_logo_url" alt="Logo" />
</div>
</tal:block>
</div>
<div class="ci-leaflet-container-center" tal:content="python: leaflet_full_reference"></div>
......
......@@ -22,8 +22,8 @@ Generates the leaflet header
<tal:block tal:repeat="font_url leaflet_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([leaflet_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" />
<link rel="stylesheet" tal:attributes="href leaflet_template_css_url" />
</head>
<body class="ci-leaflet">
<tal:block metal:use-macro="context/WebPage_createLeafletHeader/macros/leaflet_header" />
......
......@@ -26,78 +26,30 @@ from datetime import datetime
blank = ''
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or leaflet_uid
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or leaflet_uid
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or leaflet_uid
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
# ------------------ HTML cleanup/converter methods ----------------------------
def removeLegalesePlaceholders(content):
content = content.replace("${legalese}", "")
content = content.replace("${document_id}", "")
return content
def setOverrideParam(my_context, my_override, my_param):
if my_override is not None and my_override is not blank:
return html_quote(my_override)
return getattr(my_context, my_param) or None
# XXX how to set checkbox correctly?
def setToNone(param):
if param == blank or param == None or param == 0 or param == str(0):
return None
else:
return param
# XXX change url so convert does not fail
def setUrl(path):
if path.find("common") > -1:
return path
else:
return path + "&display=thumbnail"
# -------------------------- Setup ---------------------------------------------
leaflet = context
leaflet_prefix = "Leaflet."
leaflet_format = kw.get('format', 'html')
leaflet_layout = kw.get('transformation', None)
leaflet_transformation = kw.get('transformation', None)
leaflet_display_side = setToNone(kw.get('display_side', 1))
leaflet_display_svg = leaflet.Base_setToNone(param=kw.get('display_svg', "png"))
leaflet_download = leaflet.Base_setToNone(param=kw.get('document_download', None))
leaflet_save = leaflet.Base_setToNone(param=kw.get('document_save', None))
leaflet_display_side = leaflet.Base_setToNone(param=kw.get('display_side', 1))
# sigh for time lost
if leaflet_display_side == '1':
leaflet_display_side = 1
leaflet_display_svg = setToNone(kw.get('display_svg', "png"))
leaflet_download = setToNone(kw.get('document_download', None))
leaflet_save = setToNone(kw.get('document_save', None))
override_leaflet_header_title = setToNone(kw.get('override_leaflet_header_title', None))
override_leaflet_header_title = leaflet.Base_setToNone(param=kw.get('override_leaflet_header_title', None))
override_source_person_title = kw.get('override_source_person_title', None)
override_source_organisation_title = kw.get(
"override_source_organisation_title",
None
)
override_batch_mode = setToNone(kw.get('batch_mode', None))
override_source_organisation_title = kw.get("override_source_organisation_title", None)
override_batch_mode = leaflet.Base_setToNone(param=kw.get('batch_mode', None))
# -------------------------- Document Parameters ------------------------------
......@@ -106,7 +58,7 @@ leaflet_url = leaflet.getAbsoluteUrl()
leaflet_content = leaflet.getTextContent()
leaflet_title = leaflet.getTitle()
leaflet_relative_url = leaflet.getRelativeUrl()
leaflet_language = setToNone(leaflet.getLanguage())
leaflet_language = leaflet.Base_setToNone(param=leaflet.getLanguage())
leaflet_description = leaflet.getDescription()
leaflet_creation_date = leaflet.getCreationDate()
leaflet_date = leaflet_creation_date.strftime('%Y-%b')
......@@ -119,6 +71,7 @@ leaflet_modification_date = leaflet.getModificationDate()
# u"©".encode("utf8")
#leaflet_copy = u"\u00A9".encode('utf-8') | unicode('©', 'utf8') | '©'.encode('utf-8').strip()
# test overrides
if override_batch_mode is not None:
leaflet_date="Nov-1976"
leaflet_year="1976"
......@@ -131,14 +84,9 @@ if leaflet_reference is None:
leaflet_full_reference = '-'.join([leaflet_reference, leaflet_version, leaflet_language])
# ---------------------------- Theme Parameters --------------------------------
leaflet_theme = leaflet.Base_getThemeDict(
custom_theme=getCustomParameter("theme", None),
override_batch_mode=override_batch_mode,
format=leaflet_format,
url=leaflet_url,
css_path="/leaflet_css/leaflet"
)
# set leaflet title, but not to theme (used elsewhere, but not on leaflet)
leaflet_theme = leaflet.Base_getThemeDict(format=leaflet_format, css_path="leaflet_css/leaflet")
# XXX set leaflet title, but not to theme (used elsewhere, but not on leaflet)
if override_leaflet_header_title is not None:
leaflet_theme["theme_logo_description"] = html_quote(override_leaflet_header_title)
if leaflet_theme.get("theme").lower() == leaflet_theme.get("theme_logo_description").lower():
......@@ -155,8 +103,6 @@ leaflet_css = ''.join([
leaflet_source = leaflet.Base_getSourceDict(
override_source_person_title=override_source_person_title,
override_source_organisation_title=override_source_organisation_title,
default_company_title=getCustomParameter("default_company_title", None),
default_bank_account_uid=getCustomParameter("default_bank_account_uid", None),
theme_logo_url=leaflet_theme.get("theme_logo_url", None)
)
......@@ -183,7 +129,7 @@ for image in re.findall('(<div class="left-icon">.*?<\/div>)', leaflet_content):
img_caption=caption_list[0]
leaflet_content = leaflet_content.replace(
image,
context.WebPage_validateImage(
leaflet.WebPage_validateImage(
img_string=image,
img_svg_format=leaflet_display_svg,
img_caption=img_caption
......@@ -214,10 +160,10 @@ if leaflet_display_side:
# leaflet_content = leaflet_content.replace(leaflet_summary[0], "")
#
# for table in re.findall('(<table.*?<\/table>)', leaflet_content):
# leaflet_content = leaflet_content.replace(table, context.WebPage_validateTable(table_string=table))
# leaflet_content = leaflet_content.replace(table, leaflet.WebPage_validateTable(table_string=table))
#
# for link in re.findall('(<a.*?<\/a>)', leaflet_content):
# leaflet_content = leaflet_content.replace(link, context.WebPage_validateLink(link_string=link, link_toc=true))
# leaflet_content = leaflet_content.replace(link, leaflet.WebPage_validateLink(link_string=link, link_toc=true))
#
# leaflet_content = leaflet_content.replace('<h2 class="summary">', '<h1>')
# leaflet_content = leaflet_content.replace('</h2>', '</h1>')
......@@ -232,8 +178,7 @@ if leaflet_display_side:
# ============================= Format: html ===================================
if leaflet_format == "html":
leaflet.REQUEST.RESPONSE.setHeader("Content-Type", "text/html;")
return leaflet.WebPage_createLeaflet(
leaflet_output = leaflet.WebPage_createLeaflet(
leaflet_theme=leaflet_theme.get("theme"),
leaflet_title=leaflet_title,
leaflet_language=leaflet_language,
......@@ -242,7 +187,7 @@ if leaflet_format == "html":
leaflet_template_css_url=leaflet_theme.get("template_css_url"),
leaflet_organisation=leaflet_source.get("organisation_title", blank),
leaflet_organisation_claim=leaflet_theme.get("theme_logo_description") or blank,
leaflet_logo_url=setUrl(leaflet_source.get("enhanced_logo_url")),
leaflet_logo_url=leaflet.Base_setUrl(path=leaflet_source.get("enhanced_logo_url")),
leaflet_copyright=leaflet_source.get("organisation_title", blank),
leaflet_full_reference=leaflet_full_reference,
leaflet_year=leaflet_year,
......@@ -253,6 +198,19 @@ if leaflet_format == "html":
leaflet_theme_logo_alt=leaflet_theme.get("theme_logo_alt"),
leaflet_css=leaflet_css,
)
return leaflet.Base_finishWebPageCreation(
doc_download=leaflet_download,
doc_save=leaflet_save,
doc_version=leaflet_version,
doc_title=leaflet_title,
doc_relative_url=leaflet_relative_url,
doc_aggregate_list=leaflet_aggregate_list,
doc_language=leaflet_language,
doc_modification_date=leaflet_modification_date,
doc_reference=leaflet_reference,
doc_full_reference=leaflet_full_reference,
doc_html_file=leaflet_output
)
# ============================= Format: pdf ====================================
if leaflet_format == "pdf":
......@@ -274,7 +232,7 @@ if leaflet_format == "pdf":
leaflet_theme_css_font_list=leaflet_theme.get("theme_css_font_list"),
leaflet_theme_css_url=leaflet_theme.get("theme_css_url"),
leaflet_template_css_url=leaflet_theme.get("template_css_url"),
leaflet_logo_url=setUrl(leaflet_source.get("enhanced_logo_url")),
leaflet_logo_url=leaflet.Base_setUrl(path=leaflet_source.get("enhanced_logo_url")),
leaflet_copyright=leaflet_source.get("organisation_title", blank),
leaflet_full_reference=leaflet_full_reference,
leaflet_year=leaflet_year,
......
......@@ -61,8 +61,8 @@ Generates the complete letter
<tal:block tal:repeat="font_url letter_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href letter_theme_css_url" />
<link rel="stylesheet" tal:attributes="href letter_template_css_url" />
</head>
<body class="ci-letter">
<tal:block metal:use-macro="context/Letter_createLetterHeader/macros/letter_header" />
......
......@@ -38,8 +38,8 @@ Generates the letter Content
<tal:block tal:repeat="font_url letter_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href letter_theme_css_url" />
<link rel="stylesheet" tal:attributes="href letter_template_css_url" />
</head>
<body class="ci-letter">
<tal:block metal:use-macro="context/Letter_createLetterContent/macros/letter_content" />
......
......@@ -41,8 +41,8 @@ Creates the Letter footer section.
<tal:block tal:repeat="font_url letter_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href letter_theme_css_url" />
<link rel="stylesheet" tal:attributes="href letter_template_css_url" />
</head>
<body class="ci-letter">
<tal:block metal:use-macro="context/Letter_createLetterFooter/macros/letter_footer" />
......
......@@ -25,8 +25,8 @@ Generates the letter header
<tal:block tal:repeat="font_url letter_theme_css_font_list">
<link rel="stylesheet" tal:attributes="href font_url" />
</tal:block>
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([letter_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href letter_theme_css_url" />
<link rel="stylesheet" tal:attributes="href letter_template_css_url" />
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
var vars={};
......
......@@ -30,66 +30,22 @@ from datetime import datetime
blank = ''
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or letter_uid
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or letter_uid
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or letter_uid
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
def setOverrideParam(my_context, my_override, my_param):
if my_override is not None and my_override is not blank:
return html_quote(my_override)
return getattr(my_context, my_param) or None
# XXX how to set checkbox correctly?
def setToNone(param):
if param == blank or param == None or param == 0 or param == str(0):
return None
else:
return param
# XXX change url so convert does not fail
def setUrl(path):
if path.find("common") > -1:
return path
else:
return path + "&display=thumbnail"
# -------------------------- Setup ---------------------------------------------
letter = context
letter_format = kw.get('format', 'html')
letter_display_source_adress = kw.get('letter_display_source_adress', None)
letter_transformation = kw.get('transformation', None)
letter_display_head = setToNone(kw.get('dislay_head', 1))
letter_display_svg = setToNone(kw.get('display_svg', 'png'))
letter_download = setToNone(kw.get('document_download', None))
letter_save = setToNone(kw.get('document_save', None))
letter_display_head = letter.Base_setToNone(param=kw.get('dislay_head', 1))
letter_display_svg = letter.Base_setToNone(param=kw.get('display_svg', 'png'))
letter_download = letter.Base_setToNone(param=kw.get('document_download', None))
letter_save = letter.Base_setToNone(param=kw.get('document_save', None))
override_source_person_title = kw.get('override_source_person_title', None)
override_source_organisation_title = kw.get("override_source_organisation_title", None)
override_destination_person_title = kw.get("override_destination_person_title", None)
override_destination_organisation_title = kw.get("override_destination_organisation_title", None)
override_date = setToNone(kw.get("override_date", None))
override_batch_mode = setToNone(kw.get('batch_mode', None))
override_date = letter.Base_setToNone(param=kw.get("override_date", None))
override_batch_mode = letter.Base_setToNone(param=kw.get('batch_mode', None))
# -------------------------- Document Parameters ------------------------------
letter_form = letter.REQUEST
......@@ -105,7 +61,7 @@ if letter_portal_type == "Web Page":
letter_title = letter.getTitle()
letter_modification_date = DateTime(override_date) if override_date else letter.getCreationDate()
letter_content = letter.getTextContent()
letter_language = setToNone(letter.getLanguage())
letter_language = letter.Base_setToNone(param=letter.getLanguage())
letter_aggregate_list = []
letter_source = None
letter_destination = None
......@@ -120,17 +76,19 @@ else:
letter_title = letter_form.get('title')
letter_content = letter_form.get('text_content')
letter_aggregate_list = letter.getAggregateList()
letter_language = setToNone(letter_form.get('select_language'))
letter_language = letter.Base_setToNone(param=letter_form.get('select_language'))
letter_source = letter_form.get('source') or None
letter_destination = letter_form.get('destination') or None
# cut corner to retrieve path to css files
portal_object = context.getPortalObject()
portal_object = letter.getPortalObject()
letter_url = portal_object.absolute_url()
letter_version = "001"
letter_reference = letter_form.get("reference")
# overrides for tests
if override_batch_mode is not None:
letter_modification_date = DateTime("1976-11-04")
if letter_language is not None: #and letter_format == "pdf":
letter.REQUEST['AcceptLanguage'].set(letter_language, 10)
if letter_language is None:
......@@ -140,21 +98,13 @@ if letter_reference is None:
letter_full_reference = '-'.join([letter_reference, letter_version, letter_language])
# --------------------------- Layout Parameters --------------------------------
letter_theme = letter.Base_getThemeDict(
custom_theme=getCustomParameter("theme", None),
override_batch_mode=override_batch_mode,
format=letter_format,
url=letter_url,
css_path="/letter_css/letter"
)
letter_theme = letter.Base_getThemeDict(format=letter_format, css_path="letter_css/letter")
# --------------------------- Source/Destination -------------------------------
letter_source = letter.Base_getSourceDict(
source=letter_source,
override_source_person_title=override_source_person_title,
override_source_organisation_title=override_source_organisation_title,
default_company_title=getCustomParameter("default_company_title", None),
default_bank_account_uid=getCustomParameter("default_bank_account_uid", None),
override_logo_reference=None,
theme_logo_url=letter_theme.get("theme_logo_url", None)
)
......@@ -170,7 +120,7 @@ letter_destination = letter.Base_getDestinationDict(
for image in re.findall('(<img.*?/>)', letter_content):
letter_content = letter_content.replace(
image,
context.WebPage_validateImage(
letter.WebPage_validateImage(
img_string=image,
img_svg_format=letter_display_svg
)
......@@ -178,8 +128,7 @@ for image in re.findall('(<img.*?/>)', letter_content):
# ============================= Format: html ===================================
if letter_format == "html":
letter.REQUEST.RESPONSE.setHeader("Content-Type", "text/html;")
return letter.Letter_createLetter(
letter_output = letter.Letter_createLetter(
letter_display_head=letter_display_head,
letter_theme=letter_theme.get("theme"),
letter_title=letter_title,
......@@ -187,7 +136,7 @@ if letter_format == "html":
letter_theme_css_font_list=letter_theme.get("theme_css_font_list"),
letter_theme_css_url=letter_theme.get("theme_css_url"),
letter_template_css_url=letter_theme.get("template_css_url"),
letter_theme_logo_url=setUrl(letter_source.get("enhanced_logo_url")),
letter_theme_logo_url=letter.Base_setUrl(path=letter_source.get("enhanced_logo_url")),
letter_theme_logo_alt=letter_theme.get("theme_logo_description"),
letter_timestamp=letter_modification_date.strftime('%Y-%m-%d'),
letter_destination_company=letter_destination.get("organisation_title", blank),
......@@ -199,8 +148,8 @@ if letter_format == "html":
letter_source_company=letter_source.get("corporate_name", letter_source.get("organisation_title", blank)),
letter_source_company_corporate_name=letter_source.get("corporate_name", blank),
letter_source_company_capital=letter_source.get("social_capital", blank),
letter_source_company_capital_currency=letter_source.get("social_capital_currency", getCustomParameter("default_source_company_capital_currency", blank)),
letter_source_registered_court=letter_source.get("registered_court", getCustomParameter("default_source_registered_court", blank)),
letter_source_company_capital_currency=letter_source.get("social_capital_currency", letter.Base_getCustomTemplateParameter("default_source_company_capital_currency")),
letter_source_registered_court=letter_source.get("registered_court", letter.Base_getCustomTemplateParameter("default_source_registered_court")),
letter_source_ape_code=letter_source.get("activity_code", blank),
letter_source_address=letter_source.get("address", blank),
letter_source_postal_code=letter_source.get("postal_code", blank),
......@@ -218,6 +167,19 @@ if letter_format == "html":
letter_source_bic=letter_source.get("bic", blank),
letter_source_iban=letter_source.get("iban", blank)
)
return letter.Base_finishWebPageCreation(
doc_download=letter_download,
doc_save=letter_save,
doc_version=letter_version,
doc_title=letter_title,
doc_relative_url=letter_relative_url,
doc_aggregate_list=letter_aggregate_list,
doc_language=letter_language,
doc_modification_date=letter_modification_date,
doc_reference=letter_reference,
doc_full_reference=letter_full_reference,
doc_html_file=letter_output
)
# ============================= Format: pdf ====================================
if letter_format == "pdf":
......@@ -229,7 +191,7 @@ if letter_format == "pdf":
letter_theme_css_font_list=letter_theme.get("theme_css_font_list"),
letter_theme_css_url=letter_theme.get("theme_css_url"),
letter_template_css_url=letter_theme.get("template_css_url"),
letter_theme_logo_url=setUrl(letter_source.get("enhanced_logo_url")),
letter_theme_logo_url=letter.Base_setUrl(path=letter_source.get("enhanced_logo_url")),
letter_theme_logo_alt=letter_theme.get("theme_logo_description"),
letter_timestamp=letter_modification_date.strftime('%Y-%m-%d'),
letter_source_city=letter_source.get("city", blank)
......@@ -243,7 +205,7 @@ if letter_format == "pdf":
letter_theme_css_font_list=letter_theme.get("theme_css_font_list"),
letter_theme_css_url=letter_theme.get("theme_css_url"),
letter_template_css_url=letter_theme.get("template_css_url"),
letter_theme_logo_url=setUrl(letter_source.get("enhanced_logo_url")),
letter_theme_logo_url=letter.Base_setUrl(path=letter_source.get("enhanced_logo_url")),
letter_theme_logo_alt=letter_theme.get("theme_logo_description"),
letter_timestamp=letter_modification_date.strftime('%Y-%m-%d'),
letter_destination_company=letter_destination.get("organisation_title", blank),
......@@ -271,8 +233,8 @@ if letter_format == "pdf":
letter_source_company=letter_source.get("organisation_title", blank),
letter_source_company_corporate_name=letter_source.get("corporate_name", blank),
letter_source_company_capital=letter_source.get("social_capital", blank),
letter_source_company_capital_currency=letter_source.get("social_capital_currency", getCustomParameter("default_source_company_capital_currency", blank)),
letter_source_registered_court=letter_source.get("registered_court", getCustomParameter("default_source_registered_court", blank)),
letter_source_company_capital_currency=letter_source.get("social_capital_currency", letter.Base_getCustomTemplateParameter("default_source_company_capital_currency")),
letter_source_registered_court=letter_source.get("registered_court", letter.Base_getCustomTemplateParameter("default_source_registered_court")),
letter_source_ape_code=letter_source.get("activity_code", blank),
letter_source_address=letter_source.get("address", blank),
letter_source_postal_code=letter_source.get("postal_code", blank),
......
......@@ -33,8 +33,8 @@ Generates the complete slideshow
</tal:block>
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href doc_theme_css_url" />
<link rel="stylesheet" tal:attributes="href doc_template_css_url" />
<style type="text/css" tal:content="structure doc_css"></style>
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
......
......@@ -27,8 +27,8 @@ Creates the Slideshow content section.
</tal:block>
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href doc_theme_css_url" />
<link rel="stylesheet" tal:attributes="href doc_template_css_url" />
</head>
<body class="ci-slideshow">
<tal:block metal:use-macro="context/WebPage_createSlideshowContent/macros/slide_content" />
......
......@@ -27,8 +27,8 @@ Creates the Slideshow cover section.
</tal:block>
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href doc_theme_css_url" />
<link rel="stylesheet" tal:attributes="href doc_template_css_url" />
<style type="text/css" tal:content="doc_css"></style>
</head>
<body class="ci-slideshow">
......
......@@ -32,8 +32,8 @@ Creates the Slideshow footer section.
</tal:block>
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: doc_theme_css_url" />
<link rel="stylesheet" tal:attributes="href python: doc_template_css_url" />
<style type="text/css" tal:content="structure doc_css"></style>
<script type="text/javascript">
function setPlaceholdersWithUrlParameters() {
......
......@@ -27,8 +27,8 @@ Creates the Slideshow note section.
</tal:block>
<link rel="stylesheet" href="slide_css/white_theme.custom.css" id="theme" />
<link rel="stylesheet" href="slide_css/zenburn.css" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_theme_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href python: ''.join([doc_template_css_url, ''])" />
<link rel="stylesheet" tal:attributes="href doc_theme_css_url" />
<link rel="stylesheet" tal:attributes="href doc_template_css_url" />
</head>
<body class="ci-slideshow-handout">
<tal:block metal:use-macro="context/WebPage_createSlideshowNotes/macros/slide_notes" />
......
......@@ -27,30 +27,6 @@ from base64 import b64encode
blank = ''
# -------------------------- External parameters ------------------------------
# eg "Nexedi" specific parameters
customHandler = getattr(context, "WebPage_getCustomParameter", None)
# parameters common to all templates
commonHandler = getattr(context, "WebPage_getCommonParameter", None)
commonProxyHandler = getattr(context, "WebPage_getCommonProxyParameter", None)
def getCustomParameter(my_parameter, my_override_data):
if customHandler is not None:
source_data = my_override_data or doc_uid
return customHandler(parameter=my_parameter, source_data=source_data)
def getCommonParameter(my_parameter, my_override_data):
if commonHandler is not None:
source_data = my_override_data or doc_uid
return commonHandler(parameter=my_parameter, source_data=source_data)
def getCommonProxyParameter(my_parameter, my_override_data):
if commonProxyHandler is not None:
source_data = my_override_data or doc_uid
return commonProxyHandler(parameter=my_parameter, source_data=source_data)
# ------------------ HTML cleanup/converter methods ----------------------------
def getSlideList(my_content):
return re.findall(r'<section[^>]*?>(.*?)</section>', my_content, re.S)
......@@ -149,25 +125,6 @@ def sortContent(my_page_list):
except Exception as e:
raise e
def setOverrideParam(my_context, my_override, my_param):
if my_override is not None and my_override is not blank:
return html_quote(my_override)
return getattr(my_context, my_param) or None
# XXX how to set checkbox correctly?
def setToNone(param):
if param == blank or param == None or param == 0 or param == str(0):
return None
else:
return param
# XXX change url so convert does not fail
def setUrl(path):
if path.find("common") > -1:
return path
else:
return path + "&display=thumbnail"
# -------------------------- Setup ---------------------------------------------
doc = context
doc_prefix = "Slideshow."
......@@ -176,15 +133,15 @@ doc_uid = doc.getUid()
doc_url = doc.getAbsoluteUrl()
doc_format = kw.get('format', 'html')
doc_transformation = kw.get('transformation', None)
doc_display_notes = setToNone(kw.get('display_note', None))
doc_display_svg = setToNone(kw.get('display_svg', 'png'))
doc_download = setToNone(kw.get('document_download', None))
doc_save = setToNone(kw.get('document_save', None))
doc_ooo = setToNone(kw.get('flag_ooo', None))
doc_display_notes = doc.Base_setToNone(param=kw.get('display_note', None))
doc_display_svg = doc.Base_setToNone(param=kw.get('display_svg', 'png'))
doc_download = doc.Base_setToNone(param=kw.get('document_download', None))
doc_save = doc.Base_setToNone(param=kw.get('document_save', None))
doc_ooo = doc.Base_setToNone(param=kw.get('flag_ooo', None))
override_logo_reference = kw.get('override_logo_reference', None)
override_source_organisation_title = kw.get("override_source_organisation_title", None)
override_batch_mode = setToNone(kw.get('batch_mode', None))
override_batch_mode = doc.Base_setToNone(param=kw.get('batch_mode', None))
override_source_person_title = None
# ---------- backward compatability with legacy odp/sxi presentations ----------
......@@ -194,9 +151,9 @@ if doc_ooo is not None:
if doc.getPortalType() in ["Presentation"]:
raw_data = doc_portal.portal_transforms.convertToData(
"text/html",
str(context.getData() or blank),
str(doc.getData() or blank),
context=context,
mimetype=context.getContentType()
mimetype=doc.getContentType()
)
if raw_data is None:
raise ValueError("Failed to convert to %r" % "text/html")
......@@ -224,7 +181,7 @@ doc_uid = doc.getUid()
doc_dirty_content = doc_converted_content or doc.getTextContent()
doc_content = removeEmptyDetails(doc_dirty_content)
doc_title = doc.getTitle()
doc_language = setToNone(doc.getLanguage())
doc_language = doc.Base_setToNone(param=doc.getLanguage())
doc_description = doc.getDescription()
doc_creation_year = doc.getCreationDate().strftime('%Y')
doc_version = doc.getVersion() or "001"
......@@ -245,13 +202,7 @@ if doc_reference is None:
doc_full_reference = '-'.join([doc_reference, doc_version, doc_language])
# --------------------------- Layout Parameters --------------------------------
doc_theme = doc.Base_getThemeDict(
custom_theme=getCustomParameter("theme", None),
override_batch_mode=override_batch_mode,
format=doc_format,
url=doc_url,
css_path="/slide_css/slide"
)
doc_theme = doc.Base_getThemeDict(format=doc_format, css_path="slide_css/slide")
doc_css = ''.join(['.ci-slideshow-intro.present:not(.slide-background):before {',
'content: "%s";' % (doc_theme.get("theme_logo_description")),
'background: #FFF url("%s") center no-repeat;' % (doc_theme.get("theme_logo_url")),
......@@ -263,24 +214,14 @@ doc_source = doc.Base_getSourceDict(
override_source_person_title=override_source_person_title,
override_source_organisation_title=override_source_organisation_title,
override_logo_reference=override_logo_reference,
default_company_title=getCustomParameter("default_company_title", None),
default_bank_account_uid=getCustomParameter("default_bank_account_uid", None),
theme_logo_url=doc_theme.get("theme_logo_url", None)
)
#if doc_source.get("enhanced_logo_url") is not blank:
# doc_css = ''.join([
# doc_css,
# ' .ci-slideshow-footer-logo {',
# 'background: #FFF url("%s") center no-repeat;' % (doc_source.get("enhanced_logo_url")),
# 'background-size: 100px auto;',
# '}'
# ])
# --------------------------- Content Upgrades ---------------------------------
for image in re.findall('(<img.*?/>)', doc_content):
doc_content = doc_content.replace(
image,
context.WebPage_validateImage(
doc.WebPage_validateImage(
img_string=image,
img_svg_format=doc_display_svg
)
......@@ -301,15 +242,15 @@ for image in re.findall('(<img.*?/>)', doc_content):
# mod_slide = removeEmptyDetails(slide)
# mod_slide = removeDetailTags(mod_slide)
# if slide.find('class="chapter"') == -1:
# mod_slide = context.WebPage_downgradeHeaders(mod_slide, 1)
# mod_slide = doc.WebPage_downgradeHeaders(mod_slide, 1)
# mod_slide = removeSectionTags(mod_slide)
# doc_content = doc_content.replace(slide, mod_slide)
#
# for table in re.findall('(<table.*?<\/table>)', doc_content):
# doc_content = doc_content.replace(table, context.WebPage_validateTable(table_string=table))
# doc_content = doc_content.replace(table, doc.WebPage_validateTable(table_string=table))
#
# for link in re.findall('(<a.*?<\/a>)', document_content):
# doc_content = doc_content.replace(link, context.WebPage_validateLink(link_string=link, link_toc=true))
# doc_content = doc_content.replace(link, doc.WebPage_validateLink(link_string=link, link_toc=true))
#
# ------------- backwards compatability with old slideshow ---------------------
......@@ -330,8 +271,7 @@ if getDetails(doc_content) > -1:
# ======================== Format: html/mhtml ==================================
if doc_format == "html" or doc_format == "mhtml":
doc.REQUEST.RESPONSE.setHeader("Content-Type", "text/html;")
doc_output = context.WebPage_createSlideshow(
doc_output = doc.WebPage_createSlideshow(
doc_format=doc_format,
doc_theme=doc_theme.get("theme"),
doc_title=doc_title,
......@@ -339,7 +279,7 @@ if doc_format == "html" or doc_format == "mhtml":
doc_template_css_url=doc_theme.get("template_css_url"),
doc_theme_css_font_list=doc_theme.get("theme_css_font_list"),
doc_theme_css_url=doc_theme.get("theme_css_url"),
doc_footer_url=setUrl(doc_source.get("enhanced_logo_url")),
doc_footer_url=doc.Base_setUrl(path=doc_source.get("enhanced_logo_url")),
doc_description=doc_description,
doc_creation_year=doc_creation_year,
doc_copyright=doc_source.get("organisation_title", blank),
......@@ -348,13 +288,26 @@ if doc_format == "html" or doc_format == "mhtml":
doc_content=doc_content
)
if doc_format == "html":
return doc_output
return doc.Base_finishWebPageCreation(
doc_download=doc_download,
doc_save=doc_save,
doc_version=doc_version,
doc_title=doc_title,
doc_relative_url=doc_relative_url,
doc_aggregate_list=doc_aggregate_list,
doc_language=doc_language,
doc_modification_date=doc_modification_date,
doc_reference=doc_reference,
doc_full_reference=doc_full_reference,
doc_html_file=doc_output
)
if doc_format == "mhtml":
context.REQUEST.RESPONSE.setHeader("Content-Type", "text/html;")
return doc.Base_convertHtmlToSingleFile(doc_output, allow_script=True)
# ============================= Format: pdf ====================================
if doc_format == "pdf":
doc_slideshow_footer = context.WebPage_createSlideshowFooter(
doc_slideshow_footer = doc.WebPage_createSlideshowFooter(
doc_format=doc_format,
doc_theme=doc_theme.get("theme"),
doc_title=doc_title,
......@@ -362,14 +315,14 @@ if doc_format == "pdf":
doc_template_css_url=doc_theme.get("template_css_url"),
doc_theme_css_font_list=doc_theme.get("theme_css_font_list"),
doc_theme_css_url=doc_theme.get("theme_css_url"),
doc_footer_url=setUrl(doc_source.get("enhanced_logo_url")),
doc_footer_url=doc.Base_setUrl(path=doc_source.get("enhanced_logo_url")),
doc_description=doc_description,
doc_creation_year=doc_creation_year,
doc_copyright=doc_source.get("organisation_title", blank),
doc_author_list=doc_source.get("contributor_title_string"),
doc_css=doc_css
)
doc_slideshow_cover = context.WebPage_createSlideshowCover(
doc_slideshow_cover = doc.WebPage_createSlideshowCover(
doc_format=doc_format,
doc_theme=doc_theme.get("theme"),
doc_title=doc_title,
......@@ -383,7 +336,7 @@ if doc_format == "pdf":
# outputting just the content requires to drop wrapping <divs> (reveal/slides)
# and add extra css to recreate the same layout. so a separate output=content
# instead of defaulting to None
doc_slideshow_content = context.WebPage_createSlideshowContent(
doc_slideshow_content = doc.WebPage_createSlideshowContent(
doc_format=doc_format,
doc_theme=doc_theme.get("theme"),
doc_title=doc_title,
......@@ -394,7 +347,7 @@ if doc_format == "pdf":
doc_content=doc_content
)
if doc_display_notes:
doc_slideshow_notes = context.WebPage_createSlideshowNotes(
doc_slideshow_notes = doc.WebPage_createSlideshowNotes(
doc_format=doc_format,
doc_theme=doc_theme.get("theme"),
doc_title=doc_title,
......@@ -418,7 +371,7 @@ if doc_format == "pdf":
else:
after_body_data_list = []
pdf_file = context.Base_cloudoooDocumentConvert(embedded_html_data, "html", "pdf", conversion_kw=dict(
pdf_file = doc.Base_cloudoooDocumentConvert(embedded_html_data, "html", "pdf", conversion_kw=dict(
encoding="utf8",
orientation="landscape",
margin_top=12,
......
......@@ -7,5 +7,5 @@ person_module/template_test*
person_module/template_test*/default**
portal_preferences/default_site_preference/template_*
web_page_module/template_test_*
portal_tests/template_zuite
portal_tests/template_zuite/testAndUpdateTest*
\ No newline at end of file
portal_tests/template_test_zuite
portal_tests/template_test_zuite/testAndUpdateTest*
\ No newline at end of file
......@@ -6,6 +6,6 @@ organisation_module/template_test*/default**
person_module/template_test*
person_module/template_test*/default**
portal_preferences/default_site_preference/template_*
portal_tests/template_zuite
portal_tests/template_zuite/testAndUpdateTest*
portal_tests/template_test_zuite
portal_tests/template_test_zuite/testAndUpdateTest*
web_page_module/template_test_*
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment