[Mpuls-commits] r158 - in waska/trunk: . waskaweb/model waskaweb/public/styles waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 12 18:29:02 CEST 2008


Author: torsten
Date: 2008-09-12 18:29:01 +0200 (Fri, 12 Sep 2008)
New Revision: 158

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/model/phases.py
   waska/trunk/waskaweb/public/styles/color3.css
   waska/trunk/waskaweb/templates/casemanagement/phase.mako
Log:
Fixed switching to phases


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-12 14:53:16 UTC (rev 157)
+++ waska/trunk/ChangeLog.txt	2008-09-12 16:29:01 UTC (rev 158)
@@ -11,6 +11,16 @@
 
 2008-09-12	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
+	Fixed switching to phases
+
+	* waskaweb/model/phases.py,
+	  waskaweb/public/styles/color3.css,
+	  waskaweb/templates/casemanagement/phase.mako: Phases can now only be
+	  switched in forward direction. A short info is rendered on each
+	  phase if the phase was finished or currently running.
+
+2008-09-12	Torsten Irlaender  <torsten.irlaender at intevation.de>
+
 	Added new search option for cases after a current date
 
 	* waskaweb/controllers/waska.py,

Modified: waska/trunk/waskaweb/model/phases.py
===================================================================
--- waska/trunk/waskaweb/model/phases.py	2008-09-12 14:53:16 UTC (rev 157)
+++ waska/trunk/waskaweb/model/phases.py	2008-09-12 16:29:01 UTC (rev 158)
@@ -29,7 +29,7 @@
 #
 
 from waskaweb.model.phase_transition import \
-    phase_neighbors, phase_symbol, phase_description
+    phase_neighbors, phase_symbol, phase_description, phase_predecessors_path
 
 class Phase:
 
@@ -64,16 +64,16 @@
             return False
 
         for pred in self.preds:
-            if not pred.isComplete():
+            if not pred.isRecursiveComplete():
                 return False
 
         return True
 
-    def isPredecessor(self, other):
-        for p in self.preds:
-            if p.phase == other.phase:
-                return True
-        return False
+    def hasPredecessor(self, other):
+        #for p in self.preds:
+        #    if other.phase == p.phase or p.hasPredecessor(other): return True
+        #return False
+        return other.phase in phase_predecessors_path(self.phase)
 
     def getTime(self):
         return self.time

Modified: waska/trunk/waskaweb/public/styles/color3.css
===================================================================
--- waska/trunk/waskaweb/public/styles/color3.css	2008-09-12 14:53:16 UTC (rev 157)
+++ waska/trunk/waskaweb/public/styles/color3.css	2008-09-12 16:29:01 UTC (rev 158)
@@ -138,9 +138,6 @@
 	color:#a5103b;
 }
 
-table#cmphases td.cm_phase_state {
-	background:#d5d5d5;
-}
 table#cmphases td.cm_phase_state_valid {
 	background:green;
 }

Modified: waska/trunk/waskaweb/templates/casemanagement/phase.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-09-12 14:53:16 UTC (rev 157)
+++ waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-09-12 16:29:01 UTC (rev 158)
@@ -18,13 +18,15 @@
       <th class="table_header_h" width="15%">${_('case_cm_phase_time')}</th>
       <th style="text-align:right" class="table_header_h" width="20%">${_('case_cm_phase_change')}</th>
     </tr>
-    % for phase_pair in c.phase_pairs:
+    % for count, phase_pair in enumerate(c.phase_pairs):
     <% p1, p2 = phase_pair.getStart(), phase_pair.getEnd()  %>
     <tr>
-      <td rowspan="2" class="cm_phase_state">
+      <td rowspan="2" class="cm_phase_state ${(count%2) and 'table_row_h' or ''}">
         ${phase_pair.getDescription() | h}
         % if p1.isRunning():
             <br>(läuft)
+        % elif c.current_phase.hasPredecessor(p1):
+            <br>(beendet)
         % endif
       </td>
       % if p1.isComplete():
@@ -37,10 +39,10 @@
       </td>
       <td>${h.dd_mm_YYYY(p1.getTime(), '-/-')}</td>
       <td style="text-align:right">
-        % if p1.isRecursiveComplete() and not p1.isRunning() and p1.isNeighbor(c.current_phase) and not p1.isPredecessor(c.current_phase):
-            <input type="submit" value="Start ${phase_pair.getDescription()|h}" name="${p1.getLabel()|h}">
+        % if p1.isRecursiveComplete() and not p1.isRunning() and p1.isNeighbor(c.current_phase) and not c.current_phase.hasPredecessor(p1):
+            <input type="submit" value="Start" name="${p1.getLabel()|h}">
         % else:
-            <input type="submit" value="Start ${phase_pair.getDescription()|h}" name="${p1.getLabel()|h}"
+            <input type="submit" value="Start" name="${p1.getLabel()|h}"
               disabled="disabled">
         % endif
       </td>
@@ -56,10 +58,10 @@
       </td>
       <td class="table_row_h">${h.dd_mm_YYYY(p2.getTime(), '-/-')}</td>
       <td style="text-align:right" class="table_row_h">
-        % if p2.isRecursiveComplete() and p2.isNeighbor(c.current_phase) and not p2.isPredecessor(c.current_phase):
-            <input type="submit" value="Ende ${p2.getDescription()|h}" name="${p2.getLabel()|h}">
+        % if p2.isRecursiveComplete() and p2.isNeighbor(c.current_phase) and not c.current_phase.hasPredecessor(p2):
+            <input type="submit" value="Ende" name="${p2.getLabel()|h}">
         % else:
-            <input type="submit" value="Ende ${p2.getDescription()|h}" name="${p2.getLabel()|h}" 
+            <input type="submit" value="Ende" name="${p2.getLabel()|h}" 
               disabled="disabled">
         % endif
       </td>



More information about the Mpuls-commits mailing list