[Mpuls-commits] r5921 - in base/trunk/mpulsweb: lib model

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Apr 13 12:31:49 CEST 2012


Author: ludwig
Date: 2012-04-13 12:31:49 +0200 (Fri, 13 Apr 2012)
New Revision: 5921

Modified:
   base/trunk/mpulsweb/lib/helpers.py
   base/trunk/mpulsweb/model/phase.py
Log:
Issue 3010: Add code to make case editable, if editor clicks on a required field
in the phase overview.
Uses role name 'Verwaltung' to differ between editor users and admin users.
Admin users are not allowed to edit a case.


Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py	2012-04-13 08:08:10 UTC (rev 5920)
+++ base/trunk/mpulsweb/lib/helpers.py	2012-04-13 10:31:49 UTC (rev 5921)
@@ -415,7 +415,7 @@
         return empty
     return dd_mm_YYYY(d) + " " + HH_MM(d)
 
-def get_formular_url(formed, id, name, page=None):
+def get_formular_url(formed, id, name, page=None, action_arg='select'):
     # id is like fieldname:rgid:caseid
     # The handling of links for Element in RG differs depending if they are
     # located within a outline RG or not
@@ -434,7 +434,7 @@
         # NOTE: Nested outline RG are not supported.
         element_id = ":".join(id.split(':')[1:][-2:])
     anchor_id = ":".join(id.split(':')[1:])
-    return  url(controller='formularpage', action='select',
+    return  url(controller='formularpage', action=action_arg,
             id=('%s:%s' % (page, element_id)),
             anchor=('%s:%s' % (name,
                 anchor_id)))

Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py	2012-04-13 08:08:10 UTC (rev 5920)
+++ base/trunk/mpulsweb/model/phase.py	2012-04-13 10:31:49 UTC (rev 5921)
@@ -11,7 +11,7 @@
 from formed.instance.tree import PageInstanceNode
 from formed.meta.data import PageNode, RepeatNode
 
-from mpulsweb.lib.helpers import tag, literal, get_formular_url
+from mpulsweb.lib.helpers import tag, literal, get_formular_url, getRole
 from mpulsweb.lib.helper.case import walk_it 
 from mpulsweb.lib.db import PostgresDBInterface
 
@@ -450,8 +450,13 @@
             self.conditions.append(Condition(field, rule, it))
 
     def get_url(self):
+        role = getRole()
+        if role == 'Verwaltung':
+            action_arg = 'edit'
+        else:
+            action_arg = 'select'
         return get_formular_url(self.it.getFormEd(), self.id, self.name,
-                                self.page)
+                                self.page, action_arg=action_arg)
 
     def get_link(self):
         out = []



More information about the Mpuls-commits mailing list