[Mpuls-commits] r3421 - in jmd/trunk: . jmdstrukturweb/templates/phase

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 17 16:14:17 CEST 2010


Author: bh
Date: 2010-08-17 16:14:15 +0200 (Tue, 17 Aug 2010)
New Revision: 3421

Modified:
   jmd/trunk/ChangeLog
   jmd/trunk/jmdstrukturweb/templates/phase/phase.mako
Log:
* jmdstrukturweb/templates/phase/phase.mako: Make this template
work again with current mpuls base by copying all changes from
base (r3307) while keeping the duration deactivated.


Modified: jmd/trunk/ChangeLog
===================================================================
--- jmd/trunk/ChangeLog	2010-08-17 13:40:28 UTC (rev 3420)
+++ jmd/trunk/ChangeLog	2010-08-17 14:14:15 UTC (rev 3421)
@@ -1,5 +1,11 @@
 2010-08-17  Bernhard Herzog  <bh at intevation.de>
 
+	* jmdstrukturweb/templates/phase/phase.mako: Make this template
+	work again with current mpuls base by copying all changes from
+	base (r3307) while keeping the duration deactivated.
+
+2010-08-17  Bernhard Herzog  <bh at intevation.de>
+
 	* jmdstrukturweb/lib/search.py (CaseSearch.get_where): Removed.
 	The implementation was an incorrect one from an old waska or wasko
 	code-base anyway and the base class method should be fine in

Modified: jmd/trunk/jmdstrukturweb/templates/phase/phase.mako
===================================================================
--- jmd/trunk/jmdstrukturweb/templates/phase/phase.mako	2010-08-17 13:40:28 UTC (rev 3420)
+++ jmd/trunk/jmdstrukturweb/templates/phase/phase.mako	2010-08-17 14:14:15 UTC (rev 3421)
@@ -31,56 +31,85 @@
       <% phases_are_valid = c.phases.is_valid() %>
       <% current_phase = c.phases.get_current_phase_id() %>
       % for num, phase in enumerate(c.phases): 
+
       <% p1, p2 = phase.getStart(), phase.getEnd()  %>
-      <tr class="${(num%2) and 'hl' or ''}">
-        <td rowspan="2" class="bold center middle">
-          ${phase.getDescription()}<br>
-          <span class="note">
-          % if p1.is_active():
-            ${_('Running')}
-          % elif p2.is_active():
-            ${_('Finished')}
-          % elif (p2.id in c.phases.get_path(current_phase)) or (p1.id in c.phases.get_path(current_phase)):
-            ${_('Finished')}
-          % else:
-            ${_('Not yet started')}
-          % endif
-          </span>
-        </td>
-        % if p1.is_ok() and (c.phases.is_on_path(p1.id, current_phase,True) or c.phases.is_on_path(current_phase, p1.id, True)): 
+      ## Only show phases which are are on the path of the current phase, or
+      ##are after the current path
+      % if c.phases.is_on_path(p1.id, current_phase) \
+        or c.phases.is_on_path(p2.id, current_phase) \
+        or p1.id in c.phases.get_reachable_path(current_phase, False) \
+        or p2.id in c.phases.get_reachable_path(current_phase, False) \
+        or current_phase == '-1':
+        <tr class="${(num%2) and 'hl' or ''}">
+          <td rowspan="2" class="bold center middle">
+            ${phase.getDescription()}<br>
+            <span class="note">
+            % if p1.is_active():
+              ${_('Running')}
+            % elif p2.is_active():
+              ${_('Finished')}
+            % elif (p2.id in c.phases.get_path(current_phase)) or (p1.id in c.phases.get_path(current_phase)):
+              ${_('Finished')}
+            % else:
+              ${_('Not yet started')}
+            % endif
+            </span>
+          </td>
+          % if p1.is_ok() and (c.phases.is_on_path(p1.id, current_phase,True) or c.phases.is_on_path(current_phase, p1.id, True)): 
 
