[Mpuls-commits] r2067 - wasko/branches/2.0/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Mar 23 11:07:00 CET 2010


Author: torsten
Date: 2010-03-23 11:06:59 +0100 (Tue, 23 Mar 2010)
New Revision: 2067

Modified:
   wasko/branches/2.0/mpulsweb/controllers/mpuls.py
Log:
* mpulsweb/controllers/mpuls.py: Load Caseappointments and Reminders.


Modified: wasko/branches/2.0/mpulsweb/controllers/mpuls.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/mpuls.py	2010-03-23 10:06:02 UTC (rev 2066)
+++ wasko/branches/2.0/mpulsweb/controllers/mpuls.py	2010-03-23 10:06:59 UTC (rev 2067)
@@ -4,8 +4,10 @@
 from pylons.controllers.util import abort, redirect_to
 
 from mpulsweb.model.news import NewsList
-from mpulsweb.model.appointment import GlobalAppointmentOverview
+from mpulsweb.model.appointment import GlobalAppointmentOverview, CaseAppointmentOverview, \
+MaxSaveTimeReminderOverview, CaseReminderOverview 
 from mpulsweb.lib.base import BaseController, render
+import mpulsweb.lib.helpers as h
 
 log = logging.getLogger(__name__)
 
@@ -15,6 +17,20 @@
 def get_global_appointments():
     return GlobalAppointmentOverview()
 
+def get_case_appointments():
+    return CaseAppointmentOverview()
+
+def get_reminders():
+    """Return an AppointmentOverview instance with reminders.
+    The overview always contains the max save time reminders. For case
+    managers it also contains the case reminders.
+    """
+    remindlist = MaxSaveTimeReminderOverview()
+    if h.hasRole(['cm_ka']):
+        remindlist.join(CaseReminderOverview())
+        remindlist.sort()
+    return remindlist
+
 class MpulsController(BaseController):
 
     def index(self):
@@ -26,6 +42,14 @@
             c.news = get_newslist(user)
 
         # LOAD APPOINTMENTS
+        if g.mpuls_config.is_enabled('case-module', 'appointments'):
+            # Case appointments
+            log.debug('Loading case appointment list')
+            c.appointmentlist = get_case_appointments()
+        if g.mpuls_config.is_enabled('case-module', 'reminders'):
+            # Case appointments
+            log.debug('Loading reminders list')
+            c.remindlist = get_reminders()
         if g.mpuls_config.is_enabled('module', 'appointments'):
             # Global appointments
             log.debug('Loading global appointment list')



More information about the Mpuls-commits mailing list