[Mpuls-commits] r2075 - in wasko/branches/2.0: . jmdweb/controllers mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Mar 23 14:04:46 CET 2010


Author: torsten
Date: 2010-03-23 14:04:45 +0100 (Tue, 23 Mar 2010)
New Revision: 2075

Added:
   wasko/branches/2.0/mpulsweb/controllers/caseappointment.py
Removed:
   wasko/branches/2.0/jmdweb/controllers/caseappointment.py
Modified:
   wasko/branches/2.0/ChangeLog
Log:
Moved caseappointment controller to mpulsbase


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-03-23 13:03:36 UTC (rev 2074)
+++ wasko/branches/2.0/ChangeLog	2010-03-23 13:04:45 UTC (rev 2075)
@@ -1,6 +1,21 @@
 2010-03-23  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	Enable default html-escaping for mako-rendering.
+	* mpulsweb/lib/config.py: Added new config vars to define which phases
+	are considered as a active or finished case.
+	* jmd.json: Configure active and finished phases for JMD. 
+	* jmdweb/model/appointment.py: Deleted. MaxSaveTimeReminders is now
+	defined in base.
+	* mpulsweb/model/appointment.py (MaxSaveTimeReminderOverview): New
+	copied from jmdweb 
+	* mpulsweb/controllers/mpuls.py: Load Caseappointments and Reminders.
+	* mpulsweb/controllers/mpuls.py (get_reminders): Changed rolename
+	* mpulsweb/model/appointment.py (MaxSaveTimeReminderOverview): Fixed
+	sql-statements. 
+	* mpulsweb/controllers/case.py (keepActive): New. Copied from jmdweb.
+	* jmdweb/controllers/case.py (keepActive): Deleted. Now defined in
+	mpulsweb. 
+	* jmdweb/controllers/caseappointment.py: Import all from mpulsweb.
 
 	* mpulsweb/templates/*.mako: Relaced "F.NA | h" with "F.NA". Escaping
 	s now done with default escapping in mako

Deleted: wasko/branches/2.0/jmdweb/controllers/caseappointment.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/caseappointment.py	2010-03-23 13:03:36 UTC (rev 2074)
+++ wasko/branches/2.0/jmdweb/controllers/caseappointment.py	2010-03-23 13:04:45 UTC (rev 2075)
@@ -1,200 +0,0 @@
-# -*- coding: utf-8 -*-
-import logging
-from datetime import datetime
-
-import formencode
-
-from pylons import request, tmpl_context as c
-
-from mpulsweb.lib.base import BaseController, render
-from mpulsweb.lib.security import checkRole
-from mpulsweb.lib.helpers import url_for, dd_mm_YYYY, HH_MM
-from mpulsweb.lib.dialogs import checkPrivacyStatement
-from mpulsweb.lib.validators import CreateAppointmentForm
-from mpulsweb.model.appointment import CaseAppointmentOverview, \
-     CaseAppointmentFactory, CaseReminderOverview
-from mpulsweb.controllers.appointment import \
-     DELETE_APPOINT_NOTIFICATION_SUCCESS, \
-     DELETE_APPOINT_NOTIFICATION_FAILED, \
-     DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS, \
-     DELETE_APPOINT_NOTIFICATION_TEXT_FAILED, \
-     DELETE_APPOINT_CONFIRM, \
-     DELETE_APPOINT_CONFIRM_TEXT, \
-     CREATE_APPOINT_NOTIFICATION_SUCCESS, \
-     CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS, \
-     EDIT_APPOINT_NOTIFICATION_SUCCESS, \
-     EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
-
-log = logging.getLogger(__name__)
-
-class CaseappointmentController(BaseController):
-
-    def index(self, id):
-        return self.overview(id)
-
-    @checkRole(('admin_ka', 'cm_ka'))
-    def overview(self, id):
-        id = self._checkInt(id)
-        c.remindlist = CaseReminderOverview(id)
-        c.appointmentlist = CaseAppointmentOverview(id)
-        return render('/casemanagement/appointments.mako')
-
-    @checkRole('cm_ka')
-    def new(self, id):
-        id = self._checkInt(id)
-        c.form_errors = {}
-        c.form_result = {}
-        cd = datetime.now()
-        form_defaults = {'start_date': dd_mm_YYYY(cd),
-                         'start_time': HH_MM(cd),
-                         'case_id': id,
-                         'type': 0}
-        form = render('/casemanagement/newAppointment.mako')
-        return formencode.htmlfill.render(form,
-                                          defaults=form_defaults)
-
-    @checkRole('cm_ka')
-    def newReminder(self, id):
-        id = self._checkInt(id)
-        case = self._loadCase(id)
-        c.form_errors = {}
-        c.form_result = {}
-        cd = datetime.now()
-        form_defaults = {'start_date': dd_mm_YYYY(cd),
-                         'start_time': HH_MM(cd),
-                         'case_id': id,
-                         'title': u"%s, %s" % (case.last_name, case.first_name),
-                         'description': (u"Bitte geben Sie den Grund für"
-                                         u" die Wiedervorlage ein"),
-                         'type': 1}
-        form = render('/casemanagement/newAppointment.mako')
-        return formencode.htmlfill.render(form,
-                                          defaults=form_defaults)
-
-    @checkRole(('cm_ka'))
-    def newAction(self):
-        validator = CreateAppointmentForm()
-        factory = CaseAppointmentFactory()
-        form_errors = {}
-        form_result = {}
-        try:
-            try:
-                form_result = validator.to_python(request.params)
-                # Create appointment
-                appointment = factory.createNew(form_result.get('case_id'))
-                appointment.setData(form_result)
-                appointment.store()
-                c.success_for = CREATE_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = url_for(controller='/caseappointment',
-                                   action='index', id=appointment.case_id)
-                return render('/casemanagement/dialogs/success_create_appointment.mako')
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                form = render('/casemanagement/newAppointment.mako')
-                return formencode.htmlfill.render(form,
-                                                  defaults=form_result,
-                                                  auto_insert_errors=False,
-                                                  errors=form_errors)
-        except Exception, e:
-            log.exception(e)
-            raise
-
-
-    @checkRole(('admin_ka', 'cm_ka'))
-    @checkPrivacyStatement('showAppointment')
-    def show(self, id, confirmed=True):
-        # This method has a "confirmed" parameter because of
-        # checkPrivacyStatement which requires it.  The default value of
-        # confirmed is True because usually this controller is used when
-        # the privacy statement nag-screen has already been shown.
-        # Also, it was the default value used in the original routing in
-        # jmdweb/config/routing.py.
-        # FIXME: do we really need the checkPrivacyStatement decorator here?
-        factory = CaseAppointmentFactory()
-        id = self._checkInt(id)
-        app = factory.loadById(id)
-        c.appointment = app
-        return render('/casemanagement/showAppointment.mako')
-
-    @checkRole(('cm_ka'))
-    def edit(self, id):
-        id = self._checkInt(id)
-        factory = CaseAppointmentFactory()
-        app = factory.loadById(id)
-
-        c.form_result = {'start_date': dd_mm_YYYY(app.start_date),
-                         'start_time': HH_MM(app.start_date),
-                         'end_date': dd_mm_YYYY(app.end_date),
-                         'end_time': HH_MM(app.end_date),
-                         'title': app.title,
-                         'id': app.id,
-                         'case_id': app.case_id,
-                         'type': app.type,
-                         'description': app.description}
-
-        c.form_errors = {}
-        c.appointment = app
-        form = render('/casemanagement/editAppointment.mako')
-        return formencode.htmlfill.render(form,
-                                          defaults=c.form_result,
-                                          auto_insert_errors=False,
-                                          errors=c.form_errors)
-
-    @checkRole(('cm_ka'))
-    def editAction(self):
-        validator = CreateAppointmentForm()
-        factory = CaseAppointmentFactory()
-        c.form_errors = {}
-        c.form_result = {}
-        try:
-            try:
-                form_result = validator.to_python(request.params)
-                # Load appointment and set data
-                appointment = factory.loadById(form_result.get('id'))
-                appointment.setData(form_result)
-                appointment.store()
-                c.success_for = EDIT_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = url_for(controller='/caseappointment',
-                                   action='index',
-                                   id=appointment.case_id)
-                return render('/casemanagement/dialogs/success_edit_appointment.mako')
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                c.appointment = factory.loadById(c.form_result.get('id'))
-                form = render('/casemanagement/editAppointment.mako')
-                return formencode.htmlfill.render(form,
-                                                  defaults=c.form_result,
-                                                  auto_insert_errors=False,
-                                                  errors=c.form_errors)
-        except Exception, e:
-            log.exception(e)
-            raise
-
-    def delete(self, id, confirmed='0'):
-        id = self._checkInt(id)
-        confirmed = self._checkBool(confirmed)
-        factory = CaseAppointmentFactory()
-        appointment = factory.loadById(id)
-        if confirmed == 1:
-            if appointment.delete():
-                c.success_for = DELETE_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/caseappointment/index/%s" % appointment.case_id
-                return render('/casemanagement/dialogs/success_delete_appointment.mako')
-            else:
-                c.failed_for = DELETE_APPOINT_NOTIFICATION_FAILED
-                c.failed_text = DELETE_APPOINT_NOTIFICATION_TEXT_FAILED
-                c.url_ok = "/case/appointments/%s" % appointment.case_id
-                return render('/casemanagement/dialogs/failed_delete_appointment.mako')
-        else:
-            c.context = "../main.mako"
-            c.confirm_for = DELETE_APPOINT_CONFIRM
-            c.question = DELETE_APPOINT_CONFIRM_TEXT
-            c.url_yes = "/caseappointment/delete/%s/1" % id
-            c.url_no = "/caseappointment/index/%s" % appointment.case_id
-            return render('/casemanagement/dialogs/confirm_delete_appointment.mako')
-

Copied: wasko/branches/2.0/mpulsweb/controllers/caseappointment.py (from rev 2074, wasko/branches/2.0/jmdweb/controllers/caseappointment.py)


Property changes on: wasko/branches/2.0/mpulsweb/controllers/caseappointment.py
___________________________________________________________________
Name: svn:mergeinfo
   + 



More information about the Mpuls-commits mailing list