[Mpuls-commits] r1765 - in wasko/branches/2.0: . jmdweb/templates/casemanagement/dialogs mpulsweb/controllers mpulsweb/templates/phase mpulsweb/templates/phase/dialogs waskaweb/templates/casemanagement/dialogs
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Feb 25 10:51:04 CET 2010
Author: torsten
Date: 2010-02-25 10:50:57 +0100 (Thu, 25 Feb 2010)
New Revision: 1765
Added:
wasko/branches/2.0/mpulsweb/templates/phase/dialogs/
wasko/branches/2.0/mpulsweb/templates/phase/dialogs/success_set_phase.mako
Removed:
wasko/branches/2.0/jmdweb/templates/casemanagement/dialogs/success_set_phase.mako
wasko/branches/2.0/waskaweb/templates/casemanagement/dialogs/success_set_phase.mako
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/mpulsweb/controllers/phase.py
wasko/branches/2.0/mpulsweb/templates/phase/phase.mako
Log:
Enabled setting phase.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-02-24 18:11:44 UTC (rev 1764)
+++ wasko/branches/2.0/ChangeLog 2010-02-25 09:50:57 UTC (rev 1765)
@@ -1,3 +1,15 @@
+2010-02-25 Torsten Irländer <torsten.irlaender at intevation.de>
+
+ * jmdweb/templates/casemanagement/dialogs/success_set_phase.mako,
+ waskaweb/templates/casemanagement/dialogs/success_set_phase.mako,
+ mpulsweb/templates/phase/dialogs/success_set_phase.mako: Adapted
+ links to new controller structure. And moved template into mpulsbase.
+
+ * mpulsweb/controllers/phase.py: Enabled setting phase and deleted old
+ code.
+ * mpulsweb/templates/phase/phase.mako: Adapted link to set action in
+ controller. Changed name of the submitbuttons.
+
2010-02-24 Bernhard Herzog <bh at intevation.de>
* mpulsweb/lib/renderer.py (ErrorRenderer.render_items): New
Deleted: wasko/branches/2.0/jmdweb/templates/casemanagement/dialogs/success_set_phase.mako
===================================================================
--- wasko/branches/2.0/jmdweb/templates/casemanagement/dialogs/success_set_phase.mako 2010-02-24 18:11:44 UTC (rev 1764)
+++ wasko/branches/2.0/jmdweb/templates/casemanagement/dialogs/success_set_phase.mako 2010-02-25 09:50:57 UTC (rev 1765)
@@ -1,33 +0,0 @@
-## -*- coding: utf-8 -*-
-<%! import mpulsweb.lib.helper.filters as F %>
-<%inherit file="/main.mako" />
-<%def name="buildNavipath()">
- ${parent.buildNavipath()}
- <li><a href="/case/select/${session.get('case').id}">${_('cm_np_select')}</a></li>
- <li><a href="#">${_('case_cm_phase')}</a></li>
-</%def>
-<div class="dialog" />
- <h1><img src="/images/confirmation.png" alt="Erledigt"/>${c.success_for | F.NA, h}</h1>
- <p>${c.success_text | F.NA, h}</p>
- <div class="import_box_dialog">
- <p>
- Beachten Sie, dass bei einem Phasenwechsel die Fallakte in ausgedruckter
- Form dem Jugendlichen ausgehändigt werden sollte. Weitere Informationen
- dazu finden Sie in der
- <a href="/case/showhelp/datenschutz_veraenderte_daten" target="_blank">Hilfe</a>
- </p>
- <p class="import_p">
- <strong class="import_number">1.</strong> Fallakte drucken:
- <a class="button import" href="/case/printAll/${session.get('case').id}/0" target="_blank">Drucken</a>
- </p>
- <p class="import_p">
- <strong class="export_number">2.</strong> Phasenwechsel im Falltagebuch dokumentieren:
- <a class="button import" href="/case/newLogbookEntry/${session.get('case').id}">Falltagebuch</a>
- </p>
- <p><strong>oder</strong></p>
- <p class="import_p">
- <strong class="export_number">3.</strong> Zur Phasenübersicht zurückkehren:
- <a class="button import" href="${c.url_ok}">Phasenübersicht</a>
- </p>
- </div>
-</div>
Modified: wasko/branches/2.0/mpulsweb/controllers/phase.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/phase.py 2010-02-24 18:11:44 UTC (rev 1764)
+++ wasko/branches/2.0/mpulsweb/controllers/phase.py 2010-02-25 09:50:57 UTC (rev 1765)
@@ -27,90 +27,29 @@
c.phases = PhaseFactory().load(id)
return render('/phase/phase.mako')
- # Old methods from controllers.case.
- # TODO: Reimplement these functions using the new libformed
+ @checkRole(('cm_ka'))
+ def editAction(self):
+ case = self._loadCase(request.params.get('case_id'))
+ newphase = None
+
+ # TODO: This is ugly. The id of the phase to be set is submitted as key
+ # (intvalue)) of the submitbutton. So to find the right value, try to
+ # convert all keys to int, which should only work for the
+ # submitbuttons.
+ for newphase in request.params.iterkeys():
+ try:
+ newphase = int(newphase)
+ break;
+ except:
+ pass # convert failed, seems not to be the submit button.
+ # Continue...
+
+ # Set phase
+ state = case.getState()
+ state.setPhase(newphase)
- #@checkRole(('admin_ka', 'cm_ka'))
- #def phase(self, id):
- # id = self._checkInt(id)
- # case = self._loadCase(id)
- # phase = case.getState().getPhase()
-
- # # FIXME: the links generated by link are very likely wrong.
- # # They should point to formularpage/select.
- # link = lambda ti, extra = "": '"/case/show/%d/%s%s"' % (id, ti.key,
- # extra)
-
- # rf = RequiredFields(g.formedTree)
-
- # navigation = self.getNavigation()
-
- # c.phase_pairs = rf.phases_pairs(phase, navigation, link)
- # c.current_phase = Phase(phase, True)
-
- # D = g.formedTree.getData
- # nbtr = int(D('nbtr'))
- # abbr = int(D('cm_end_art'))
- # c.nachbetreuung_geplant = nbtr not in [1,-1,-3] and abbr != 3
-
- # c.global_warnings = g.formedTree.linksToGlobalWarnings(id, navigation,
- # link)
- # return render('/casemanagement/phase.mako')
-
- #@checkRole(('cm_ka'))
- #def setPhaseAction(self):
- # validator = SetPhaseForm()
- # factory = CaseFactory()
- # c.form_errors = {}
- # c.form_result = {}
- # try:
- # try:
- # form_result = validator.to_python(request.params)
- # # Load case and do something on phase
- # case = factory.loadById(form_result.get('case_id'))
-
- # new_phase, new_phase_symbol = None, None
-
- # for new_phase_symbol in request.params.iterkeys():
- # try:
- # new_phase = symbol_phase(new_phase_symbol)
- # break
- # except KeyError:
- # pass
-
- # if new_phase is None:
- # raise StandardError("Phase nicht gefunden.")
-
- # state = case.getState()
-
- # current_phase = state.getPhase()
-
- # #if not phase_neighbors(current_phase, new_phase):
- # # raise StandardError("Phasen sind nicht benachbart.")
-
- # case_session = session.get('case')
-
- # #if case_session.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
- # # fields = case.getRequiredFields()
- # # if not fields.isPhaseComplete(new_phase_symbol):
- # # raise StandardError("Phase ist nicht komplett.")
-
- # state.setPhase(new_phase)
-
- # case_session.state = state
- # session.save()
-
- # # After setting the phase. Show print-dialog
- # c.success_for = SET_PHASE_NOTIFICATION_SUCCESS
- # c.success_text = SET_PHASE_NOTIFICATION_TEXT_SUCCESS
- # c.url_ok = h.url_for(controller='/case', action='phase',
- # id=case.id)
-
- # return render('/casemanagement/dialogs/success_set_phase.mako')
- # except formencode.Invalid, error:
- # c.form_result = error.value
- # c.form_errors = error.error_dict or {}
- # return self.phase(form_result.get('case_id'))
- # except:
- # return render('/tests/trace.mako')
-
+ # After setting the phase. Show print-dialog
+ c.dialog_title = SET_PHASE_NOTIFICATION_SUCCESS
+ c.dialog_text = SET_PHASE_NOTIFICATION_TEXT_SUCCESS
+ c.url_ok = h.url_for(controller='/phase', action='overview', id=case.id)
+ return render('/phase/dialogs/success_set_phase.mako')
Copied: wasko/branches/2.0/mpulsweb/templates/phase/dialogs/success_set_phase.mako (from rev 1764, wasko/branches/2.0/jmdweb/templates/casemanagement/dialogs/success_set_phase.mako)
===================================================================
--- wasko/branches/2.0/jmdweb/templates/casemanagement/dialogs/success_set_phase.mako 2010-02-24 18:11:44 UTC (rev 1764)
+++ wasko/branches/2.0/mpulsweb/templates/phase/dialogs/success_set_phase.mako 2010-02-25 09:50:57 UTC (rev 1765)
@@ -0,0 +1,33 @@
+## -*- coding: utf-8 -*-
+<%! import mpulsweb.lib.helper.filters as F %>
+<%inherit file="/main.mako" />
+<%def name="buildNavipath()">
+ ${parent.buildNavipath()}
+ <li><a href="/case/select/${session.get('case').id}">${_('cm_np_select')}</a></li>
+ <li><a href="#">${_('case_cm_phase')}</a></li>
+</%def>
+<div class="dialog" />
+ <h1><img src="/images/confirmation.png" alt="Erledigt"/>${c.dialog_title | F.NA, h}</h1>
+ <p>${c.dialog_text | F.NA, h}</p>
+ <div class="import_box_dialog">
+ <p>
+ Beachten Sie, dass bei einem Phasenwechsel die Fallakte in ausgedruckter
+ Form dem Jugendlichen ausgehändigt werden sollte. Weitere Informationen
+ dazu finden Sie in der
+ <a href="/case/showhelp/datenschutz_veraenderte_daten" target="_blank">Hilfe</a>
+ </p>
+ <p class="import_p">
+ <strong class="import_number">1.</strong> Fallakte drucken:
+ <a class="button import" href="/case/printAll/${session.get('case').id}/0" target="_blank">Drucken</a>
+ </p>
+ <p class="import_p">
+ <strong class="export_number">2.</strong> Phasenwechsel im Falltagebuch dokumentieren:
+ <a class="button import" href="/logbook/new/${session.get('case').id}">Falltagebuch</a>
+ </p>
+ <p><strong>oder</strong></p>
+ <p class="import_p">
+ <strong class="export_number">3.</strong> Zur Phasenübersicht zurückkehren:
+ <a class="button import" href="${c.url_ok}">Phasenübersicht</a>
+ </p>
+ </div>
+</div>
Property changes on: wasko/branches/2.0/mpulsweb/templates/phase/dialogs/success_set_phase.mako
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: wasko/branches/2.0/mpulsweb/templates/phase/phase.mako
===================================================================
--- wasko/branches/2.0/mpulsweb/templates/phase/phase.mako 2010-02-24 18:11:44 UTC (rev 1764)
+++ wasko/branches/2.0/mpulsweb/templates/phase/phase.mako 2010-02-25 09:50:57 UTC (rev 1765)
@@ -13,7 +13,7 @@
<h2>${_('case_cm_phase')}</h2>
<div class="widget container">
- <form method="POST" action="${h.url_for(controller='/phase', action='setAction')}">
+ <form method="POST" action="${h.url_for(controller='/phase', action='editAction')}">
<input type="hidden" name="case_id" value="${session.get('case').id}">
<table id="cmphases">
<% is_allowed = h.hasRole(('cm_ka',)) %>
@@ -58,9 +58,9 @@
</td>
<td class="actions middle" style="border-bottom: 1pt dotted; border-color: #000;">
% if p1.is_ok() and phases_are_valid and abs(int(p1.id) - int(current_phase)) == 1:
- <input type="submit" name="phase_${p1.id}" value="${_('Start')}">
+ <input type="submit" name="${p1.id}" value="${_('Start')}">
% else:
- <input type="submit" name="phase_${p1.id}" value="${_('Start')}" disabled="disabled">
+ <input type="submit" name="${p1.id}" value="${_('Start')}" disabled="disabled">
% endif
</td>
</tr>
@@ -74,9 +74,9 @@
<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 abs(int(p2.id) - int(current_phase)) == 1:
- <input type="submit" name="phase_${p2.id}" value="${_('Finish')}">
+ <input type="submit" name="${p2.id}" value="${_('Finish')}">
% else:
- <input type="submit" name="phase_${p2.id}" value="${_('Finish')}" disabled="disabled">
+ <input type="submit" name="${p2.id}" value="${_('Finish')}" disabled="disabled">
% endif
</td>
</tr>
Deleted: wasko/branches/2.0/waskaweb/templates/casemanagement/dialogs/success_set_phase.mako
===================================================================
--- wasko/branches/2.0/waskaweb/templates/casemanagement/dialogs/success_set_phase.mako 2010-02-24 18:11:44 UTC (rev 1764)
+++ wasko/branches/2.0/waskaweb/templates/casemanagement/dialogs/success_set_phase.mako 2010-02-25 09:50:57 UTC (rev 1765)
@@ -1,33 +0,0 @@
-## -*- coding: utf-8 -*-
-<%! import mpulsweb.lib.helper.filters as F %>
-<%inherit file="/main.mako" />
-<%def name="buildNavipath()">
- ${parent.buildNavipath()}
- <li><a href="/case/select/${session.get('case').id}">${_('cm_np_select')}</a></li>
- <li><a href="#">${_('case_cm_phase')}</a></li>
-</%def>
-<div class="dialog" />
- <h1><img src="/images/confirmation.png" alt="Erledigt"/>${c.success_for | F.NA, h}</h1>
- <p>${c.success_text | F.NA, h}</p>
- <div class="import_box_dialog">
- <p>
- Beachten Sie, dass bei einem Phasenwechsel die Fallakte in ausgedruckter
- Form dem Jugendlichen ausgehändigt werden sollte. Weitere Informationen
- dazu finden Sie in der
- <a href="/case/showhelp/datenschutz_veraenderte_daten" target="_blank">Hilfe</a>
- </p>
- <p class="import_p">
- <strong class="import_number">1.</strong> Fallakte drucken:
- <a class="button import" href="/case/printAll/${session.get('case').id}/0" target="_blank">Drucken</a>
- </p>
- <p class="import_p">
- <strong class="export_number">2.</strong> Phasenwechsel im Falltagebuch dokumentieren:
- <a class="button import" href="/case/newLogbookEntry/${session.get('case').id}">Falltagebuch</a>
- </p>
- <p><strong>oder</strong></p>
- <p class="import_p">
- <strong class="export_number">3.</strong> Zur Phasenübersicht zurückkehren:
- <a class="button import" href="${c.url_ok}">Phasenübersicht</a>
- </p>
- </div>
-</div>
More information about the Mpuls-commits
mailing list