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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 23 17:27:22 CET 2010


Author: torsten
Date: 2010-02-23 17:27:20 +0100 (Tue, 23 Feb 2010)
New Revision: 1711

Modified:
   wasko/branches/2.0/mpulsweb/controllers/case.py
Log:
* mpulsweb/controllers/case.py (CaseController.setEditorAction), 
* mpulsweb/controllers/case.py (CaseController.setStandinAction):
Copied from waskaweb


Modified: wasko/branches/2.0/mpulsweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case.py	2010-02-23 15:39:54 UTC (rev 1710)
+++ wasko/branches/2.0/mpulsweb/controllers/case.py	2010-02-23 16:27:20 UTC (rev 1711)
@@ -1,17 +1,23 @@
 # -*- coding: utf-8 -*-
 import logging
+import formencode
 
 from pylons import request, response, session, tmpl_context as c
 from pylons.controllers.util import abort, redirect_to
 
-from mpulsweb.lib.base import BaseController, render
+from mpulsweb.lib.base import BaseController, render, h
 from mpulsweb.lib.security import checkRole
+from mpulsweb.lib.validators import SetStandinForm, SetEditorForm
 from mpulsweb.model.user import UserGroupList, UserListObject
 
 log = logging.getLogger(__name__)
 
 class CaseController(BaseController):
 
+    #
+    # ORGANISATION (standin and editor settings)
+    #
+
     @checkRole(('admin_ka', 'cm_ka'))
     def organisation(self, id):
         id = self._checkInt(id)
@@ -37,4 +43,36 @@
         c.user_list = ulist.getUserList(filter3)
         return render('/casemanagement/organisation.mako')
 
+    @checkRole('admin_ka')
+    def setEditorAction(self):
+        validator = SetEditorForm()
+        try:
+            form_result = validator.to_python(request.params)
+            case = self._loadCase(form_result.get('case_id'))
+            case.setEditor(form_result.get('editor'))
+            c.status_msg = h.status_message("Bearbeiter erfolgreich gesetzt.")
+            return self.organisation(form_result.get('case_id'))
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            c.status_msg = h.status_message("Fehler! Bearbeiter nicht gesetzt.")
+            return render('/casemanagement/organisation.mako')
+
+    @checkRole(('admin_ka', 'cm_ka'))
+    def setStandinAction(self):
+        validator = SetStandinForm()
+        data = formencode.variabledecode.variable_decode(request.params)
+        try:
+            form_result = validator.to_python(data)
+            case = self._loadCase(form_result.get('case_id'))
+            standin = case.getStandin()
+            standin.setGroups(form_result.get('standin'))
+            c.status_msg = h.status_message("Vertretung erfolgreich gesetzt.")
+            return self.organisation(form_result.get('case_id'))
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            c.status_msg = h.status_message("Fehler! Vertretung nicht gesetzt.")
+            return render('/casemanagement/organisation.mako')
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list