diff --git a/product/ERP5/skins/erp5_core/base_view_dialog.py b/product/ERP5/skins/erp5_core/base_view_dialog.py index c7db2b9c0fd2623fd484d261e0ebe0409d47340d..257e4821376a0871666a842611ed2c0f5df6499d 100755 --- a/product/ERP5/skins/erp5_core/base_view_dialog.py +++ b/product/ERP5/skins/erp5_core/base_view_dialog.py @@ -12,9 +12,21 @@ 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: - 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 + if k[0:3] == 'my_': + k = k[3:] + kw[k] = v + 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)