Commit c6ae4094 authored by Ivan Tyagov's avatar Ivan Tyagov

Use generic contribute script (Base_contribute) and adjust "Attach File" dialog.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32903 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1840301d
<?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>translateString = context.Base_translateString\n
from Products.CMFCore.utils import getToolByName\n
\n
if file.filename not in [\'\', None]:\n
portal = context.getPortalObject()\n
\n
document_new_content_kw = {\n
\'file\': file,\n
}\n
document_edit_kw = {\n
\'follow_up\': context.getRelativeUrl(),\n
\'version\': version,\n
\'title\': title,\n
\'short_title\': short_title,\n
\'language\': language,\n
\'reference\': reference,\n
\'description\': description,\n
}\n
\n
container = getToolByName(portal, \'portal_contributions\', None)\n
# Do not redirect when using portal_contributions, in order to prevent\n
# conflict with automatic metadata detection\n
redirect = 0\n
\n
is_authorized = 1\n
if container is None:\n
container = context\n
document_new_content_kw[\'portal_type\'] = portal_type\n
redirect = 1\n
if portal_type not in [\'%s\' % x.id for x in container.allowedContentTypes()]:\n
is_authorized = 0\n
\n
if not portal.portal_membership.checkPermission(\'Add portal content\', container):\n
is_authorized = 0\n
\n
if not is_authorized:\n
return context.Base_redirect(form_id,\n
keep_items={\'portal_status_message\':\n
translateString(\n
"You are not allowed to create this object.")})\n
\n
document = container.newContent(**document_new_content_kw)\n
document.edit(**document_edit_kw)\n
\n
message = translateString(\'${portal_type} created successfully.\',\n
mapping={\'portal_type\': document.getTranslatedPortalType()})\n
if redirect:\n
return document.Base_redirect(\'view\', \n
keep_items=dict(portal_status_message=message))\n
else:\n
return context.Base_redirect(form_id, \n
keep_items=dict(portal_status_message=message))\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>portal_type, title, reference, short_title, language, version, description, file, form_id=\'view\', **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>9</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>portal_type</string>
<string>title</string>
<string>reference</string>
<string>short_title</string>
<string>language</string>
<string>version</string>
<string>description</string>
<string>file</string>
<string>form_id</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>translateString</string>
<string>Products.CMFCore.utils</string>
<string>getToolByName</string>
<string>None</string>
<string>portal</string>
<string>document_new_content_kw</string>
<string>document_edit_kw</string>
<string>container</string>
<string>redirect</string>
<string>is_authorized</string>
<string>_write_</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>_apply_</string>
<string>document</string>
<string>message</string>
<string>dict</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<string>view</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_createNewFile</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -38,7 +38,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_createNewFile</string> </value>
<value> <string>Base_contribute</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -99,6 +99,8 @@
<value>
<list>
<string>your_file</string>
<string>your_redirect_url</string>
<string>your_attach_document_to_context</string>
</list>
</value>
</item>
......@@ -154,6 +156,10 @@
<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>
......
<?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>css_class</string>
<string>default</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_attach_document_to_context</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>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </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>hidden</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>css_class</string> </key>
<value> <string>hidden_fieldset</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>css_class</string>
<string>default</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_redirect_url</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>hidden</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>css_class</string> </key>
<value> <string>hidden_fieldset</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>1</int> </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>here/absolute_url</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
676
\ No newline at end of file
677
\ 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