[Mpuls-commits] r3457 - in base/trunk: . mpulsweb/controllers mpulsweb/templates/evaluation

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Aug 26 16:25:47 CEST 2010


Author: bh
Date: 2010-08-26 16:25:46 +0200 (Thu, 26 Aug 2010)
New Revision: 3457

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/evaluate.py
   base/trunk/mpulsweb/templates/evaluation/evaluate.mako
Log:
* mpulsweb/controllers/evaluate.py (EvaluateController.evaluate):
Instead of using either evaluate.mako or evaluate_adele.mako,
always use evaluate.mako and set c.adele_evaluation to indicate
whether it's an adele evaluation or not.

* mpulsweb/templates/evaluation/evaluate.mako: evaluate.mako and
evaluate_adele.mako are almost identical.  The only difference is
that in the adele version some input elements are disabled.
Extend evaluate.mako a bit so that it can be for both the normal
evaluations and the adele evaluations in order to reduce code
duplication


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-26 13:09:19 UTC (rev 3456)
+++ base/trunk/ChangeLog	2010-08-26 14:25:46 UTC (rev 3457)
@@ -1,3 +1,17 @@
+2010-08-26  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/templates/evaluation/evaluate.mako: evaluate.mako and
+	evaluate_adele.mako are almost identical.  The only difference is
+	that in the adele version some input elements are disabled.
+	Extend evaluate.mako a bit so that it can be for both the normal
+	evaluations and the adele evaluations in order to reduce code
+	duplication
+
+	* mpulsweb/controllers/evaluate.py (EvaluateController.evaluate):
+	Instead of using either evaluate.mako or evaluate_adele.mako,
+	always use evaluate.mako and set c.adele_evaluation to indicate
+	whether it's an adele evaluation or not.
+
 2010-08-26 Roland Geider <roland.geider at intevation.de>
 
 	* mpulsweb/public/styles/print.css: don't hide widget-DIVs in the

Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py	2010-08-26 13:09:19 UTC (rev 3456)
+++ base/trunk/mpulsweb/controllers/evaluate.py	2010-08-26 14:25:46 UTC (rev 3457)
@@ -129,9 +129,11 @@
         if id == '0':
             c.evaloptions['phase'] = g.mpuls_config.get('evaluations',
                                                         'adele-phases')
-            form = render('/evaluation/evaluate_adele.mako')
+            c.adele_evaluation = True
         else:
-            form = render('/evaluation/evaluate.mako')
+            c.adele_evaluation = False
+            pass
+        form = render('/evaluation/evaluate.mako')
         return formencode.htmlfill.render(form, defaults=c.evaloptions,
                                           errors={}, auto_insert_errors=False)
 

Modified: base/trunk/mpulsweb/templates/evaluation/evaluate.mako
===================================================================
--- base/trunk/mpulsweb/templates/evaluation/evaluate.mako	2010-08-26 13:09:19 UTC (rev 3456)
+++ base/trunk/mpulsweb/templates/evaluation/evaluate.mako	2010-08-26 14:25:46 UTC (rev 3457)
@@ -14,6 +14,12 @@
 </div>
 <div>
 <form action="${h.url_for(controller='/evaluate', action='evaluateAction')}" method="POST" target="_blank">
+<% 
+   if c.adele_evaluation:
+       adele_disabled = h.literal('disabled="disabled"')
+   else:
+       adele_disabled = ""
+%>
 <input type="hidden" name="id">
 <table>
   <tr>
@@ -25,15 +31,16 @@
     <td>${c.evalconfig.get_setdesc()}</td>
   </tr>
   <tr>
-  <tr>
     <td class="label">Phase</td>
     <td>
-      <input type="checkbox" name="phase" id="phase_x" value="-1"> 
+      <input type="checkbox" name="phase" id="phase_x" value="-1" 
+             ${adele_disabled}>
       <label for="phase_x">
         ${_('Unknown')}<br>
       </label>
       % for n,p in enumerate(g.mpuls_config.get('phases', 'phases')):
-        <input type="checkbox" name="phase" id="phase_${n}" value="${p}"> 
+        <input type="checkbox" name="phase" id="phase_${n}" value="${p}" 
+               ${adele_disabled}>
           <label for="phase_${n}">
             ${g.mpuls_config.get('phases', 'description')[0].get(p)}<br>
           </label>
@@ -43,13 +50,15 @@
   <tr>
     <td class="label">Start</td>
     <td>
-      <input type="text" name="start_date" class="datefield"><form:error name="start_date" format="">
+      <input type="text" name="start_date" class="datefield" ${adele_disabled}>
+      <form:error name="start_date" format="">
     </td>
   </tr>
   <tr>
     <td class="label">Ende</td>
     <td>
-      <input type="text" name="end_date" class="datefield"><form:error name="end_date" format="">
+      <input type="text" name="end_date" class="datefield" ${adele_disabled}>
+      <form:error name="end_date" format="">
     </td>
   </tr>
   % if session.has_key('evaluation.options'):



More information about the Mpuls-commits mailing list