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.
"""
keep_items = None
if response_event_notification_message:
temp_event = context.getPortalObject().event_module.newContent(
temp_object=True,
......@@ -17,12 +18,11 @@ if response_event_notification_message:
substitution_method_parameter_dict=dict(reply_body=context.getReplyBody(),
reply_subject=context.getReplySubject()))
# XXX this relies on formulator internals, we force the variables in request and
# re-render the form.
request = container.REQUEST
request.form['your_response_event_notification_message'] = ''
request.form['your_response_event_title'] = temp_event.getTitle()
request.form['your_response_event_text_content'] = temp_event.getTextContent()
request.form['your_response_event_resource'] = temp_event.getResource()
keep_items = {
'your_response_event_notification_message': '',
'your_response_event_title': temp_event.getTitle(),
'your_response_event_text_content': temp_event.getTextContent(),
'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.
"""
event = context.Ticket_getCausalityValue()
keep_items = None
if response_event_notification_message:
temp_event = context.getPortalObject().event_module.newContent(
......@@ -33,19 +34,12 @@ if response_event_notification_message:
if reply_subject not in title:
title = '%s (%s)' % (title, reply_subject)
# XXX this relies on formulator internals, we force the variables in request and
# re-render the form.
request = container.REQUEST
request.set('your_response_event_notification_message', '')
request.set('your_response_event_title', title)
request.set('your_response_event_text_content', temp_event.getTextContent())
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()
keep_items = {
'your_response_event_notification_message': '',
'your_response_event_title': title,
'your_response_event_text_content': temp_event.getTextContent(),
'your_response_event_content_type': temp_event.getContentType(),
'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.
"""
keep_items = None
if notification_message:
temp_event = context.getPortalObject().event_module.newContent(
temp_object=True,
......@@ -27,19 +28,12 @@ if notification_message:
if original_title and original_title not in title:
title = '%s (%s)' % (title, original_title)
# XXX this relies on formulator internals, we force the variables in request and
# re-render the form.
request = container.REQUEST
request.form['your_notification_message'] = ''
request.form['your_title'] = temp_event.getTitle()
request.form['your_text_content'] = temp_event.getTextContent()
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())
keep_items = {
'your_notification_message': '',
'your_title': temp_event.getTitle(),
'your_text_content': temp_event.getTextContent(),
'your_content_type': temp_event.getContentType(),
'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:
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)
keep_items = {
'your_dialog_updated': '1',
}
for listbox_dict in listbox:
line = [x for x in line_list if x.getPath() == listbox_dict['listbox_key']][0]
uid = line.getUid()
for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(prop, None)
key = 'field_listbox_%s_%s' % (prop, uid)
request.form[key] = request.other[key] = value
keep_items[key] = value
if prop == 'solver_configuration':
if value is not None:
line.updateConfiguration(**value.as_dict())
else:
line.setProperty(prop, value)
request.form['your_dialog_updated'] = '1'
# xhtml style Base_callDialogMethod does not redirected because of the listbox
request.set('your_dialog_updated', '1')
request.set('listbox', listbox)
return context.Base_renderForm('Delivery_viewSolveDivergenceDialog')
keep_items['listbox'] = listbox
return context.Base_renderForm('Delivery_viewSolveDivergenceDialog', keep_items=keep_items)
......@@ -2,5 +2,4 @@
#
# 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.
context.REQUEST.form['last_form_id'] = form_id
return context.Base_renderForm('Foo_viewPrintoutForm')
return context.Base_renderForm('Foo_viewPrintoutForm', keep_items={'last_form_id': form_id})
......@@ -14,7 +14,11 @@
</item>
<item>
<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>
<key> <string>description</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LabelField" module="Products.Formulator.StandardFields"/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,13 +13,30 @@
<item>
<key> <string>message_values</string> </key>
<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>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
......@@ -32,6 +49,14 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</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>
<key> <string>editable</string> </key>
<value> <string></string> </value>
......@@ -40,6 +65,10 @@
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
......@@ -48,10 +77,34 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</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>
<key> <string>title</string> </key>
<value> <string></string> </value>
</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>
</value>
</item>
......@@ -59,20 +112,30 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</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>
<key> <string>editable</string> </key>
<value> <string></string> </value>
......@@ -81,6 +144,10 @@
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
......@@ -89,10 +156,34 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</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>
<key> <string>title</string> </key>
<value> <string></string> </value>
</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>
</value>
</item>
......@@ -100,18 +191,30 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value> <string>No Last FormID</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</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>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
......@@ -120,6 +223,10 @@
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
......@@ -128,25 +235,36 @@
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</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>
<key> <string>title</string> </key>
<value> <string>Last Form ID</string> </value>
</item>
</dictionary>
</value>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </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>python: here.REQUEST.form.get(\'form_id\', \'No Last FormID\')</string> </value>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
......
request = container.REQUEST
request.form['your_integer_1'] = integer_1 + 1
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