[Mpuls-commits] r5529 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 3 09:19:43 CET 2011


Author: torsten
Date: 2011-11-03 09:19:41 +0100 (Thu, 03 Nov 2011)
New Revision: 5529

Modified:
   base/trunk/mpulsweb/model/phase.py
Log:
Issue2508: Fixed building of links for missing fields on phase-page.


Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py	2011-11-02 15:30:43 UTC (rev 5528)
+++ base/trunk/mpulsweb/model/phase.py	2011-11-03 08:19:41 UTC (rev 5529)
@@ -426,19 +426,32 @@
 
         self.name = meta.getName()
         self.label = meta.getDescription()
+
         for rule in rules:
             self.conditions.append(Condition(field, rule, it))
 
     def get_url(self):
-        # [1:] Remove fieldname
-        # [-2] Only use the remaining last to ids. This means that only one
-        # level of outline RG are supported yet.
-        element_id = ":".join(self.id.split(':')[1:][-2:])
+        # self.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
+        # RG Types:
+        # 0 = not in rg at all
+        # 1 = within embedded rg
+        # 2 = within outline rg
+        formed = self.it.getFormEd()
+        rg_type = formed.name2rgtype.get(self.name, 0)
+        if rg_type in (0,1):
+            # Ignore rgid, as it is not needed in this case.
+            element_id = ":".join(self.id.split(':')[1:][-1:])
+        else:
+            # NOTE: Nested outline RG are not supported.
+            element_id = ":".join(self.id.split(':')[1:][-2:])
         anchor_id = ":".join(self.id.split(':')[1:])
         return  url_for(controller='/formularpage', action='select',
                         id=('%s:%s' % (self.page, element_id)),
                         anchor=('%s:%s' % (self.name,
                         anchor_id)))
+
     def get_link(self):
         out = []
         if self.is_ok():



More information about the Mpuls-commits mailing list