-        <td class="ok"></td>
-        % else:
-        <td class="error"></td>
-        % endif
-        <td class="note" style="border-bottom: 1pt dotted; border-color: #000;">${h.literal(p1.getLinks())}</td>
-        <td class="note center middle" style="border-bottom: 1pt dotted; border-color: #000;">
-          ${h.NA(h.format_date(p1.getTime()))}
-        </td>
-        <td class="actions middle" style="border-bottom: 1pt dotted; border-color: #000;">
-          % if p1.is_ok() and phases_are_valid and p1.is_neighbor(current_phase):
-            <input type="submit" name="${p1.id}" value="${_('Start')}">
+          <td class="ok"></td>
           % else:
-            <input type="submit" name="${p1.id}" value="${_('Start')}" disabled="disabled">
+          <td class="error"></td>
           % endif
-        </td>
-      </tr>
-      <tr class="${(num%2) and 'hl' or ''}">
-        % if p2.is_ok() and (c.phases.is_on_path(p2.id, current_phase, True) or c.phases.is_on_path(current_phase, p2.id, True)): 
-        <td class="ok"></td>
-        % else:
-        <td class="error"></td>
-        % endif
-        <td class="note">${h.literal(p2.getLinks())}</td>
-        <td class="note center middle">${h.NA(h.format_date(p2.getTime()))}</td>
-        <td class="actions">
-          % if p2.is_ok() and phases_are_valid and p2.is_neighbor(current_phase):
-            <input type="submit" name="${p2.id}" value="${_('Finish')}">
+          <td class="note" style="border-bottom: 1pt dotted; border-color: #000;">
+            <% pages, order = p1.getLinks() %>
+            % for key in order:
+              <% fields = pages.get(key, []) %>
+              % if len(fields) > 0:
+                <strong>${key}</strong>:
+                ${h.literal(", ".join([f.get_link() for f in fields]))}
+              % endif
+              <br>
+            % endfor
+          </td>
+          <td class="note center middle" style="border-bottom: 1pt dotted; border-color: #000;">
+            ${h.NA(h.format_date(p1.getTime()))}
+          </td>
+          <td class="actions middle" style="border-bottom: 1pt dotted; border-color: #000;">
+            % if p1.is_ok() and phases_are_valid and p1.is_neighbor(current_phase) and h.hasRole(['cm']) and session.get('case').getState().getState() == 1:
+              <input type="submit" name="${p1.id}" value="${_('Start')}">
+            % else:
+              <input type="submit" name="${p1.id}" value="${_('Start')}" disabled="disabled">
+            % endif
+          </td>
+        </tr>
+        <tr class="${(num%2) and 'hl' or ''}">
+          % if p2.is_ok() and (c.phases.is_on_path(p2.id, current_phase, True) or c.phases.is_on_path(current_phase, p2.id, True)): 
+          <td class="ok"></td>
           % else:
-            <input type="submit" name="${p2.id}" value="${_('Finish')}" disabled="disabled">
+          <td class="error"></td>
           % endif
-        </td>
-      </tr>
+          <td class="note">
+            <% pages, order = p2.getLinks() %>
+            % for key in order:
+              <% fields = pages.get(key) %>
+              % if len(fields) > 0:
+                <strong>${key}</strong>:
+                ${h.literal(", ".join([f.get_link() for f in fields]))}
+              % endif
+              <br>
+            % endfor
+          </td>
+          <td class="note center middle">${h.NA(h.format_date(p2.getTime()))}</td>
+          <td class="actions">
+            % if p2.is_ok() and phases_are_valid and p2.is_neighbor(current_phase) and h.hasRole(['cm']) and session.get('case').getState().getState() == 1:
+              <input type="submit" name="${p2.id}" value="${_('Finish')}">
+            % else:
+              <input type="submit" name="${p2.id}" value="${_('Finish')}" disabled="disabled">
+            % endif
+          </td>
+        </tr>
+      % endif
       % endfor
     </table>
   </form>



More information about the Mpuls-commits mailing list