Commit 90127185 authored by Nicolas Delaby's avatar Nicolas Delaby

Improve creation of event from Ticket

Enhance consistency with response creation dialog on events
parent 36db7120
<?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>"""Resource lister from a ticket\n
"""\n
portal = context.getPortalObject()\n
portal_type = portal.getPortalEventTypeList()[0]\n
\n
event = portal.getDefaultModule(portal_type).newContent(portal_type=portal_type,\n
temp_object=True)\n
\n
return event.Event_getResourceItemList()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Ticket_getEventResourceItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -54,24 +54,39 @@ ...@@ -54,24 +54,39 @@
This script creates a new event with given metadata and\n This script creates a new event with given metadata and\n
attaches it to the current ticket.\n attaches it to the current ticket.\n
"""\n """\n
translateString = context.Base_translateString\n portal = context.getPortalObject()\n
module = context.getDefaultModule(portal_type)\n translateString = portal.Base_translateString\n
module = portal.getDefaultModule(portal_type)\n
\n \n
if portal_type not in module.getVisibleAllowedContentTypeList():\n if portal_type not in module.getVisibleAllowedContentTypeList():\n
return context.Base_redirect(form_id,\n return context.Base_redirect(form_id,\n
keep_items=dict(\n keep_items=dict(\n
portal_status_message=translateString("You do not have permission to add new event.")))\n portal_status_message=translateString("You do not have permission to add new event.")))\n
\n \n
current_user = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
# Create a new event\n # Create a new event\n
event = module.newContent(portal_type=portal_type, description=description, title=title, follow_up=context.getRelativeUrl())\n event = module.newContent(portal_type=portal_type, \n
title=title,\n
text_content=text_content,\n
content_type=portal.portal_preferences.getPreferredTextEditor() and \'text/html\' or \'text/plain\',\n
resource=resource,\n
start_date=DateTime(),\n
follow_up=context.getRelativeUrl())\n
\n \n
# Trigger appropriate workflow action\n # Trigger appropriate workflow action\n
if direction == \'incoming\':\n if direction == \'incoming\':\n
event.setDestinationValue(current_user)\n
# Support event_workflow and event_simulation_workflow\n
if portal.portal_workflow.isTransitionPossible(event, \'receive\'):\n
event.receive()\n event.receive()\n
if portal.portal_workflow.isTransitionPossible(event, \'stop\'):\n
event.stop()\n
else:\n else:\n
event.setSourceValue(current_user)\n
event.plan()\n event.plan()\n
\n \n
# Redirect to even\n # Redirect to event\n
portal_status_message = translateString(\n portal_status_message = translateString(\n
"Created and associated a new ${portal_type} to the ticket.", \n "Created and associated a new ${portal_type} to the ticket.", \n
mapping=dict(portal_type = translateString(portal_type)))\n mapping=dict(portal_type = translateString(portal_type)))\n
...@@ -80,7 +95,7 @@ return event.Base_redirect(\'view\', keep_items = dict(portal_status_message=por ...@@ -80,7 +95,7 @@ return event.Base_redirect(\'view\', keep_items = dict(portal_status_message=por
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>portal_type, title, description, direction, form_id=\'view\', **kw</string> </value> <value> <string>form_id=\'view\', portal_type=None, title=None, resource=None, text_content=None,direction=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -74,7 +74,9 @@ ...@@ -74,7 +74,9 @@
<item> <item>
<key> <string>center</string> </key> <key> <string>center</string> </key>
<value> <value>
<list/> <list>
<string>your_text_content</string>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -87,9 +89,9 @@ ...@@ -87,9 +89,9 @@
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>your_portal_type</string>
<string>your_title</string> <string>your_title</string>
<string>your_description</string> <string>your_portal_type</string>
<string>your_resource</string>
<string>your_direction</string> <string>your_direction</string>
</list> </list>
</value> </value>
......
<?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>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_resource</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>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </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>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Event Nature</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/Ticket_getEventResourceItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
554 555
\ No newline at end of file \ 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