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,
......@@ -16,13 +17,12 @@ if response_event_notification_message:
reference=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()
return context.Base_renderForm('Event_viewCreateResponseDialog')
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', 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>
......
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