[Mpuls-commits] r3830 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 30 13:14:01 CEST 2010


Author: bh
Date: 2010-09-30 13:13:59 +0200 (Thu, 30 Sep 2010)
New Revision: 3830

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/case.py
Log:
* mpulsweb/controllers/case.py (CaseController.printAll): Include
headings of hierarchy elements that do not have pages of their own
and would otherwise be omitted from the printed case.
Fixes part of mpuls/issue1006


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-29 14:55:14 UTC (rev 3829)
+++ base/trunk/ChangeLog	2010-09-30 11:13:59 UTC (rev 3830)
@@ -1,3 +1,10 @@
+2010-09-30  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/controllers/case.py (CaseController.printAll): Include
+	headings of hierarchy elements that do not have pages of their own
+	and would otherwise be omitted from the printed case.
+	Fixes part of mpuls/issue1006
+
 2010-09-29  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/i18n/de/LC_MESSAGES/mpulsweb.po: The translations for

Modified: base/trunk/mpulsweb/controllers/case.py
===================================================================
--- base/trunk/mpulsweb/controllers/case.py	2010-09-29 14:55:14 UTC (rev 3829)
+++ base/trunk/mpulsweb/controllers/case.py	2010-09-30 11:13:59 UTC (rev 3830)
@@ -296,9 +296,28 @@
         session.save()
         digest = render('/casemanagement/digest_body.mako')
         out.append(digest)
+        printed_headings = set()
         navigation = session.get('navigation.tree')
         if navigation:
             for item in navigation.getAllItems():
+                # create the headings for all hierarchy elements that
+                # have no page of their own.  We can do that by looking
+                # at all the parents of the current item that have not
+                # yet been used.
+                headings = []
+                parent = item.parent
+                while parent is not None:
+                    if parent not in printed_headings:
+                        if parent.description:
+                            # Ideally, we should be using different
+                            # levels of hierarchies, but currently all
+                            # headings are H1 headings
+                            headings.append("<h1>%s</h1>\n"
+                                            % parent.description)
+                        printed_headings.add(parent)
+                    parent = parent.parent
+                out.extend(reversed(headings))
+
                 out.append(get_rendered_page(item.key))
         c.formular = "".join(out)
         session['render_mode'] = render_mode



More information about the Mpuls-commits mailing list