Commit cc121168 authored by Pere Cortes's avatar Pere Cortes Committed by Sebastien Robin

fixed some errors in bt5 erp5_safeimage

parent 6b2b6537
<module>
<id>image_module</id>
<permission_list>
<permission type='tuple'>
<name>Access Transient Objects</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Access contents information</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Access session data</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Add portal content</name>
<role>Assignor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Add portal folders</name>
<role>Assignor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Change local roles</name>
<role>Assignor</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Copy or Move</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Delete objects</name>
<role>Assignor</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>List folder contents</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>Modify portal content</name>
<role>Assignor</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>View</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Manager</role>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
<role>Assignor</role>
<role>Associate</role>
<role>Auditor</role>
<role>Author</role>
<role>Manager</role>
</permission>
</permission_list>
<portal_type>Image Module</portal_type>
<title>Images</title>
</module>
\ No newline at end of file
<allowed_content_type_list>
<portal_type id="Image Module">
<item>Image</item>
<item>Image Tile</item>
<item>Image Tile Transformed</item>
</portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>file_icon.gif</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Image</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>An embedded file (which can act as an image as well).</string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addImage</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple>
<string>embedded_document</string>
<string>file_document</string>
<string>my_document</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Embedded File</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Embedded File</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>EmbeddedFile</string> </value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Type.TranslationProviderBase</string>
<string>TranslationInformation</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Type.TranslationProviderBase</string>
<string>TranslationInformation</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>folder_icon.gif</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Folder</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This module provides a single access to all images stored in an ERP5 system.</string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addFolder</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple>
<string>module</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Image Module</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>Folder</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>image_icon.png</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Image</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Image type documents in ERP5. Many formats are supported</string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addImage</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple>
<string>document</string>
<string>file_document</string>
<string>my_document</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Image</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>permission</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>Image</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Type.TranslationProviderBase</string>
<string>TranslationInformation</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Type.TranslationProviderBase</string>
<string>TranslationInformation</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>document_icon.gif</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Role Definition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>A Role Definition allows for associating a certain Zope role to a list of users, organisations, domains, etc.</string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addRoleDefinition</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Role Definition</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>permission</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<workflow_chain>
<chain>
<type>Image</type>
<workflow>document_conversion_interaction_workflow,, document_publication_workflow, document_security_interaction_workflow,, edit_workflow</workflow>
</chain>
<chain>
<type>Image Tile</type>
<workflow>validation_workflow</workflow>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_dms</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Document Management System</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
This script selects documents to update.the selection process\n
is based on calculation of the frequency_index and creation_date_index.\n
Documents which their frequency_index and creation_date_index are the\n
same as those calculated, are updated.\n
"""\n
from Products.ERP5Type.DateUtils import convertDateToHour\n
date_dict = {}\n
\n
# Shared function\n
def updateDocumentList(**sql_kw):\n
for document in context.portal_catalog(**sql_kw):\n
document.getObject().activate().updateContentFromURL()\n
\n
#Step1: convert the alarm date into hours\n
alarm_date = convertDateToHour()\n
\n
#Step2: initialize a dictionary with frequencies\n
for frequency in context.portal_categories.update_frequency.contentValues():\n
frequency_reference = frequency.getIntIndex()\n
date_dict[frequency_reference] = alarm_date % frequency_reference\n
\n
#Step3: update documents\n
for frequency_reference, creation_date in date_dict.items():\n
sql_kw = {\'creation_date_index\':creation_date, \'frequency_index\':frequency_reference, \'limit\':None}\n
documents_to_update = len(context.portal_catalog(**sql_kw))\n
max_in_activities = 1000 \n
offset = 0\n
loop = documents_to_update / max_in_activities\n
for i in range(loop):\n
limit = \'%s,%s\' % (offset, max_in_activities)\n
sql_kw[\'limit\'] = limit\n
updateDocumentList(**sql_kw)\n
offset += max_in_activities\n
limit = \'%s,%s\' % (offset, max_in_activities)\n
sql_kw[\'limit\'] = limit\n
updateDocumentList(**sql_kw)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_senseDocumentToUpdate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
This script receives a request from advanced search form and \n
puts together a search string in a search syntax, depending on\n
parameters received. \n
It is the reverse of Base_parseSearchString script.\n
"""\n
MARKER = [\'\', None]\n
BOOLEAN_MARKER = MARKER + [0]\n
request = context.REQUEST\n
\n
# one can specify a direct search string, \n
# in this case simply returning it is expected\n
searchabletext = kw.get(\'searchabletext\', \n
request.get(\'searchabletext\', None))\n
if searchabletext not in MARKER:\n
return searchabletext\n
\n
# words to search in \'any of the words\' form - left intact\n
searchabletext_any = kw.get(\'searchabletext_any\', \n
request.get(\'searchabletext_any\', \'\'))\n
search_string = searchabletext_any\n
\n
# exact phrase to search for double-quoted\n
searchabletext_phrase = kw.get(\'searchabletext_phrase\', \n
request.get(\'searchabletext_phrase\', None))\n
if searchabletext_phrase not in MARKER:\n
search_string += \' \\"%s\\"\' %searchabletext_phrase\n
\n
# search "with all of the words" - each word prefixed by "+"\n
searchabletext_all = kw.get(\'searchabletext_all\',\n
request.get(\'searchabletext_all\', None))\n
if searchabletext_all not in MARKER:\n
search_string += \' %s\' %\' \'.join(\'+%s\' %word for word in searchabletext_all.split(\' \'))\n
\n
# search without these words - every word prefixed by "-"\n
searchabletext_without = kw.get(\'searchabletext_without\',\n
request.get(\'searchabletext_without\', None))\n
if searchabletext_without not in MARKER:\n
search_string += \' %s\' %\' \'.join(\'-%s\' %word for word in searchabletext_without.split(\' \'))\n
\n
# search limited to a certain date range - add "created:xxx"\n
created_within = kw.get(\'created_within\', request.get(\'created_within\', None))\n
if created_within not in MARKER:\n
search_string += \' created:%s\' %created_within\n
\n
# only given portal_types - add "type:Type" or type:(Type1,Type2...)\n
portal_type_list = kw.get(\'search_portal_type\', \n
request.get(\'search_portal_type\'))\n
if portal_type_list == \'all\':\n
portal_type_list=None\n
if isinstance(portal_type_list, str):\n
portal_type_list=[portal_type_list]\n
if portal_type_list:\n
portal_type_string_list = []\n
for portal_type in portal_type_list:\n
if \' \' in portal_type:\n
portal_type = \'"%s"\' %portal_type\n
portal_type_string_list.append(\'portal_type:%s\' %portal_type)\n
portal_type_string = \'(%s)\' %\' OR \'.join(portal_type_string_list)\n
if search_string not in MARKER:\n
search_string += \' %s %s\' %(logical_operator, portal_type_string)\n
else:\n
search_string += portal_type_string\n
\n
# search by reference\n
reference = kw.get(\'reference\', request.get(\'reference\', None))\n
if reference not in MARKER:\n
search_string += \' reference:%s\' % reference\n
\n
# search by version\n
version = kw.get(\'version\', request.get(\'version\'))\n
if version not in MARKER:\n
search_string += \' version:%s\' %version\n
\n
# search by language\n
language=kw.get(\'language\', request.get(\'language\', None))\n
if language not in MARKER and language != \'0\':\n
search_string += \' language:%s\' % language\n
\n
# category search\n
for category in (\'group\', \'site\', \'function\', \'publication_section\', \'classification\'):\n
category_field_id = \'subfield_field_your_category_list_%s\' %category\n
category_value = kw.get(category_field_id, request.get(category_field_id, None))\n
if category_value not in MARKER:\n
search_string += \' %s:%s\' % (category, category_value)\n
\n
# contributor title search\n
for category in (\'contributor_title\',):\n
category_value = kw.get(category, request.get(category, None))\n
if category_value not in MARKER:\n
search_string += \' %s:%s\' %(category, category_value)\n
\n
# only my docs\n
mine = kw.get(\'mine\', request.get(\'mine\', None))\n
if mine not in BOOLEAN_MARKER:\n
search_string += \' mine:yes\'\n
\n
# only newest versions\n
newest = kw.get(\'newest\', request.get(\'newest\', None))\n
if newest not in BOOLEAN_MARKER:\n
search_string += \' newest:yes\'\n
\n
# search mode\n
search_mode = kw.get(\'search_mode\', request.get(\'search_mode\', None))\n
search_mode_map={\'in_boolean_mode\':\'boolean\',\n
\'with_query_expansion\':\'expanded\'}\n
if search_mode not in MARKER and search_mode_map.has_key(search_mode):\n
search_string += \' mode:%s\' % search_mode_map[search_mode]\n
\n
return search_string\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>logical_operator=\'AND\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_assembleSearchString</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
"""\n
The main search script. Receives one big string - a searchabletext, in\n
the search syntax, parses the string using external method Base_parseSearchString,\n
then does the following:\n
- processes arguments for searching by any category\n
- selects search mode\n
- adds creation and modification date clauses\n
- searches\n
- if requested, filters result so that only the user\'s docs are returned\n
- if requested, filters result to return only the newest versions\n
"""\n
portal = context.getPortalObject()\n
\n
query_kw = {}\n
date_format = \'%Y-%m-%d\'\n
\n
if searchabletext is None:\n
# searchabletext can be supplied in request (fallback)\n
searchabletext = context.REQUEST.get(\'searchabletext\')\n
\n
if searchabletext is None:\n
# or in selection\n
selection_id = \'search_advanced_dialog_selection\'\n
selection_object = portal.portal_selections.getSelectionParamsFor(selection_id)\n
if selection_object:\n
searchabletext = selection_object.get(\'searchabletext\')\n
\n
if searchabletext is None:\n
raise ValueError, "No search string specified."\n
\n
parsed_search_string = context.Base_parseSearchString(searchabletext)\n
\n
# if no portal type specified, take all\n
portal_type = parsed_search_string.get(\'portal_type\', None)\n
if portal_type is None or not len(portal_type):\n
query_kw[\'portal_type\'] = portal.getPortalDocumentTypeList()\n
else:\n
# safe to add passed portal_type, \n
# as multiple values exists split them by \',\'\n
query_kw[\'portal_type\'] = portal_type.split(\',\')\n
\n
# ZSQLCatalog wants table.key to avoid ambiguity\n
parsed_searchabletext = parsed_search_string.get(\'searchabletext\', None)\n
if parsed_searchabletext is not None: \n
query_kw[\'full_text.SearchableText\'] = parsed_searchabletext\n
\n
for key in (\'reference\', \'version\', \'language\',):\n
value = parsed_search_string.get(key, None)\n
if value is not None:\n
query_kw[key] = value\n
\n
where_expression_list = []\n
creation_from = parsed_search_string.get(\'creation_from\', None)\n
creation_to = parsed_search_string.get(\'creation_to\', None)\n
modification_from = parsed_search_string.get(\'modification_from\', None)\n
modification_to = parsed_search_string.get(\'modification_to\', None)\n
if creation_from:\n
where_expression_list.append(\'catalog.creation_date >= "%s"\' \\\n
%creation_from.strftime(date_format))\n
if creation_to:\n
where_expression_list.append(\'catalog.creation_date <= "%s"\' \\\n
%creation_to.strftime(date_format))\n
if modification_from:\n
where_expression_list.append(\'catalog.modification_date >= "%s"\' \\\n
%modification_from.strftime(date_format))\n
if modification_to:\n
where_expression_list.append(\'catalog.modification_date <= "%s"\' \\\n
%modification_to.strftime(date_format))\n
if len(where_expression_list):\n
query_kw[\'where_expression\'] = \' AND \'.join(where_expression_list)\n
\n
if parsed_search_string.get(\'mine\', None) is not None:\n
# user wants only his documents\n
query_kw[\'owner\'] = str(portal.portal_membership.getAuthenticatedMember())\n
\n
# add contributor title\n
contributor_title = parsed_search_string.get(\'contributor_title\', None)\n
if contributor_title is not None:\n
query_kw[\'contributor_title\'] = contributor_title\n
\n
if parsed_search_string.get(\'newest\', None) is not None:\n
#...and now we check for only the newest versions\n
# but we need to preserve order\n
query_kw[\'group_by\'] = (\'reference\',)\n
result = [doc.getLatestVersionValue() \\\n
for doc in context.portal_catalog(**query_kw)]\n
else:\n
result = portal.portal_catalog(**query_kw)\n
\n
return result\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>searchabletext=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getAdvancedSearchResultList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
we search for docs that reference us in any way (reference only or more specific)\n
by making a union of a number of searches\n
we can return raw set, the class will get objects and make the records unique\n
and make sure we get latest/most relevant version\n
should be reimplemented in SQL some sunny day.\n
"""\n
reference = context.getReference()\n
if reference is None:\n
return ()\n
\n
return context.Base_zGetImplicitPredecessorValueList(reference=reference)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*a,**kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getImplicitPredecessorValueList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get objects that reference us</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
Called by document.getImplicitSuccessorValueList\n
Gets a list of dicts containing reference and/or version and/or language\n
and maybe some more things.\n
Returns a list of objects.\n
\n
dummy simple implementation - if no version, then return the newest in the chosen language\n
or in any language if not specified\n
"""\n
my_reference = context.getReference()\n
temporary_dict = {}\n
for dic in reference_list:\n
reference = dic.get(\'reference\')\n
if reference is not None and reference!=my_reference:\n
temporary_dict[reference] = None\n
\n
if not temporary_dict:\n
return ()\n
\n
# For the present, we only use reference.\n
# Result document will be the latest version with appropriate language by user setting.)\n
return context.Base_zGetImplicitSuccessorValueList(reference_list=temporary_dict.keys())\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>reference_list</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getImplicitSuccessorValueList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get referenced by us objects</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
get related object title in a security-aware way (without throwing exception\n
if I don\'t have permissions to access the object)\n
"""\n
\n
title_list = context.Base_getRelatedObjectTitleList(category, portal_type_list)\n
\n
if title_list:\n
return title_list[0]\n
else:\n
return \'\'\n
\n
# XXX-JPS What would be the problem in using getMyCategoryTitle() ?\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>category, portal_type_list=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRelatedObjectTitle</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
get related object title list in a security-aware way (without throwing exception\n
if I don\'t have permissions to access the object)\n
"""\n
\n
object_list = context.Base_getRelatedObjectValueList(base_category, portal_type_list)\n
\n
title_list = [o.getTitle() for o in object_list]\n
\n
return filter(lambda t:t!=\'\', title_list)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category, portal_type_list=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRelatedObjectTitleList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
get related object value list in a security-aware way (without throwing exception\n
if I don\'t have permissions to access the object)\n
"""\n
\n
category_list = context.getPropertyList(base_category)\n
if category_list is None:\n
return []\n
\n
def getValueIfAvailable(category):\n
ob = context.restrictedTraverse(category, None)\n
return ob \n
\n
object_list = [getValueIfAvailable(category) for category in category_list]\n
object_list = [o for o in object_list if o is not None]\n
\n
if portal_type_list is not None:\n
object_list = [o for o in object_list if o.portal_type in portal_type_list]\n
\n
return object_list\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category, portal_type_list=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRelatedObjectValueList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
Returns a list of acceptable formats for conversion\n
in the form of tuples (for listfield in ERP5Form)\n
"""\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
def contentTypeMatch(content_type, glob):\n
if \'*\' == glob[-1]:\n
# \'image/png\' must match \'image/*\'\n
index = glob.index(\'*\')\n
return content_type[:index] == glob[:index]\n
else:\n
return content_type == glob\n
\n
portal = context.getPortalObject()\n
content_type = context.getContentType()\n
\n
def getTargetFormatItemList(content_type):\n
# without content type no wayto determine target format\n
if content_type is None:\n
return []\n
format_list = []\n
output_content_type_list = []\n
for obj in portal.portal_transforms.objectValues():\n
for input in obj.inputs:\n
if contentTypeMatch(content_type, input) and \\\n
obj.output not in output_content_type_list and\\\n
obj.output!=content_type:\n
output_content_type_list.append(obj.output)\n
\n
for output_content_type in output_content_type_list:\n
mimetypes_registry_extension_list = portal.mimetypes_registry.lookup(output_content_type)\n
for mimetypes_registry_extension in mimetypes_registry_extension_list:\n
title = mimetypes_registry_extension.name()\n
try:\n
format = mimetypes_registry_extension.extensions[0]\n
except IndexError:\n
format = None\n
if format is not None and format not in format_list:\n
format_list.append((title, format,))\n
return format_list\n
\n
getTargetFormatItemList = CachingMethod(getTargetFormatItemList,\n
id=\'Base_getTargetFormatItemList\',\n
cache_factory=\'erp5_ui_long\')\n
return getTargetFormatItemList(content_type)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getTargetFormatItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>"""\n
Puts all the arguments from advanced search dialog form together as \n
a parseable search string. Set it in the selection so it can be used\n
in search form.\n
"""\n
portal = context.getPortalObject()\n
searchabletext = context.Base_assembleSearchString()\n
\n
selection_id = \'search_advanced_dialog_selection\'\n
selection_object = portal.portal_selections.getSelectionParamsFor(selection_id, {})\n
if selection_object:\n
# update\n
selection_object[\'searchabletext\'] = searchabletext\n
else:\n
selection_object = {\'searchabletext\': searchabletext}\n
\n
selection_object[\'list_style\'] = \'search\'\n
portal.portal_selections.setSelectionParamsFor(selection_id, \\\n
selection_object)\n
return context.Base_viewAdvancedSearchResultList()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*a,**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_processAdvancedSearch</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</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>Base_processAdvancedSearch</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>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_searchabletext_any</string>
<string>your_searchabletext_all</string>
<string>your_searchabletext_phrase</string>
<string>your_searchabletext_without</string>
<string>my_search_portal_type</string>
<string>your_publication_section_relative_url</string>
<string>your_creation_from</string>
<string>your_creation_to</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>your_reference</string>
<string>your_version</string>
<string>your_language</string>
<string>your_mine</string>
<string>your_newest</string>
<string>my_created_within</string>
<string>your_contributor_title</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_viewAdvancedSearchDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Base_advancedSearchDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</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>Advanced Document Search</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>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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