[Mpuls-commits] r3241 - in base/trunk: . mpulsweb/model mpulsweb/templates/phase
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Jul 26 12:13:45 CEST 2010
Author: torsten
Date: 2010-07-26 12:13:44 +0200 (Mon, 26 Jul 2010)
New Revision: 3241
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/model/phase.py
base/trunk/mpulsweb/templates/phase/phase.mako
Log:
Issue871: Automatic hide phases in phasemodell which are in a another "phase-branch" the the current phase.
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-07-26 09:25:01 UTC (rev 3240)
+++ base/trunk/ChangeLog 2010-07-26 10:13:44 UTC (rev 3241)
@@ -1,3 +1,13 @@
+2010-07-26 Torsten Irländer <torsten.irlaender at intevation.de>
+
+ Issue871:
+ * mpulsweb/model/phase.py (PhaseList.get_reachable_path): Fixed
+ traversion the path and collecting the reachable phases.
+ * mpulsweb/templates/phase/phase.mako: Only show phase which are a) on
+ the path (from root) up to the current path, or b) are after the
+ current path. So hide phases which are a a different branch of the
+ phase-tree and therefor now completely irrelevant.
+
2010-07-23 Bernhard Herzog <bh at intevation.de>
* mpulsweb/lib/renderer.py (ViewRenderer._renderRadio)
Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py 2010-07-26 09:25:01 UTC (rev 3240)
+++ base/trunk/mpulsweb/model/phase.py 2010-07-26 10:13:44 UTC (rev 3241)
@@ -155,13 +155,12 @@
phasepart_id'''
path = ['-1'] # default unknown phase
- if self.get_phase(phasepart_id).is_ok():
- for pp in self.suc.get(phasepart_id, []):
- if not self.get_phase(pp).is_ok() and only_reachable:
- continue
- path.extend(self.get_reachable_path(pp))
- path.append(pp)
- path.append(phasepart_id)
+ for pp in self.suc.get(phasepart_id, []):
+ if not self.get_phase(pp).is_ok() and only_reachable:
+ continue
+ path.extend(self.get_reachable_path(pp, only_reachable))
+ path.append(pp)
+ path.append(phasepart_id)
return path
def get_path(self, phasepart_id, only_reachable=False):
Modified: base/trunk/mpulsweb/templates/phase/phase.mako
===================================================================
--- base/trunk/mpulsweb/templates/phase/phase.mako 2010-07-26 09:25:01 UTC (rev 3240)
+++ base/trunk/mpulsweb/templates/phase/phase.mako 2010-07-26 10:13:44 UTC (rev 3241)
@@ -31,56 +31,64 @@
<% 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):
+ <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) and h.hasRole(['cm']) and session.get('case').getState().getState() == 1:
- <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) and h.hasRole(['cm']) and session.get('case').getState().getState() == 1:
- <input type="submit" name="${p2.id}" value="${_('Finish')}">
+ <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) 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">${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) 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