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

Improved dialog handling


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1171 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3468c5ce
...@@ -12,8 +12,20 @@ request=context.REQUEST ...@@ -12,8 +12,20 @@ request=context.REQUEST
#Exceptions for Workflow #Exceptions for Workflow
if dialog_method == 'workflow_status_modify': if dialog_method == 'workflow_status_modify':
return context.workflow_status_modify(form_id=form_id, return context.workflow_status_modify( form_id=form_id
dialog_id=dialog_id , dialog_id=dialog_id
)
if dialog_method == 'base_list_ui':
return context.base_list_ui( form_id=form_id
, selection_name=selection_name
, field_columns=getattr(request,'field_columns')
, stat_columns=getattr(request,'stat_columns')
)
if dialog_method == 'base_sort_on':
return context.base_sort_on( form_id=form_id
, selection_name=selection_name
, field_sort_on=getattr(request,'field_sort_on')
, field_sort_order=getattr(request,'field_sort_order')
) )
error_message = '' error_message = ''
...@@ -22,18 +34,42 @@ try: ...@@ -22,18 +34,42 @@ try:
# Validate the form # Validate the form
form = getattr(context,dialog_id) form = getattr(context,dialog_id)
form.validate_all_to_request(request) form.validate_all_to_request(request)
kw = {} kw = { 'form_id' : form_id
, 'selection_name' : selection_name
, 'selection_index' : None
, 'dialog_id' : dialog_id
} # Missing selection_index
has_listbox = 0
for f in form.get_fields(): for f in form.get_fields():
k = f.id k = f.id
v = getattr(request,k,None) v = getattr(request,k,None)
if v is not None: if v is not None:
if k[0:3] == 'my_':
k = k[3:] k = k[3:]
kw[k] = v kw[k] = v
url_params = [] elif k in ('import_file', 'listbox'):
# Object view params if f.meta_type == 'ListBox': has_listbox = 1
kw['form_id'] = form_id kw[k] = v
kw['dialog_id'] = dialog_id # Add some properties required by UI
kw['selection_name'] = selection_name kw['cancel_url'] = cancel_url
# Redirect if possible, or call directly else
if kw.has_key('import_file'):
# We can not redirect if we do an import
import_file = kw['import_file']
return getattr(context,dialog_method)(**kw)
if has_listbox:
listbox_line_list = []
listbox = getattr(request,'listbox',None)
listbox_keys = listbox.keys()
listbox_keys.sort()
for key in listbox_keys:
listbox_line = listbox[key]
listbox_line['listbox_key'] = key
listbox_line_list.append(listbox[key])
listbox_line_list = tuple(listbox_line_list)
kw['listbox'] = listbox_line_list
return getattr(context,dialog_method)(**kw)
url_params_string = make_query(kw)
# Check if the selection did not changed # Check if the selection did not changed
if previous_md5_object_uid_list is not None: if previous_md5_object_uid_list is not None:
selection_list = context.portal_selections.callSelectionFor(selection_name, context=context) selection_list = context.portal_selections.callSelectionFor(selection_name, context=context)
......
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