[Mpuls-commits] r96 - in waska/trunk: . waskaweb/controllers waskaweb/lib waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Aug 28 10:27:38 CEST 2008


Author: teichmann
Date: 2008-08-28 10:27:37 +0200 (Thu, 28 Aug 2008)
New Revision: 96

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/case.py
   waska/trunk/waskaweb/lib/needed.py
   waska/trunk/waskaweb/templates/casemanagement/phase.mako
Log:
Build link list for phases


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-08-28 08:18:30 UTC (rev 95)
+++ waska/trunk/ChangeLog.txt	2008-08-28 08:27:37 UTC (rev 96)
@@ -1,3 +1,11 @@
+2008-08-28  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
+	* waskaweb/controllers/case.py: pass link list to template
+
+	* waskaweb/lib/needed.py: generate link list for phases
+
+	* waskaweb/templates/casemanagement/phase.mako: use link list.
+
 2008-08-28	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
 	Added additional status message regarding privacy when saving data in

Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py	2008-08-28 08:18:30 UTC (rev 95)
+++ waska/trunk/waskaweb/controllers/case.py	2008-08-28 08:27:37 UTC (rev 96)
@@ -677,6 +677,7 @@
         id     = self._checkInt(id)
         case   = self._loadCase(id)
         fields = case.getRequiredFields()
+        c.links_phase1 = fields.getLinkListForPhase('beratung')
         return render('/casemanagement/phase.mako')
 
     @checkRole('cm_ka')

Modified: waska/trunk/waskaweb/lib/needed.py
===================================================================
--- waska/trunk/waskaweb/lib/needed.py	2008-08-28 08:18:30 UTC (rev 95)
+++ waska/trunk/waskaweb/lib/needed.py	2008-08-28 08:27:37 UTC (rev 96)
@@ -120,9 +120,36 @@
             for b in a:
                 b[1] = fields.get(b[0].getName())
 
+        print >> sys.stderr, repr(self.phases.keys())
+
         return True
 
     def getPhase(self, phase):
         return self.phases.get(phase)
 
+    def isPhaseComplete(self, phase):
+        try:
+            for l in self.phases[phase]:
+                if not l[1]:
+                    return False
+        except KeyError:
+            return False
+
+        return True
+
+    def getLinkListForPhase(self, phase):
+        try:
+            phase = self.phases[phase]
+        except KeyError:
+            return u""
+
+        out = []
+
+        for a in phase:
+            warn = (not a[1]) and ' class="required_missing"' or ""
+            link = '<a href="/required/%s"%s>%s</a>' % (a[0].getName(), warn, a[0].getDescription())
+            out.append(link)
+
+        return ',\n'.join(out)
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: waska/trunk/waskaweb/templates/casemanagement/phase.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-08-28 08:18:30 UTC (rev 95)
+++ waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-08-28 08:27:37 UTC (rev 96)
@@ -34,15 +34,16 @@
     <tr>
       <td class="table_row_h cm_phase_state_invalid"></td>
       <td class="table_row_h required_field">
-        <a href="#">Datum Ende Beratung</a>, 
-        <a href="#">Datum Feststellung Übernahme in das CM</a>,
-        <a href="#" class="required_missing"> Geburtsdatum</a>, 
-        <a href="#">Geschlecht</a>, 
-        <a href="#">Muttersprache</a>, 
-        <a href="#">Geburtsland Mutter</a>, 
-        <a href="#">Geburtsland Vater</a>, 
-        <a href="#">Geburtsland Jugendlicher</a>, 
-        <a href="#">Feststellung Übernahme in das CM</a> 
+      ${c.links_phase1}
+##        <a href="#">Datum Ende Beratung</a>, 
+##        <a href="#">Datum Feststellung Übernahme in das CM</a>,
+##        <a href="#" class="required_missing"> Geburtsdatum</a>, 
+##        <a href="#">Geschlecht</a>, 
+##        <a href="#">Muttersprache</a>, 
+##        <a href="#">Geburtsland Mutter</a>, 
+##        <a href="#">Geburtsland Vater</a>, 
+##        <a href="#">Geburtsland Jugendlicher</a>, 
+##        <a href="#">Feststellung Übernahme in das CM</a> 
       </td>
       <td class="table_row_h">01.03.2008</td>
       <td style="text-align:right" class="table_row_h">



More information about the Mpuls-commits mailing list