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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 2 14:36:01 CET 2010


Author: torsten
Date: 2010-02-02 14:35:59 +0100 (Tue, 02 Feb 2010)
New Revision: 1130

Modified:
   wasko/branches/2.0/waskaweb/controllers/caseappointment.py
Log:
* waskaweb/controllers/caseappointment.py
 (CaseappointmentController.show, CaseappointmentController.delete):
 Added new controllers.


Modified: wasko/branches/2.0/waskaweb/controllers/caseappointment.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/caseappointment.py	2010-02-02 11:54:05 UTC (rev 1129)
+++ wasko/branches/2.0/waskaweb/controllers/caseappointment.py	2010-02-02 13:35:59 UTC (rev 1130)
@@ -7,6 +7,18 @@
 from waskaweb.lib.base import BaseController, render
 from waskaweb.model.appointment import CaseAppointmentOverview, \
      CaseAppointmentFactory, CaseReminderOverview
+from waskaweb.controllers.case import checkPrivacyStatement
+from waskaweb.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__)
 
@@ -21,3 +33,38 @@
         c.remindlist = CaseReminderOverview(id)
         c.appointmentlist = CaseAppointmentOverview(id)
         return render('/casemanagement/appointments.mako')
+
+    @checkRole(('admin_ka', 'cm_ka'))
+    @checkPrivacyStatement('showAppointment')
+    def show(self, id, confirmed):
+        factory = CaseAppointmentFactory()
+        id = self._checkInt(id)
+        app = factory.loadById(id)
+        c.appointment = app
+        return render('/casemanagement/showAppointment.mako')
+    @checkRole(('cm_ka'))
+
+    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 = "/case/deleteAppointment/%s/1" % id
+            c.url_no = "/case/appointments/%s" % appointment.case_id
+            return render('/casemanagement/dialogs/confirm_delete_appointment.mako')
+



More information about the Mpuls-commits mailing list