[Mpuls-commits] r1073 - wasko/branches/2.0/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 1 15:32:30 CET 2010


Author: torsten
Date: 2010-02-01 15:32:28 +0100 (Mon, 01 Feb 2010)
New Revision: 1073

Modified:
   wasko/branches/2.0/waskaweb/controllers/logbook.py
Log:
* waskaweb/templates/logbook/overview.mako (newAction): Send sort params as
GET params
* waskaweb/controllers/logbook.py (get_sort): Extract sort params from
GET params


Modified: wasko/branches/2.0/waskaweb/controllers/logbook.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/logbook.py	2010-02-01 14:30:41 UTC (rev 1072)
+++ wasko/branches/2.0/waskaweb/controllers/logbook.py	2010-02-01 14:32:28 UTC (rev 1073)
@@ -67,18 +67,24 @@
 
 log = logging.getLogger(__name__)
 
+def get_sort(params):
+    sort = params.get('sort_field', 'id')
+    order = params.get('sort_order', 'asc')
+    return sort, order
+
 class LogbookController(BaseController):
 
     @checkRole(('cm_ka'))
-    def index(self, id, sort_field='datum', sort_order='desc'):
-        return self.overview(id, sort_field, sort_order)
+    def index(self, id):
+        return self.overview(id)
 
-    def overview(self, id, sort_field='datum', sort_order='desc'):
+    def overview(self, id):
+        sort, order = get_sort(request.params)
         id = self._checkInt(id)
 
         # Load logbook
         logbook = Logbook()
-        logbook.loadById(int(id), sort_field, sort_order)
+        logbook.loadById(int(id), sort, order)
         c.logbook = logbook
 
         # Build evaluation
@@ -151,7 +157,7 @@
             logbook = Logbook(checker.getCaseId())
             logbook.addEntry(checker.getLogbookEntry())
             logbook.store(session['USER_AUTHORIZED'].id)
-            c.url_ok = "/case/logbook/%s" % str(session['case'].id)
+            c.url_ok = "/logbook/index/%s" % str(session['case'].id)
             c.success_for = CREATE_LOGBOOK_ENTRY_SUCCESS
             c.success_text = CREATE_LOGBOOK_ENTRY_SUCCESS_TEXT
             return render('/logbook/dialogs/success_create_logbook_entry.mako')



More information about the Mpuls-commits mailing list