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
#Exceptions for Workflow
if dialog_method == 'workflow_status_modify':
return context.workflow_status_modify(form_id=form_id,
dialog_id=dialog_id
return context.workflow_status_modify( form_id=form_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 = ''
......@@ -22,18 +34,42 @@ try:
# Validate the form
form = getattr(context,dialog_id)
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():
k = f.id
v = getattr(request,k,None)
if v is not None:
if k[0:3] == 'my_':
k = k[3:]
kw[k] = v
url_params = []
# Object view params
kw['form_id'] = form_id
kw['dialog_id'] = dialog_id
kw['selection_name'] = selection_name
elif k in ('import_file', 'listbox'):
if f.meta_type == 'ListBox': has_listbox = 1
kw[k] = v
# Add some properties required by UI
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
if previous_md5_object_uid_list is not None:
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