Commit d0bb7d75 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Give a possibility to write event body only once. Put some better defaults. Display more tickets.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16349 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 06ea4d03
<?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>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</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 returns all possible projects or tickets\n
which can be used a follow up to a CRM event.\n
"""\n
type_list = context.getPortalTicketTypeList() + context.getPortalProjectTypeList()\n
node_list = context.portal_catalog(portal_type=type_list, simulation_state=[\'draft\', \'open\'])\n
return map(lambda x:(x.getTitle(), x.getRelativeUrl()), node_list)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>type_list</string>
<string>node_list</string>
<string>map</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getFollowUpItemList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -80,19 +77,30 @@ person_list = context.portal_selections.getSelectionCheckedValueList(selection_n
if not person_list:\n
person_list = context.portal_selections.getSelectionValueList(selection_name)\n
\n
# Find authenticated user\n
user = context.portal_membership.getAuthenticatedMember()\n
user_person = context.portal_catalog.getResultValue(portal_type=\'Person\', reference=user)\n
\n
# For every person, create an event\n
count = 0\n
for person in person_list:\n
# Create a new event\n
event = module.newContent(portal_type=portal_type, description=description, title=title, follow_up=follow_up)\n
event = module.newContent(portal_type=portal_type, \n
description=description, \n
title=title, \n
follow_up=follow_up,\n
text_content=text_content) # text_format is set by Event_init\n
count += 1\n
# Trigger appropriate workflow action\n
if direction == \'incoming\':\n
event.setSourceValue(person)\n
event.setDestinationValue(user_person)\n
event.receive()\n
else:\n
event.plan()\n
event.setDestinationValue(person)\n
event.setSourceValue(user_person)\n
\n
\n
# Redirect to the event module (but is this the best place to go since events are not yet indexed ?)\n
portal_status_message = translateString("Created and associated ${count} new ${portal_type}(s) to the selected ticket.", \n
......@@ -114,7 +122,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>portal_type, title, description, direction, selection_name, selection_index,follow_up, form_id, **kw</string> </value>
<value> <string>portal_type, title, description, direction, selection_name, selection_index, follow_up, text_content, form_id, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -134,7 +142,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>8</int> </value>
<value> <int>9</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -147,6 +155,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<string>selection_name</string>
<string>selection_index</string>
<string>follow_up</string>
<string>text_content</string>
<string>form_id</string>
<string>kw</string>
<string>_getattr_</string>
......@@ -154,10 +163,13 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<string>translateString</string>
<string>module</string>
<string>person_list</string>
<string>user</string>
<string>user_person</string>
<string>count</string>
<string>_getiter_</string>
<string>person</string>
<string>event</string>
<string>_inplacevar_</string>
<string>dict</string>
<string>portal_status_message</string>
<string>_apply_</string>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -78,25 +75,27 @@
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<key> <string>bottom</string> </key>
<value>
<list/>
<list>
<string>your_text_content</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<key> <string>left</string> </key>
<value>
<list>
<string>your_portal_type</string>
......@@ -108,7 +107,7 @@
</value>
</item>
<item>
<key> <string>right</string> </key>
<key> <string>right</string> </key>
<value>
<list/>
</value>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>ListField</string>
</tuple>
<none/>
<global name="ListField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -270,18 +267,15 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:map(lambda x:(x.getTitle(), x.getRelativeUrl()), here.portal_catalog(simulation_state=[\'submitted\', \'validated\'], portal_type=here.getPortalTicketTypeList() + here.getPortalProjectTypeList()))</string> </value>
<value> <string>here/ERP5Site_getFollowUpItemList</string> </value>
</item>
</dictionary>
</pickle>
......
<?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>title</string>
<string>default</string>
<string>css_class</string>
<string>text_editor</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_text_content</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>editable</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>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>text_editor</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</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>page</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_text_content</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Event_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>text_editor</string> </key>
<value> <string>text_area</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Body</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>python:(here.portal_preferences.getPreferredTextFormat() == \'text/html\' and here.portal_preferences.getPreferredTextEditor()) or \'text_area\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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