[Mpuls-commits] r3264 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 29 12:12:23 CEST 2010
Author: torsten
Date: 2010-07-29 12:12:22 +0200 (Thu, 29 Jul 2010)
New Revision: 3264
Modified:
base/trunk/mpulsweb/lib/navigation.py
Log:
* mpulsweb/lib/navigation.py (TreeItem.render): Enumerate Pages of RG in Navigation.
Modified: base/trunk/mpulsweb/lib/navigation.py
===================================================================
--- base/trunk/mpulsweb/lib/navigation.py 2010-07-29 08:33:40 UTC (rev 3263)
+++ base/trunk/mpulsweb/lib/navigation.py 2010-07-29 10:12:22 UTC (rev 3264)
@@ -168,7 +168,7 @@
cur = cur.parent
return opened
- def render(self, page, out, get_image, error_lookup):
+ def render(self, page, out, get_image, error_lookup, num=0):
out.append(u'<tr>')
selected = page == self.key
has_error = self in error_lookup
@@ -206,9 +206,12 @@
u' height="16"'
% (_('entry'), _('Open page'))))
icon.append('</a>')
+ label = self.description
+ if self.parent.repeat:
+ label += " %s" % (num+1)
entry.append(u'<a href="%s" %s>%s</a>'
% (select_link, CHECK_MODIFICATION,
- escape(self.description)))
+ escape(label)))
selected = (str(self.key) == str(session.get('navigation.selectedpage'))
and "selected" or "")
@@ -217,6 +220,7 @@
% (" " * (self.get_depth() - 1), "".join(icon)))
out.append(u'</td>')
out.append(u'<td class="%s" width="90%%">' % selected)
+ label = "".join(entry)
out.append('%s' % ("".join(entry)))
out.append(u'</td>')
@@ -234,8 +238,8 @@
out.append(u'</tr>')
if self.is_open and self.children:
- for child in self.children:
- child.render(page, out, get_image, error_lookup)
+ for num, child in enumerate(self.children):
+ child.render(page, out, get_image, error_lookup, num)
def set_open(self, flag):
self.is_open = flag
@@ -386,8 +390,8 @@
self.root.build_error_lookup(error_lookup, error_pages)
out = [u'<table class="navigation">']
get_image = file_cache.get_image
- for child in self.root.children:
- child.render(page, out, get_image, error_lookup)
+ for num, child in enumerate(self.root.children):
+ child.render(page, out, get_image, error_lookup, num)
out.append(u"</table>")
return u"".join(out)
More information about the Mpuls-commits
mailing list