[Erp5-report] r26571 - /erp5/trunk/products/ERP5Form/SelectionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 21 20:17:12 CEST 2009


Author: kazuhiko
Date: Tue Apr 21 20:17:11 2009
New Revision: 26571

URL: http://svn.erp5.org?rev=26571&view=rev
Log:
accept page_start param in nextPage, previousPage and setPage to specify the page number instead of specifying starting line number of the page.

Modified:
    erp5/trunk/products/ERP5Form/SelectionTool.py

Modified: erp5/trunk/products/ERP5Form/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/SelectionTool.py?rev=26571&r1=26570&r2=26571&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/SelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/SelectionTool.py [utf8] Tue Apr 21 20:17:11 2009
@@ -674,9 +674,13 @@
       selection = self.getSelectionFor(list_selection_name, REQUEST)
       if selection is not None:
         params = selection.getParams()
-        lines = params.get('list_lines', 0)
-        start = REQUEST.form.pop('list_start', 0)
-        params['list_start'] = int(start) + int(lines)
+        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 + lines
         selection.edit(params=params)
       self.uncheckAll(list_selection_name, listbox_uid)
       return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
@@ -690,9 +694,13 @@
       selection = self.getSelectionFor(list_selection_name, REQUEST)
       if selection is not None:
         params = selection.getParams()
-        lines = params.get('list_lines', 0)
-        start = REQUEST.form.pop('list_start', 0)
-        params['list_start'] = max(int(start) - int(lines), 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'] = max(list_start - lines, 0)
         selection.edit(params=params)
       self.uncheckAll(list_selection_name, listbox_uid)
       return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
@@ -706,7 +714,13 @@
       selection = self.getSelectionFor(list_selection_name, REQUEST)
       if selection is not None:
         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)
         self.uncheckAll(list_selection_name, listbox_uid)
       return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string)




More information about the Erp5-report mailing list