Commit 9f7469b1 authored by Mame Coumba Sall's avatar Mame Coumba Sall

2009-03-20 mame

* create smalll preview for message attachments.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26124 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ea8ee53b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
</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>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<div class="pdf-preview-content" \n
tal:define="frame request/frame| python:here.PDF_getPageNumberFromSelectionIndex(request.get(\'selection_index\', 0));\n
display request/display|string:small;\n
format request/format|string:jpg;"> \n
<p tal:repeat="image_list python: here.Event_getAttachmentList()">\n
<img src="" \n
tal:attributes="src string:${image_list/absolute_url}/index_html?display=${display}&format=${format}&frame=${frame}&resolution:int=200">\n
</p>\n
</div>
]]></string> </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>Attachment_renderHTMLPreviewAsImage</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</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>_body</string> </key>
<value> <string>from Products.ZSQLCatalog.SQLCatalog import ComplexQuery\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
from string import zfill\n
global result_list\n
global uid\n
uid = 0\n
result_list = []\n
\n
# Get the list of attachments\n
attachment_pdf_list=[]\n
current_object = context.getObject()\n
\n
attachment_list = current_object.getAggregateValueList()\n
attachment_pdf_list.extend(filter(lambda x:(x.getPortalType() in [\'PDF\',\'Image\']),attachment_list))\n
\n
\n
attachment_pdf_uid_list =[x.getUid() for x in attachment_pdf_list]\n
\n
if not attachment_pdf_uid_list :\n
return []\n
\n
# Build query\n
\n
query = ComplexQuery(\n
Query(parent_uid=current_object.getUid()),\n
Query(uid=attachment_pdf_uid_list),\n
operator="OR")\n
\n
\n
kw[\'portal_type\'] = (\'PDF\',\'Image\')\n
result_uid = [x.getUid() for x in context.portal_catalog(parent_uid = current_object.getUid(),query=query, **kw)]\n
\n
result_document = [x.getObject() for x in current_object.portal_catalog(query=query, **kw)]\n
return result_document\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>lines_num=8, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>lines_num</string>
<string>kw</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>ComplexQuery</string>
<string>Query</string>
<string>string</string>
<string>zfill</string>
<string>uid</string>
<string>result_list</string>
<string>attachment_pdf_list</string>
<string>_getattr_</string>
<string>context</string>
<string>current_object</string>
<string>attachment_list</string>
<string>filter</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>attachment_pdf_uid_list</string>
<string>query</string>
<string>_write_</string>
<string>_apply_</string>
<string>result_uid</string>
<string>result_document</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>8</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getAttachmentList</string> </value>
</item>
<item>
<key> <string>isIndexable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -70,6 +70,7 @@
<value>
<list>
<string>text_content</string>
<string>my_thumbnail</string>
</list>
</value>
</item>
......
350
\ No newline at end of file
353
\ 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