Commit 33d0cd43 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

accept page_start param in nextPage, previousPage and setPage to specify the...

accept page_start param in nextPage, previousPage and setPage to specify the page number instead of specifying starting line number of the page.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26571 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent abd6d83e
...@@ -674,9 +674,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -674,9 +674,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
if selection is not None: if selection is not None:
params = selection.getParams() params = selection.getParams()
lines = params.get('list_lines', 0) lines = int(params.get('list_lines', 0))
start = REQUEST.form.pop('list_start', 0) form = REQUEST.form
params['list_start'] = int(start) + int(lines) if form.has_key('page_start'):
list_start = (int(form.pop('page_start', 0)) - 1) * lines
else:
list_start = int(form.pop('list_start', 0))
params['list_start'] = list_start + lines
selection.edit(params=params) 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)
...@@ -690,9 +694,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -690,9 +694,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
if selection is not None: if selection is not None:
params = selection.getParams() params = selection.getParams()
lines = params.get('list_lines', 0) lines = int(params.get('list_lines', 0))
start = REQUEST.form.pop('list_start', 0) form = REQUEST.form
params['list_start'] = max(int(start) - int(lines), 0) if form.has_key('page_start'):
list_start = (int(form.pop('page_start', 0)) - 1) * lines
else:
list_start = int(form.pop('list_start', 0))
params['list_start'] = max(list_start - lines, 0)
selection.edit(params=params) 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)
...@@ -706,7 +714,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -706,7 +714,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
selection = self.getSelectionFor(list_selection_name, REQUEST) selection = self.getSelectionFor(list_selection_name, REQUEST)
if selection is not None: if selection is not None:
params = selection.getParams() params = selection.getParams()
params['list_start'] = int(REQUEST.form.pop('list_start', 0)) lines = int(params.get('list_lines', 0))
form = REQUEST.form
if form.has_key('page_start'):
list_start = (int(form.pop('page_start', 0)) - 1) * lines
else:
list_start = int(form.pop('list_start', 0))
params['list_start'] = list_start
selection.edit(params=params) 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, query_string=query_string) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string)
......
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