Commit 7eab843f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* use PDF_viewHTMLPreviewAsImage for web_view of PDF documents, that also...

* use PDF_viewHTMLPreviewAsImage for web_view of PDF documents, that also supports page navigations.
* add 'download as PDF' button.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28544 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 06ba6fcd
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/WebPage_viewAsWeb</string> </value> <value> <string>string:${object_url}/PDF_viewHTMLPreviewAsImage</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
tal:define="frame request/frame|\n tal:define="frame request/frame|\n
python:here.PDF_getPageNumberFromSelectionIndex(request.get(\'selection_index\', 0));\n python:here.PDF_getPageNumberFromSelectionIndex(request.get(\'selection_index\', 0));\n
display request/display|string:large;\n display request/display|string:large;\n
format request/format|string:jpg;">\n format request/format|string:png;">\n
<img src="" \n <img src="" style="margin:0pt 5%;width:90%;"\n
tal:attributes="src\n tal:attributes="src\n
string:${here/absolute_url}/index_html?display=${display}&format=${format}&frame=${frame}&resolution:int=200">\n string:${here/absolute_url}/index_html?display=${display}&format=${format}&frame=${frame}&resolution:int=200">\n
</div> </div>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<tal:block tal:define="current_thumbnail_index \n <tal:block tal:define="current_thumbnail_index \n
request/frame|\n request/frame|\n
python:here.PDF_getPageNumberFromSelectionIndex(request.get(\'selection_index\', 0));\n python:here.PDF_getPageNumberFromSelectionIndex(request.get(\'selection_index\', 0));\n
selection_name request/selection_name;\n selection_name request/selection_name | string:pdf_preview_selection;\n
all_thunmbnails python: here.PDF_countThumbnailList()[0][0];\n all_thunmbnails python: here.PDF_countThumbnailList()[0][0];\n
next_thunmbnail_index python: current_thumbnail_index + 1;\n next_thunmbnail_index python: current_thumbnail_index + 1;\n
previous_thunmbnail_index python: current_thumbnail_index - 1;\n previous_thunmbnail_index python: current_thumbnail_index - 1;\n
...@@ -51,12 +51,7 @@ ...@@ -51,12 +51,7 @@
${parent_doc_url}/PDF_viewHTMLPreviewAsImage?selection_name=${selection_name}&;">\n ${parent_doc_url}/PDF_viewHTMLPreviewAsImage?selection_name=${selection_name}&;">\n
\n \n
<div class="pdf-preview-navigation">\n <div class="pdf-preview-navigation">\n
<!--\n <tal:block tal:condition="python:current_thumbnail_index >= 1">\n
<span i18n:translate=""\n
i18n:domain="ui">Thumbnail</span>: \n
<span tal:content="current_thumbnail_index"/> of <span tal:content="all_thunmbnails"/>\n
-->\n
\n
<a href=""\n <a href=""\n
tal:attributes="href string:${base_url}selection_index=0">\n tal:attributes="href string:${base_url}selection_index=0">\n
<img src="images/2leftarrowb.png" \n <img src="images/2leftarrowb.png" \n
...@@ -64,31 +59,33 @@ ...@@ -64,31 +59,33 @@
i18n:domain="ui"\n i18n:domain="ui"\n
alt="First"/>\n alt="First"/>\n
</a>\n </a>\n
\n
<a href=""\n <a href=""\n
tal:condition="python: current_thumbnail_index >= 1"\n
tal:attributes="href string:${base_url}selection_index=${previous_thunmbnail_index}">\n tal:attributes="href string:${base_url}selection_index=${previous_thunmbnail_index}">\n
<img src="images/1leftarrowb.png" \n <img src="images/1leftarrowb.png" \n
i18n:attributes="alt"\n i18n:attributes="alt"\n
i18n:domain="ui"\n i18n:domain="ui"\n
alt="Previous"/>\n alt="Previous"/>\n
</a>\n </a>\n
\n </tal:block>\n
<a href=""\n <tal:block tal:condition="python:current_thumbnail_index < 1">\n
style="font-weight: bold;vertical-align:top;"\n <img src="images/2leftarrowb.png" style="opacity:0.2"\n
i18n:translate=""\n i18n:attributes="alt"\n
i18n:domain="ui"\n i18n:domain="ui"\n
tal:attributes="href string:${parent_doc_url}/view">Exit Preview</a>\n alt="First"/>\n
\n <img src="images/1leftarrowb.png" style="opacity:0.2"\n
i18n:attributes="alt"\n
i18n:domain="ui"\n
alt="Previous"/>\n
</tal:block>\n
<span tal:content="python:current_thumbnail_index+1"/> / <span tal:content="all_thunmbnails"/>\n
<tal:block tal:condition="python:all_thunmbnails > next_thunmbnail_index">\n
<a href=""\n <a href=""\n
tal:condition="python: all_thunmbnails > next_thunmbnail_index"\n
tal:attributes="href string:${base_url}selection_index=${next_thunmbnail_index}">\n tal:attributes="href string:${base_url}selection_index=${next_thunmbnail_index}">\n
<img src="images/1rightarrowb.png" \n <img src="images/1rightarrowb.png" \n
i18n:attributes="alt"\n i18n:attributes="alt"\n
i18n:domain="ui"\n i18n:domain="ui"\n
alt="Next"/>\n alt="Next"/>\n
</a>\n </a>\n
\n
<a href=""\n <a href=""\n
tal:attributes="href string:${base_url}selection_index=${all_thunmbnails}">\n tal:attributes="href string:${base_url}selection_index=${all_thunmbnails}">\n
<img src="images/2rightarrowb.png" \n <img src="images/2rightarrowb.png" \n
...@@ -96,8 +93,17 @@ ...@@ -96,8 +93,17 @@
i18n:domain="ui"\n i18n:domain="ui"\n
alt="Last"/>\n alt="Last"/>\n
</a>\n </a>\n
\n </tal:block>\n
\n <tal:block tal:condition="python:all_thunmbnails <= next_thunmbnail_index">\n
<img src="images/1rightarrowb.png" style="opacity:0.1"\n
i18n:attributes="alt"\n
i18n:domain="ui"\n
alt="Next"/>\n
<img src="images/2rightarrowb.png" style="opacity:0.1"\n
i18n:attributes="alt"\n
i18n:domain="ui"\n
alt="Last"/>\n
</tal:block>\n
</div>\n </div>\n
</tal:block> </tal:block>
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<list> <list>
<string>navigation</string> <string>navigation</string>
<string>body</string> <string>body</string>
<string>download_pdf</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>download_pdf</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>download_pdf</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>OOoDocument_viewAsWeb</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python:\'<button class="bt-med right" name="Base_download:method" title="%(title)s" alt="%(title)s"><span>%(title)s</span></button>\' % {\'title\':here.Base_translateString("Download as PDF")}
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>body</string> </value> <value> <string>Navigation</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
......
1006 1007
\ No newline at end of file \ 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