[Mpuls-commits] r4285 - base/trunk/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 30 18:32:52 CET 2010


Author: torsten
Date: 2010-11-30 18:32:52 +0100 (Tue, 30 Nov 2010)
New Revision: 4285

Modified:
   base/trunk/mpulsweb/controllers/formularpage.py
Log:
* mpulsweb/controllers/formularpage.py (get_rendered_page): Issue930: Added help icon to page header if help is available for page.


Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2010-11-30 17:24:00 UTC (rev 4284)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2010-11-30 17:32:52 UTC (rev 4285)
@@ -22,8 +22,8 @@
 
 from mpulsweb.lib.base import BaseController, render, session
 from mpulsweb.lib.renderer import ViewRenderer, RepeatGroupRenderer, \
-     ErrorRenderer, apply_hidden_booleans, get_child_num
-from mpulsweb.lib.helpers import url_for, dd_mm_YYYY as format_date
+     ErrorRenderer, apply_hidden_booleans, get_child_num, icon
+from mpulsweb.lib.helpers import url_for, dd_mm_YYYY as format_date, tag
 from mpulsweb.model.phase import PhaseFactory, PC_MANUAL, PC_FULLAUTO
 
 
@@ -80,9 +80,21 @@
 
     if page:
         page_label = page.getMeta().getDescription()
+
+        # Check if there is help available for this page
+        if page.getMeta().hasHelp():
+            help = []
+            help.append(tag("a", target="_blank",
+                           href=url_for(controller="/annotations",
+                                        action="help", id=page.getMeta().getName())))
+            help.append(tag("img", src=icon("formular/help.png"), alt="help",
+                        width=12,
+                        height=12))
+            help.append('</a>')
+
         if isinstance(page.getParent(), RepeatInstanceNode):
             page_label += " %s" % get_child_num(page.getParent())
-        c.formularheader = ("<h1>%s</h1>" % escape(page_label))
+        c.formularheader = ("<h1>%s %s</h1>" % (escape(page_label), "".join(help)))
         if isinstance(page, RepeatInstanceContainerNode):
             renderer = RepeatGroupRenderer(instance_tree, page,
                                            session.get('render_mode',



More information about the Mpuls-commits mailing list