Commit 9336a571 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

prevent errors in changing pages when listbox is modified background.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24543 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be20aea1
...@@ -632,7 +632,6 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -632,7 +632,6 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
lastPage. lastPage.
""" """
if uids is None: uids = [] if uids is None: uids = []
selection = self.getSelectionFor(list_selection_name, REQUEST)
REQUEST.form['list_start'] = 0 REQUEST.form['list_start'] = 0
self.uncheckAll(list_selection_name, listbox_uid) self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
...@@ -647,17 +646,18 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -647,17 +646,18 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
""" """
if uids is None: uids = [] if uids is None: uids = []
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
params = selection.getParams() if selection is not None:
# XXX This will not work if the number of lines shown in the listbox is greater params = selection.getParams()
# than the BIG_INT constan. Such a case has low probability but is not # XXX This will not work if the number of lines shown in the listbox is greater
# impossible. If you are in this case, send me a mail ! -- Kev # than the BIG_INT constan. Such a case has low probability but is not
BIG_INT = 10000000 # impossible. If you are in this case, send me a mail ! -- Kev
last_page_start = BIG_INT BIG_INT = 10000000
total_lines = REQUEST.form.get('total_size', BIG_INT) last_page_start = BIG_INT
if total_lines != BIG_INT: total_lines = REQUEST.form.get('total_size', BIG_INT)
lines_per_page = params.get('list_lines', 1) if total_lines != BIG_INT:
last_page_start = int(total_lines) - (int(total_lines) % int(lines_per_page)) lines_per_page = params.get('list_lines', 1)
REQUEST.form['list_start'] = last_page_start last_page_start = int(total_lines) - (int(total_lines) % int(lines_per_page))
REQUEST.form['list_start'] = last_page_start
self.uncheckAll(list_selection_name, listbox_uid) self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
...@@ -668,11 +668,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -668,11 +668,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
""" """
if uids is None: uids = [] if uids is None: uids = []
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
params = selection.getParams() if selection is not None:
lines = params.get('list_lines', 0) params = selection.getParams()
start = REQUEST.form.pop('list_start', 0) lines = params.get('list_lines', 0)
params['list_start'] = int(start) + int(lines) start = REQUEST.form.pop('list_start', 0)
selection.edit(params=params) params['list_start'] = int(start) + int(lines)
selection.edit(params=params)
self.uncheckAll(list_selection_name, listbox_uid) self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
...@@ -683,11 +684,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -683,11 +684,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
""" """
if uids is None: uids = [] if uids is None: uids = []
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
params = selection.getParams() if selection is not None:
lines = params.get('list_lines', 0) params = selection.getParams()
start = REQUEST.form.pop('list_start', 0) lines = params.get('list_lines', 0)
params['list_start'] = max(int(start) - int(lines), 0) start = REQUEST.form.pop('list_start', 0)
selection.edit(params=params) params['list_start'] = max(int(start) - int(lines), 0)
selection.edit(params=params)
self.uncheckAll(list_selection_name, listbox_uid) self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
...@@ -698,10 +700,11 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -698,10 +700,11 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
""" """
if uids is None: uids = [] if uids is None: uids = []
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
params = selection.getParams() if selection is not None:
params['list_start'] = int(REQUEST.form.pop('list_start', 0)) params = selection.getParams()
selection.edit(params=params) params['list_start'] = int(REQUEST.form.pop('list_start', 0))
self.uncheckAll(list_selection_name, listbox_uid) selection.edit(params=params)
self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string)
# PlanningBox related methods # PlanningBox related methods
......
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