Commit fdf0509a authored by Romain Courteaud's avatar Romain Courteaud

erp5_*: use Base_renderForm API to change the REQUEST

parent f379099c
"""Preview the response from notification message for event create response dialog. """Preview the response from notification message for event create response dialog.
""" """
keep_items = None
if response_event_notification_message: if response_event_notification_message:
temp_event = context.getPortalObject().event_module.newContent( temp_event = context.getPortalObject().event_module.newContent(
temp_object=True, temp_object=True,
...@@ -17,12 +18,11 @@ if response_event_notification_message: ...@@ -17,12 +18,11 @@ if response_event_notification_message:
substitution_method_parameter_dict=dict(reply_body=context.getReplyBody(), substitution_method_parameter_dict=dict(reply_body=context.getReplyBody(),
reply_subject=context.getReplySubject())) reply_subject=context.getReplySubject()))
# XXX this relies on formulator internals, we force the variables in request and keep_items = {
# re-render the form. 'your_response_event_notification_message': '',
request = container.REQUEST 'your_response_event_title': temp_event.getTitle(),
request.form['your_response_event_notification_message'] = '' 'your_response_event_text_content': temp_event.getTextContent(),
request.form['your_response_event_title'] = temp_event.getTitle() 'your_response_event_resource': temp_event.getResource()
request.form['your_response_event_text_content'] = temp_event.getTextContent() }
request.form['your_response_event_resource'] = temp_event.getResource()
return context.Base_renderForm('Event_viewCreateResponseDialog') return context.Base_renderForm('Event_viewCreateResponseDialog', keep_items=keep_items)
"""Preview the response from notification message for ticket create response dialog. """Preview the response from notification message for ticket create response dialog.
""" """
event = context.Ticket_getCausalityValue() event = context.Ticket_getCausalityValue()
keep_items = None
if response_event_notification_message: if response_event_notification_message:
temp_event = context.getPortalObject().event_module.newContent( temp_event = context.getPortalObject().event_module.newContent(
...@@ -33,19 +34,12 @@ if response_event_notification_message: ...@@ -33,19 +34,12 @@ if response_event_notification_message:
if reply_subject not in title: if reply_subject not in title:
title = '%s (%s)' % (title, reply_subject) title = '%s (%s)' % (title, reply_subject)
# XXX this relies on formulator internals, we force the variables in request and keep_items = {
# re-render the form. 'your_response_event_notification_message': '',
request = container.REQUEST 'your_response_event_title': title,
request.set('your_response_event_notification_message', '') 'your_response_event_text_content': temp_event.getTextContent(),
request.set('your_response_event_title', title) 'your_response_event_content_type': temp_event.getContentType(),
request.set('your_response_event_text_content', temp_event.getTextContent()) 'your_response_event_resource': temp_event.getResource()
request.set('your_response_event_content_type', temp_event.getContentType()) }
request.set('your_response_event_resource', temp_event.getResource())
# for new UI
request.form['your_response_event_notification_message'] = ''
request.form['your_response_event_title'] = title
request.form['your_response_event_text_content'] = temp_event.getTextContent()
request.form['your_response_event_content_type'] = temp_event.getContentType()
request.form['your_response_event_resource'] = temp_event.getResource()
return context.Base_renderForm('Ticket_viewCreateResponseWorkflowActionDialog') return context.Base_renderForm('Ticket_viewCreateResponseWorkflowActionDialog', keep_items=keep_items)
"""Preview the response from notification message for ticket create response dialog. """Preview the response from notification message for ticket create response dialog.
""" """
keep_items = None
if notification_message: if notification_message:
temp_event = context.getPortalObject().event_module.newContent( temp_event = context.getPortalObject().event_module.newContent(
temp_object=True, temp_object=True,
...@@ -27,19 +28,12 @@ if notification_message: ...@@ -27,19 +28,12 @@ if notification_message:
if original_title and original_title not in title: if original_title and original_title not in title:
title = '%s (%s)' % (title, original_title) title = '%s (%s)' % (title, original_title)
# XXX this relies on formulator internals, we force the variables in request and keep_items = {
# re-render the form. 'your_notification_message': '',
request = container.REQUEST 'your_title': temp_event.getTitle(),
request.form['your_notification_message'] = '' 'your_text_content': temp_event.getTextContent(),
request.form['your_title'] = temp_event.getTitle() 'your_content_type': temp_event.getContentType(),
request.form['your_text_content'] = temp_event.getTextContent() 'your_resource': temp_event.getResource()
request.form['your_content_type'] = temp_event.getContentType() }
request.form['your_resource'] = temp_event.getResource()
# BBB for legacy UI
request.set('your_notification_message', '')
request.set('your_title', temp_event.getTitle())
request.set('your_text_content', temp_event.getTextContent())
request.set('your_content_type', temp_event.getContentType())
request.set('your_resource', temp_event.getResource())
return context.Base_renderForm(dialog_id) return context.Base_renderForm(dialog_id, keep_items=keep_items)
...@@ -7,21 +7,21 @@ if len(line_list) == 0: ...@@ -7,21 +7,21 @@ if len(line_list) == 0:
kw["keep_items"] = {'portal_status_message': translateString("Workflow state may have been updated by other user. Please try again.")} kw["keep_items"] = {'portal_status_message': translateString("Workflow state may have been updated by other user. Please try again.")}
return context.Base_redirect(form_id, **kw) return context.Base_redirect(form_id, **kw)
keep_items = {
'your_dialog_updated': '1',
}
for listbox_dict in listbox: for listbox_dict in listbox:
line = [x for x in line_list if x.getPath() == listbox_dict['listbox_key']][0] line = [x for x in line_list if x.getPath() == listbox_dict['listbox_key']][0]
uid = line.getUid() uid = line.getUid()
for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',): for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(prop, None) value = listbox_dict.get(prop, None)
key = 'field_listbox_%s_%s' % (prop, uid) key = 'field_listbox_%s_%s' % (prop, uid)
request.form[key] = request.other[key] = value keep_items[key] = value
if prop == 'solver_configuration': if prop == 'solver_configuration':
if value is not None: if value is not None:
line.updateConfiguration(**value.as_dict()) line.updateConfiguration(**value.as_dict())
else: else:
line.setProperty(prop, value) line.setProperty(prop, value)
request.form['your_dialog_updated'] = '1' keep_items['listbox'] = listbox
# xhtml style Base_callDialogMethod does not redirected because of the listbox return context.Base_renderForm('Delivery_viewSolveDivergenceDialog', keep_items=keep_items)
request.set('your_dialog_updated', '1')
request.set('listbox', listbox)
return context.Base_renderForm('Delivery_viewSolveDivergenceDialog')
...@@ -2,5 +2,4 @@ ...@@ -2,5 +2,4 @@
# #
# Print action expects the previous view to be accessible in `form_id` # Print action expects the previous view to be accessible in `form_id`
# and it prints it out in both UI compatible way - as a redirect message. # and it prints it out in both UI compatible way - as a redirect message.
context.REQUEST.form['last_form_id'] = form_id return context.Base_renderForm('Foo_viewPrintoutForm', keep_items={'last_form_id': form_id})
return context.Base_renderForm('Foo_viewPrintoutForm')
...@@ -14,7 +14,11 @@ ...@@ -14,7 +14,11 @@
</item> </item>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>Foo_viewPrintoutForm</string> </value> <value> <string>Foo_printLastViewName</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="LabelField" module="Products.Formulator.StandardFields"/> <global name="StringField" module="Products.Formulator.StandardFields"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -13,13 +13,30 @@ ...@@ -13,13 +13,30 @@
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
<value> <value>
<dictionary/> <dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
</item>
</dictionary>
</value> </value>
</item> </item>
<item> <item>
<key> <string>overrides</string> </key> <key> <string>overrides</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -32,6 +49,14 @@ ...@@ -32,6 +49,14 @@
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -40,6 +65,10 @@ ...@@ -40,6 +65,10 @@
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -48,10 +77,34 @@ ...@@ -48,10 +77,34 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -59,20 +112,30 @@ ...@@ -59,20 +112,30 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -81,6 +144,10 @@ ...@@ -81,6 +144,10 @@
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -89,10 +156,34 @@ ...@@ -89,10 +156,34 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -100,18 +191,30 @@ ...@@ -100,18 +191,30 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string>No Last FormID</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
...@@ -120,6 +223,10 @@ ...@@ -120,6 +223,10 @@
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
</item> </item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -128,25 +235,36 @@ ...@@ -128,25 +235,36 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>input_type</string> </key>
<value> <string>text</string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Last Form ID</string> </value> <value> <string>Last Form ID</string> </value>
</item> </item>
</dictionary> <item>
</value> <key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item> </item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>unicode</string> </key>
<value> <string>python: here.REQUEST.form.get(\'form_id\', \'No Last FormID\')</string> </value> <value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
request = container.REQUEST
request.form['your_integer_1'] = integer_1 + 1
assert button == 'forbarcontent', button assert button == 'forbarcontent', button
return context.Base_renderForm('Foo_viewFieldSubmitDialog', message='Field Action Submitted') return context.Base_renderForm('Foo_viewFieldSubmitDialog', message='Field Action Submitted', keep_items={'your_integer_1': integer_1 + 1})
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