Commit 6dce55b0 authored by Jérome Perrin's avatar Jérome Perrin

dms: drop PDF thumbnail view

Since 7f32f8cd (erp5_dms: Add PDF Reader using the pdf.js, 2016-06-24)
we have a PDF preview with a javascript PDF view, which is much better way
of viewing PDF.

This commit made the Thumbnail preview obsolete, also it does not really
work on ERP5JS, so remove the thumbnail preview.
parent 685810c3
Pipeline #15801 failed with stage
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>html_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>32.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Thumbnails</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/PDF_viewHTMLPreviewAsThumbnailList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
content_information = context.getContentInformation()
page_number = int(content_information.get('Pages', 0))
return [[page_number]]
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_countThumbnailList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
content_information = context.getContentInformation()
number_of_pages = int(content_information.get('Pages', 1))
max_ = number_of_pages - 1
selection_index = int(selection_index)
if selection_index > max_:
return max_
elif -max_ > selection_index:
return 0
elif selection_index < 0:
return max_ + selection_index + 1
else:
return selection_index
<?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>selection_index</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_getPageNumberFromSelectionIndex</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
THis script returns a suitable slide list of PDF thumbnails
for current form selection.
It's to be used in a listbox.
"""
from Products.ERP5Type.Document import newTempBase
content_information = context.getContentInformation()
page_number = int(content_information.get('Pages', 0))
limit = kw.get('limit', (0, 0))
list_start = int(kw.get('list_start', 0))
list_lines = int(kw.get('list_lines', 0))
size = list_lines or limit[1]
list_end = list_start + size
page_list = range(page_number)
result = []
for i in page_list[list_start:list_end]:
x = {'title': '%s' %i,
'frame':'%s' %i} # frame is used by listbox render field
temp_object = newTempBase(context, x['title'], **x)
result.append(temp_object)
return result
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_getThumbnailList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_renderHTMLPreviewAsImage</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<div class="pdf-preview-content"
tal:define="frame request/frame|
python:here.PDF_getPageNumberFromSelectionIndex(request.get('selection_index', 0));
display python: request.get('display', context.portal_preferences.getPreference('preferred_image_size', 'large'));
format python: request.get('format', context.portal_preferences.getPreference('preferred_image_format', 'png'))">
<img src="" alt="" style="background-color:white;"
tal:attributes="src
string:${here/absolute_url}/index_html?display=${display}&format=${format}&frame=${frame}"/>
</div>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_renderHTMLPreviewNavigation</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:replace="nothing">
<!--
XXX: PDF pagination should be similar to OOo one (using iframe). This part should also be async ideally
-->
</tal:block>
<tal:block tal:define="current_thumbnail_index
request/frame|
python:here.PDF_getPageNumberFromSelectionIndex(request.get('selection_index', 0));
all_thunmbnails python: here.PDF_countThumbnailList()[0][0];
next_thunmbnail_index python: current_thumbnail_index + 1;
previous_thunmbnail_index python: current_thumbnail_index - 1;
parent_doc_url here/absolute_url;
base_url python: '%s/%s' % (parent_doc_url, request.get('current_form_id', 'view'));
hide_left_side_links python: not current_thumbnail_index >= 1;
hide_right_side_links python: not all_thunmbnails > next_thunmbnail_index;">
<div class="pdf-preview-navigation">
<a tal:omit-tag="hide_left_side_links"
tal:attributes="href string:${base_url}?selection_index=0">
<img src="images/transparent-image.gif"
i18n:attributes="alt; title"
i18n:domain="ui"
alt="First"
title="First"
class="first"
tal:attributes="class python: test(hide_left_side_links, 'first shaded', 'first')"/>
</a>
<a tal:omit-tag="hide_left_side_links"
tal:attributes="href string:${base_url}?selection_index=${previous_thunmbnail_index}">
<img src="images/transparent-image.gif"
i18n:attributes="alt; title"
i18n:domain="ui"
alt="Previous"
title="Previous"
class="previous"
tal:attributes="class python: test(hide_left_side_links, 'previous shaded', 'previous')"/>
</a>
<!-- Current Thumbnail / Total Thumbnails -->
<input name="pdf_selection_index"
size="1"
tal:attributes="value python:current_thumbnail_index+1"
onkeypress="return redirectPDFPage(event, this)"/>
/ <span tal:content="all_thunmbnails"/>
<a tal:omit-tag="hide_right_side_links"
tal:attributes="href string:${base_url}?selection_index=${next_thunmbnail_index}">
<img src="images/transparent-image.gif"
i18n:attributes="alt; title"
i18n:domain="ui"
alt="Next"
title="Next"
class="next"
tal:attributes="class python: test(hide_right_side_links, 'next shaded', 'next')"/>
</a>
<a tal:omit-tag="hide_right_side_links"
tal:attributes="href string:${base_url}?selection_index=${all_thunmbnails}">
<img src="images/transparent-image.gif"
i18n:attributes="alt; title"
i18n:domain="ui"
alt="Last"
title="Last"
class="last"
tal:attributes="class python: test(hide_right_side_links, 'last shaded', 'last')"/>
</a>
</div>
</tal:block>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_renderHTMLThumbnailPreview</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block
tal:define="cell python: request.get('cell');
frame python: cell.frame;
display python: request.get('display', 'thumbnail');
format python: request.get('format',
context.portal_preferences.getPreference('preferred_image_format', 'png'))">
<a tal:attributes="href string:PDF_viewHTMLPreviewAsImage?selection_index=${frame}">
<img title="Thumbnail" style="background-color:white;"
i18n:attributes="title" i18n:domain="ui"
tal:attributes="src string:index_html?display=${display}&format=${format}&frame=${frame}"/>
</a>
</tal:block>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>navigation</string>
<string>body</string>
<string>download_pdf</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_viewHTMLPreviewAsImage</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>PDF_viewHTMLPreviewAsImage</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>PDF</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</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"><span>%(title)s</span></button>\' % {\'title\':here.Base_translateString("Download as PDF")}
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_thumbnail</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PDF_viewHTMLPreviewAsThumbnailList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>PDF_viewHTMLPreview</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Thumbnails</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -53,7 +53,6 @@ Image | related_document
Image | version_view
PDF | download
PDF | file_upload
PDF | html_view
PDF | jump_to_all_related
PDF | jump_to_predecessor
PDF | jump_to_similar
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testCheckPDFThumbnail</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>testCheckPDFThumbnail</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testCheckPDFThumbnail</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/KMZuite_CommonTemplate/macros/createKMWebSite" />
<tr>
<td>openAndWait</td>
<td>${base_url}/web_site_module/km_test_web_site</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=New Document</td>
<td></td>
</tr>
<tr>
<td>setFile</td>
<td>field_your_file</td>
<td>${base_url}/functional_test_data_folder/tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF-001-en.pdf tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF-001-en.pdf</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>successfully</td>
<td></td>
</tr>
<tr>
<td>storeAttribute</td>
<td>//ul[@class="breadcrumb"]//li[3]/a@href</td>
<td>file_url</td>
</tr>
<span metal:use-macro="container/Zuite_CommonTemplate/macros/wait_for_activities"> Wait for activities</span>
<tr>
<td>openAndWait</td>
<td>${file_url}?editable_mode:int=1</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>PDF</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_title</td>
<td>TioLive, ERP5, Freedom</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_reference</td>
<td>tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_version</td>
<td>001</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_language</td>
<td>en</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF-001-en.pdf</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>PDF</td>
<td></td>
</tr>
<!-- Check PDF thumbnail preview works -->
<tr>
<td>clickAndWait</td>
<td>link=Thumbnails</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-start-number"]</td>
<td>1</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-stop-number"]</td>
<td>10</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>16 records</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@title='Thumbnail']</td>
<td></td>
</tr>
<!-- Check PDF thumbnail preview navigation-->
<tr>
<td>clickAndWait</td>
<td>//button[@class="listbox_next_page"]</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-start-number"]</td>
<td>11</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-stop-number"]</td>
<td>16</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>16 records</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@title='Thumbnail']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//button[@class="listbox_previous_page"]</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-start-number"]</td>
<td>1</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-stop-number"]</td>
<td>10</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>16 records</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@title='Thumbnail']</td>
<td></td>
</tr>
<!-- Go to PDF default big preview -->
<tr>
<td>clickAndWait</td>
<td>//tr[@class="listbox-data-line-1 DataB"]/td/div/a/img[@title='Thumbnail']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>2</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@alt='First']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@alt='Previous']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@alt='Next']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@alt='Last']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[@class='pdf-preview-content']/img</td>
<td></td>
</tr>
<!-- Check if PDF thumbnail navigation works -->
<tr>
<td>clickAndWait</td>
<td>//img[@alt='Next']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>3</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='First']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>1</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='Last']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>16</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='First']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>1</td>
</tr>
<!-- Type in test -->
<tr>
<td>type</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>5</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>\13</td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>5</td>
</tr>
<tal:block metal:use-macro="here/KMZuite_CommonTemplate/macros/deleteKMWebSite" />
</tbody></table>
</body>
</html>
\ No newline at end of file
  • mentioned in commit 22ee9f29

    Toggle commit list
  • mentioned in merge request !1610 (merged)

    Toggle commit list
  • mentioned in commit 428833f3

    Toggle commit list
  • @jerome I notice there is still a caller in current master here

    This seems to me bogus, why would Event_renderHTMLPreviewAsImage call this? Should that line be removed or fixed somehow?

  • Thanks @georgios.dagkakis I did not notice. I guess this was for example for ingested emails with PDF attachments to show a preview of the PDF.

    Did you notice because some feature is broken or just because of a traceback in the log when displaying this tab ? if I change this line by

         tal:define="frame request/frame | python: 1;

    it's another error

      File "Script (Python)", line 28, in Base_createMailMessageAsString
        mime_type, content = embedded_file.getMimeTypeAndContent()
      File "<portal_components/document.erp5.File>", line 212, in getMimeTypeAndContent
        raise ValueError('Cannot find mimetype of the document.')
    ValueError: Cannot find mimetype of the document.

    but after trying a bit it seems to be used to display an image preview of the attachment.

    The minimum we could do is to change to remove Event_renderHTMLPreviewAsImage and use 1 instead. Please let me know if you noticed something broken, if not I will just do this (unless you are willing to do it ?)

  • Did you notice because some feature is broken or just because of a traceback in the log when displaying this tab ?

    I just noticed the log, nothing visible for the user

    The minimum we could do is to change to remove Event_renderHTMLPreviewAsImage and use 1 instead. Please let me know if you noticed something broken, if not I will just do this (unless you are willing to do it ?)

    Yes, I think we can do this, feel free to proceed

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