[Mpuls-commits] r2993 - in jmd/trunk: . jmdweb/model jmdweb/templates

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jun 10 18:28:49 CEST 2010


Author: bh
Date: 2010-06-10 18:28:47 +0200 (Thu, 10 Jun 2010)
New Revision: 2993

Modified:
   jmd/trunk/ChangeLog
   jmd/trunk/jmdweb/model/struktur.py
   jmd/trunk/jmdweb/templates/main.mako
Log:
* jmdweb/model/struktur.py (struktur_part_available): New.
Determines whether the strukturpart is available.

* jmdweb/templates/main.mako: Only show struktur-part links if the
struktur-part is actually available.


Modified: jmd/trunk/ChangeLog
===================================================================
--- jmd/trunk/ChangeLog	2010-06-10 15:08:59 UTC (rev 2992)
+++ jmd/trunk/ChangeLog	2010-06-10 16:28:47 UTC (rev 2993)
@@ -1,3 +1,11 @@
+2010-06-10  Bernhard Herzog  <bh at intevation.de>
+
+	* jmdweb/model/struktur.py (struktur_part_available): New.
+	Determines whether the strukturpart is available.
+
+	* jmdweb/templates/main.mako: Only show struktur-part links if the
+	struktur-part is actually available.
+
 2010-05-18  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* jmdstruktur/model/appointment.py,
@@ -3,4 +11,5 @@
 	  jmdstruktur/controllers/jmdstruktur.py: New controller and model for
 	  jmdstruktur specific reminders
+
 2010-06-10  Bernhard Herzog  <bh at intevation.de>
 

Modified: jmd/trunk/jmdweb/model/struktur.py
===================================================================
--- jmd/trunk/jmdweb/model/struktur.py	2010-06-10 15:08:59 UTC (rev 2992)
+++ jmd/trunk/jmdweb/model/struktur.py	2010-06-10 16:28:47 UTC (rev 2993)
@@ -33,6 +33,13 @@
 from mpulsweb.model.user import UserListObject, parse_dblogin
 
 
+def struktur_part_available():
+    """Returns whether the struktur part is available.
+    The struktur part is available if the struktur database connection
+    is configured."""
+    return config.get('jmd.structuredb.host') is not None
+
+
 def get_db():
     current_user = session['USER_AUTHORIZED']
     return DB(**get_db_parameters(getDbName(),

Modified: jmd/trunk/jmdweb/templates/main.mako
===================================================================
--- jmd/trunk/jmdweb/templates/main.mako	2010-06-10 15:08:59 UTC (rev 2992)
+++ jmd/trunk/jmdweb/templates/main.mako	2010-06-10 16:28:47 UTC (rev 2993)
@@ -133,9 +133,9 @@
       </div>
     </div>
     <%
-    from jmdweb.model.struktur import is_struktur_user
+    from jmdweb.model.struktur import is_struktur_user, struktur_part_available
     %>
-    % if h.hasRole(['admin']) or is_struktur_user():
+    % if struktur_part_available() and (h.hasRole(['admin']) or is_struktur_user()):
       <div class="menu">
         <div class="actions">
           <h1>${_('Strukturdaten')}</h1>



More information about the Mpuls-commits mailing list