[Mpuls-commits] r5437 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Oct 10 11:21:56 CEST 2011
Author: ludwig
Date: 2011-10-10 11:21:56 +0200 (Mon, 10 Oct 2011)
New Revision: 5437
Modified:
base/trunk/mpulsweb/lib/navigation.py
Log:
Issue 1269: Sort childen of a rg with get_ordered_repeat_group.
The order of the groups in the navigation and in the page are now the same.
Modified: base/trunk/mpulsweb/lib/navigation.py
===================================================================
--- base/trunk/mpulsweb/lib/navigation.py 2011-10-10 08:07:50 UTC (rev 5436)
+++ base/trunk/mpulsweb/lib/navigation.py 2011-10-10 09:21:56 UTC (rev 5437)
@@ -37,6 +37,7 @@
from formed.instance.tree import InstanceNode, RepeatInstanceContainerNode, \
RepeatInstanceNode, IDENTIFIER_SEPARATOR
from formed.instance.backends.postgres import DBFactory as InstanceFactory
+from formed.renderer.html import TreeFormData
from mpulsweb.lib.translation import _
from mpulsweb.lib.db import PostgresDBInterface
@@ -190,7 +191,7 @@
icon = []
entry = []
- if self.is_child() or self.repeat: # Render RG als page (issue893)
+ if self.is_child():
select_link = select_item_url(self.key)
icon.append(u'<a href="%s" %s>'
% (select_link, CHECK_MODIFICATION))
@@ -253,8 +254,7 @@
out.append(u'</tr>')
- # Ignore rendering RG als page (issue893)
- if self.is_open and self.children and not self.repeat:
+ if self.is_open and self.children:
for num, child in enumerate(self.children):
child.render(page, out, get_image, error_lookup, num)
@@ -319,14 +319,21 @@
if isinstance(nc, RepeatInstanceContainerNode):
log.debug('Found repeatgroup container: %s', nc.getIdentifier())
n.repeat = True
+ if not self.first:
+ self.first = n
if self.prev:
self.prev.next = n
self.prev = n
-
- for child in nc.getChildren():
- c = self.build(child, n)
- if c:
- children.append(c)
+ form_data = TreeFormData(nc.getInstanceTree())
+ for child in form_data.get_ordered_repeat_group(meta):
+ c = self.build(child, n)
+ if c:
+ children.append(c)
+ else:
+ for child in nc.getChildren():
+ c = self.build(child, n)
+ if c:
+ children.append(c)
n.key = nc.getIdentifier()
# Try to reopen already opened folders.
log.debug('key: %s, open: %s' % (n.key, self.openfolders))
More information about the Mpuls-commits
mailing list