Commit 4d7b5b93 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Do not set selection_sort_on to the default sort. use selection_default_sort_on instead.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1339 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a179b4d7
...@@ -402,28 +402,32 @@ class ListBoxWidget(Widget.Widget): ...@@ -402,28 +402,32 @@ class ListBoxWidget(Widget.Widget):
selection = here.portal_selections.getSelectionFor(selection_name, REQUEST=REQUEST) selection = here.portal_selections.getSelectionFor(selection_name, REQUEST=REQUEST)
# Create selection if needed, with default sort order # Create selection if needed, with default sort order
if selection is None: if selection is None:
selection = Selection(params=default_params, sort_on = sort) selection = Selection(params=default_params, default_sort_on = sort)
# Or make sure all sort arguments are valid # Or make sure all sort arguments are valid
else: else:
# Reset Selection is needed # Reset Selection is needed
if reset is not 0 and reset is not '0': if reset is not 0 and reset is not '0':
here.portal_selections.setSelectionToAll(selection_name) here.portal_selections.setSelectionToAll(selection_name)
here.portal_selections.setSelectionSortOrder(selection_name, sort_on = sort) here.portal_selections.setSelectionSortOrder(selection_name, sort_on = [])
# Modify the default sort index every time, because it may change immediately.
selection.edit(default_sort_on = sort)
# Filter non searchable items # Filter non searchable items
sort = [] sort_list = []
fix_sort = 0 fix_sort = 0
for (k , v) in selection.selection_sort_on: for (k , v) in selection.selection_sort_on:
if k in sort_columns_id_list: if k in sort_columns_id_list:
sort.append((k,v)) sort_list.append((k,v))
else: else:
fix_sort = 1 fix_sort = 1
if fix_sort: selection.selection_sort_on = sort if fix_sort: selection.selection_sort_on = sort_list
if not hasattr(selection, 'selection_flat_list_mode'): if not hasattr(selection, 'selection_flat_list_mode'):
selection.edit(flat_list_mode=(not (domain_tree or selection.edit(flat_list_mode=(not (domain_tree or
report_tree)),domain_tree_mode=domain_tree,report_tree_mode= report_tree) report_tree)),domain_tree_mode=domain_tree,report_tree_mode= report_tree)
#LOG('ListBox', 0, 'sort = %s, selection.selection_sort_on = %s' % (repr(sort), repr(selection.selection_sort_on)))
# Selection # Selection
#LOG("Selection",0,str(selection.__dict__)) #LOG("Selection",0,str(selection.__dict__))
...@@ -599,7 +603,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -599,7 +603,7 @@ class ListBoxWidget(Widget.Widget):
else: else:
stat_method = here.portal_catalog.countResults stat_method = here.portal_catalog.countResults
LOG('ListBox', 0, 'domain_tree = %s, selection.getSelectionDomainPath() = %s, selection.getSelectionDomainList() = %s' % (repr(domain_tree), repr(selection.getSelectionDomainPath()), repr(selection.getSelectionDomainList()))) #LOG('ListBox', 0, 'domain_tree = %s, selection.getSelectionDomainPath() = %s, selection.getSelectionDomainList() = %s' % (repr(domain_tree), repr(selection.getSelectionDomainPath()), repr(selection.getSelectionDomainList())))
if domain_tree: if domain_tree:
selection_domain_path = selection.getSelectionDomainPath() selection_domain_path = selection.getSelectionDomainPath()
selection_domain_current = selection.getSelectionDomainList() selection_domain_current = selection.getSelectionDomainList()
...@@ -1395,6 +1399,7 @@ class ListBoxValidator(Validator.Validator): ...@@ -1395,6 +1399,7 @@ class ListBoxValidator(Validator.Validator):
editable_column_ids = map(lambda x: x[0], editable_columns) editable_column_ids = map(lambda x: x[0], editable_columns)
all_editable_column_ids = map(lambda x: x[0], all_editable_columns) all_editable_column_ids = map(lambda x: x[0], all_editable_columns)
selection_name = field.get_value('selection_name') selection_name = field.get_value('selection_name')
#LOG('ListBoxValidator', 0, 'field = %s, selection_name = %s' % (repr(field), repr(selection_name)))
selection = here.portal_selections.getSelectionFor(selection_name, REQUEST=REQUEST) selection = here.portal_selections.getSelectionFor(selection_name, REQUEST=REQUEST)
params = selection.getSelectionParams() params = selection.getSelectionParams()
portal_url = getToolByName(here, 'portal_url') portal_url = getToolByName(here, 'portal_url')
......
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