[Mpuls-commits] r1086 - wasko/branches/2.0/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 1 16:37:24 CET 2010


Author: torsten
Date: 2010-02-01 16:37:24 +0100 (Mon, 01 Feb 2010)
New Revision: 1086

Modified:
   wasko/branches/2.0/waskaweb/controllers/phase.py
Log:
* waskaweb/controllers/phase.py: Moved old phase related functions
  from controllers.case. Commented out those functions. The must be
  reimplemented by using the new libformed. 


Modified: wasko/branches/2.0/waskaweb/controllers/phase.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/phase.py	2010-02-01 15:35:30 UTC (rev 1085)
+++ wasko/branches/2.0/waskaweb/controllers/phase.py	2010-02-01 15:37:24 UTC (rev 1086)
@@ -8,9 +8,100 @@
 
 class PhaseController(BaseController):
 
+    @checkRole(('admin_ka', 'cm_ka'))
     def index(self, id):
         return self.overview(id)
 
+    @checkRole(('admin_ka', 'cm_ka'))
     def overview(self, id):
+        id = self._checkInt(id)
         c.phases = PhaseFactory().load(id)
         return render('/phase/phase.mako')
+
+    # Old methods from controllers.case.
+    # TODO: Reimplement these functions using the new libformed
+
+    #@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')
+



More information about the Mpuls-commits mailing list