[Mpuls-commits] r3392 - in base/trunk: . mpulsweb/controllers mpulsweb/templates/casemanagement
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Aug 13 10:00:28 CEST 2010
Author: torsten
Date: 2010-08-13 10:00:26 +0200 (Fri, 13 Aug 2010)
New Revision: 3392
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/case.py
base/trunk/mpulsweb/templates/casemanagement/digest.mako
base/trunk/mpulsweb/templates/casemanagement/digest_body.mako
Log:
Changed way of rendering the digest page. Makes it more easy to set up
configuration specific layout
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-08-12 17:59:18 UTC (rev 3391)
+++ base/trunk/ChangeLog 2010-08-13 08:00:26 UTC (rev 3392)
@@ -1,3 +1,13 @@
+2010-08-13 Torsten Irländer <torsten.irlaender at intevation.de>
+
+ * mpulsweb/templates/casemanagement/digest.mako: Moved rendering into
+ functions which can be overwritten to configuration specific
+ behaviour.
+ * mpulsweb/templates/casemanagement/digest_body.mako: Inherit from
+ digest.mako.
+ * mpulsweb/controllers/case.py (CaseController.digest): Render
+ digest_body.mako now
+
2010-08-12 Bernhard Herzog <bh at intevation.de>
* mpulsweb/lib/renderer.py (ViewRenderer.render)
Modified: base/trunk/mpulsweb/controllers/case.py
===================================================================
--- base/trunk/mpulsweb/controllers/case.py 2010-08-12 17:59:18 UTC (rev 3391)
+++ base/trunk/mpulsweb/controllers/case.py 2010-08-13 08:00:26 UTC (rev 3392)
@@ -106,7 +106,7 @@
c.daysToMaxSavetime = case.getState().daysToMaxSavetime()
c.maxsavetime = case.getState().getMaxSavetime()
c.finished = case.getState().isCmFinished()
- return render('/casemanagement/digest.mako')
+ return render('/casemanagement/digest_body.mako')
#
# Delete
Modified: base/trunk/mpulsweb/templates/casemanagement/digest.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/digest.mako 2010-08-12 17:59:18 UTC (rev 3391)
+++ base/trunk/mpulsweb/templates/casemanagement/digest.mako 2010-08-13 08:00:26 UTC (rev 3392)
@@ -1,6 +1,7 @@
## -*- coding: utf-8 -*-
<%inherit file="main.mako" />
<%! import mpulsweb.lib.helper.filters as F %>
+
<%def name="buildNavipath()">
${parent.buildNavipath()}
<li><a href="${h.url_for(controller='case', action='select',
@@ -8,4 +9,148 @@
<li><a href="${h.url_for(controller='case', action='digest',
id=session['case'].id)}">${_('cm_np_digest')}</a></li>
</%def>
-<%include file="digest_body.mako"/>
+
+<%def name="buildModusfield()">
+ <div id="modusfield">
+ <div class="actions">
+ <ul>
+ <li>
+ <a href="${h.url_for(controller='case', action='printdigest',
+ id=session['case'].id)}"
+ target="_blank"
+ onclick="return checkModification();">
+ ${_('cm_actions_link_printout')}
+ </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+</%def>
+
+<%def name="renderCustomCaseStateInfo(case)">
+ ##<tr class="">
+ ## <td class="label">Ole</td>
+ ## <td>Ole</td>
+ ##</tr>
+</%def>
+
+<%def name="renderCaseInfo(case)">
+ <h2>${_('cm_header_digest_youth')}</h2>
+ <table>
+ % for num, field in enumerate(c.case.get_digest_fields()):
+ <tr class="${num % 2 and 'hl' or ''}">
+ <td class="label">${c.case.get_description(field.name)}</td>
+ <td>${c.case.get_value(field.name)| F.NA}</td>
+ </tr>
+ % endfor
+ </table>
+</%def>
+
+<%def name="renderMaxSavetimeInfo(case)">
+ <div id="content_header_small">
+ <div id="content_ueberschrift">
+ ${_('cm_header_digest')}
+ </div>
+ ${self.buildModusfield()}
+ </div>
+ % if not c.print_version:
+ % if c.daysToMaxSavetime < 0:
+ <div class="dialog">
+ % if c.finished:
+ <h1>
+ <img src="${h.url_for('/images/icons/info/alert.png')}"
+ alt="achtung"/>
+ Maximale Speicherdauer überschritten!
+ </h1>
+ <p>
+ Nach Beendigung des Case Managements ist eine weitere
+ Aufbewahrung der personenbezogenen Daten der Fallakte nur bis
+ zur maximalen Speicherdauer zulässig. Die maximale
+ Speicherdauer (${c.maxsavetime} Tage) wurde seit
+ ${abs(c.daysToMaxSavetime)} Tagen überschritten!
+ <strong>Es wird empfohlen, die Fallakte zu anonymisieren!</strong>
+ </p>
+ % else:
+ <h1>
+ <img src="${h.url_for('/images/icons/info/question.png')}"
+ alt="achtung"/>Inaktiver Fall?
+ </h1>
+ <p>
+ Für die Fallakte konnte seit
+ ${abs(c.daysToMaxSavetime)+int(c.maxsavetime)} Tagen keine
+ Aktivität festgestellt werden. Bitte prüfen Sie, ob der Fall
+ noch aktiv bearbeitet wird.
+ </p>
+ % endif
+ </div>
+ % else:
+ <p><strong>Letzte Bearbeitung: ${h.format_datetime(c.last_access)}</strong>
+ % if c.daysToMaxSavetime <= 14:
+ % if c.finished or c.canceled:
+ (Tage bis zum Überschreiten der maximalen Speicherdauer:
+ ${c.daysToMaxSavetime})
+ % else:
+ (Tage bis zur nächsten automatischen Wiedervorlage der Fallakte:
+ ${c.daysToMaxSavetime})
+ % endif
+ % endif
+ </p>
+ % endif
+ % endif
+</%def>
+
+<%def name="renderCaseStateInfo(case)">
+ <h2>${_('Information on case')}</h2>
+ <table>
+ <% casetype = g.mpuls_config.get('phases', 'casetype')[0].get(str(c.case.getState().getPhase())) %>
+ % if casetype is not None:
+ <tr class="">
+ <td class="label">${_('Casetype')}</td>
+ <td>${casetype}
+ </tr>
+ % endif
+ <tr class="hl">
+ <td class="label">${_('Phase')}</td>
+ <td>${c.case.getState().getPhaseDescription()}</td>
+ </tr>
+ % if g.mpuls_config.is_enabled('case-module', 'tags'):
+ <tr class="">
+ <td class="label">${_('Validity')}</td>
+ <td>
+ % for validity in g.mpuls_config.get('validities', 'enabled'):
+ % if validity['id'] == c.case.getValidity():
+ ${validity['name']}
+ % endif
+ % endfor
+ </td>
+ </tr>
+ <tr class="hl">
+ <td class="label">${_('Start and Enddates')}</td>
+ <td>
+ % if c.case.getState().getPhase() != -1:
+ <ul>
+ <% reachable = c.case.get_phaseslist().get_path(
+ str(c.case.getState().getPhase()),only_reachable=False)
+ %>
+ % for phase in c.case.get_phaseslist():
+ % if phase.getStart().id in reachable or phase.getEnd().id in reachable:
+ <li>
+ ${phase.description}:
+ (${h.format_date(phase.getStart().date) | F.NA}
+ ${_('until')}
+ ${h.format_date(phase.getEnd().date) | F.NA})
+ </li>
+ % endif
+ % endfor
+ </ul>
+ % else:
+ ${_('unknown')}
+ % endif
+ </td>
+ </tr>
+ % endif
+ ${self.renderCustomCaseStateInfo(c.case)}
+ </table>
+</%def>
+
+${self.body()}
Modified: base/trunk/mpulsweb/templates/casemanagement/digest_body.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/digest_body.mako 2010-08-12 17:59:18 UTC (rev 3391)
+++ base/trunk/mpulsweb/templates/casemanagement/digest_body.mako 2010-08-13 08:00:26 UTC (rev 3392)
@@ -1,133 +1,27 @@
## -*- coding: utf-8 -*-
-<%!
-import mpulsweb.lib.helper.filters as F
-%>
+<%inherit file="digest.mako" />
+<%! import mpulsweb.lib.helper.filters as F %>
-<div id="content_header_small">
- <div id="content_ueberschrift">
- ${_('cm_header_digest')}
- </div>
- ${self.buildModusfield()}
-</div>
-% if not c.print_version:
- % if c.daysToMaxSavetime < 0:
- <div class="dialog">
- % if c.finished:
- <h1>
- <img src="${h.url_for('/images/icons/info/alert.png')}"
- alt="achtung"/>
- Maximale Speicherdauer überschritten!
- </h1>
- <p>
- Nach Beendigung des Case Managements ist eine weitere
- Aufbewahrung der personenbezogenen Daten der Fallakte nur bis
- zur maximalen Speicherdauer zulässig. Die maximale
- Speicherdauer (${c.maxsavetime} Tage) wurde seit
- ${abs(c.daysToMaxSavetime)} Tagen überschritten!
- <strong>Es wird empfohlen, die Fallakte zu anonymisieren!</strong>
- </p>
- % else:
- <h1>
- <img src="${h.url_for('/images/icons/info/question.png')}"
- alt="achtung"/>Inaktiver Fall?
- </h1>
- <p>
- Für die Fallakte konnte seit
- ${abs(c.daysToMaxSavetime)+int(c.maxsavetime)} Tagen keine
- Aktivität festgestellt werden. Bitte prüfen Sie, ob der Fall
- noch aktiv bearbeitet wird.
- </p>
- % endif
- </div>
- % else:
- <p><strong>Letzte Bearbeitung: ${h.format_datetime(c.last_access)}</strong>
- % if c.daysToMaxSavetime <= 14:
- % if c.finished or c.canceled:
- (Tage bis zum Überschreiten der maximalen Speicherdauer:
- ${c.daysToMaxSavetime})
- % else:
- (Tage bis zur nächsten automatischen Wiedervorlage der Fallakte:
- ${c.daysToMaxSavetime})
- % endif
- % endif
- </p>
- % endif
-% endif
+##<%def name="renderCaseInfo(case)">
+## <h2>${_('cm_header_digest_youth')}</h2>
+## <table>
+## % for num, field in enumerate(c.case.get_digest_fields()):
+## <tr class="${num % 2 and 'hl' or ''}">
+## <td class="label">${c.case.get_description(field.name)}</td>
+## <td>${c.case.get_value(field.name)| F.NA}</td>
+## </tr>
+## % endfor
+## </table>
+## Ole
+##</%def>
-<h2>${_('Information on case')}</h2>
-<table>
- <% casetype = g.mpuls_config.get('phases', 'casetype')[0].get(str(c.case.getState().getPhase())) %>
- % if casetype is not None:
- <tr class="">
- <td class="label">${_('Casetype')}</td>
- <td>${casetype}
- </tr>
- % endif
- <tr class="hl">
- <td class="label">${_('Phase')}</td>
- <td>${c.case.getState().getPhaseDescription()}</td>
- </tr>
- % if g.mpuls_config.is_enabled('case-module', 'tags'):
- <tr class="">
- <td class="label">${_('Validity')}</td>
- <td>
- % for validity in g.mpuls_config.get('validities', 'enabled'):
- % if validity['id'] == c.case.getValidity():
- ${validity['name']}
- % endif
- % endfor
- </td>
- </tr>
- <tr class="hl">
- <td class="label">${_('Start and Enddates')}</td>
- <td>
- % if c.case.getState().getPhase() != -1:
- <ul>
- <% reachable = c.case.get_phaseslist().get_path(
- str(c.case.getState().getPhase()),only_reachable=False)
- %>
- % for phase in c.case.get_phaseslist():
- % if phase.getStart().id in reachable or phase.getEnd().id in reachable:
- <li>
- ${phase.description}:
- (${h.format_date(phase.getStart().date) | F.NA}
- ${_('until')}
- ${h.format_date(phase.getEnd().date) | F.NA})
- </li>
- % endif
- % endfor
- </ul>
- % else:
- ${_('unknown')}
- % endif
- </td>
- </tr>
- % endif
-</table>
+##<%def name="renderCustomCaseStateInfo(case)">
+## <tr class="">
+## <td class="label">Ole</td>
+## <td>Ole</td>
+## </tr>
+##</%def>
-<h2>${_('cm_header_digest_youth')}</h2>
-<table>
- % for num, field in enumerate(c.case.get_digest_fields()):
- <tr class="${num % 2 and 'hl' or ''}">
- <td class="label">${c.case.get_description(field.name)}</td>
- <td>${c.case.get_value(field.name)| F.NA}</td>
- </tr>
- % endfor
-</table>
-
-<%def name="buildModusfield()">
- <div id="modusfield">
- <div class="actions">
- <ul>
- <li>
- <a href="${h.url_for(controller='case', action='printdigest',
- id=session['case'].id)}"
- target="_blank"
- onclick="return checkModification();">
- ${_('cm_actions_link_printout')}
- </a>
- </li>
- </ul>
- </div>
- </div>
-</%def>
+${self.renderMaxSavetimeInfo(c.case)}
+${self.renderCaseStateInfo(c.case)}
+${self.renderCaseInfo(c.case)}
More information about the Mpuls-commits
mailing list