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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 9 15:11:29 CET 2010


Author: torsten
Date: 2010-02-09 15:11:29 +0100 (Tue, 09 Feb 2010)
New Revision: 1384

Modified:
   wasko/branches/2.0/mpulsweb/controllers/administration.py
Log:
* mpulsweb/controllers/administration.py 
  (AdministrationController.deleteUserGroup): Copied from waskaweb.
  Adaped c-vars for dialog.


Modified: wasko/branches/2.0/mpulsweb/controllers/administration.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/administration.py	2010-02-09 14:04:25 UTC (rev 1383)
+++ wasko/branches/2.0/mpulsweb/controllers/administration.py	2010-02-09 14:11:29 UTC (rev 1384)
@@ -17,9 +17,14 @@
 NEW_USERGROUP_SUCCESS_TEXT = _('adm_new_usergroup_success_text')
 NEW_USERGROUP_FAILURE_HEADER = _('adm_new_usergroup_failure_header')
 NEW_USERGROUP_FAILURE_TEXT = _('adm_new_usergroup_failure_text')
-
 EDIT_USERGROUP_SUCCESS_HEADER = _('adm_edit_usergroup_header')
 EDIT_USERGROUP_SUCCESS_TEXT = _('adm_edit_usergroup_text')
+DELETE_USERGROUP_CONFIRM = _('adm_delete_usergroup_confirm_header')
+DELETE_USERGROUP_CONFIRM_QUESTION = _('adm_delete_usergroup_confirm_text')
+DELETE_USERGROUP_SUCCESS_HEADER = _('adm_delete_usergroup_success_header')
+DELETE_USERGROUP_SUCCESS_TEXT = _('adm_delete_usergroup_success_text')
+DELETE_USERGROUP_FAILED_HEADER = _('adm_delete_usergroup_failure_header')
+DELETE_USERGROUP_FAILED_TEXT = _('adm_delete_usergroup_failure_text')
 
 log = logging.getLogger(__name__)
 
@@ -71,7 +76,7 @@
             c.form_result = error.value
             c.form_errors = error.error_dict or {}
             form = render('/administration/new_usergroup.mako')
-            return htmlfill.render(unicode(form, 'utf-8'),
+            return formencode.htmlfill.render(unicode(form, 'utf-8'),
                                    c.form_result,
                                    c.form_errors,
                                    auto_insert_errors=False)
@@ -143,4 +148,31 @@
                                    c.form_errors,
                                    auto_insert_errors=False)
 
+    @checkRole('admin_ka')
+    def deleteUserGroup(self, id, confirmed='0'):
+        id = self._checkInt(id)
+        confirmed = self._checkBool(confirmed)
+        factory = UserGroupFactory()
+        try:
+            ugo = factory.load(id)
+            if confirmed:
+                ugo.delete()
+                c.dialog_title = DELETE_USERGROUP_SUCCESS_HEADER
+                c.dialog_text = DELETE_USERGROUP_SUCCESS_TEXT
+                c.url_ok = "/administration/overviewUserGroups"
+                return render('/administration/dialogs/success_deletegroup_user.mako')
+            else:
+                c.context = "../main.mako"
+                c.dialog_title = DELETE_USERGROUP_CONFIRM
+                c.dialog_text = DELETE_USERGROUP_CONFIRM_QUESTION
+                c.url_yes = "/administration/deleteUserGroup/%s/1" % ugo.id
+                c.url_no = "/administration/overviewUserGroups/"
+                return render('/administration/dialogs/confirm_deleteusergroup.mako')
+        except:
+            c.dialog_title = DELETE_USERGROUP_FAILED_HEADER
+            c.dialog_text = DELETE_USERGROUP_FAILED_TEXT
+            c.url_ok = "/administration/overviewUserGroups"
+            return render('/administration/dialogs/failed_new_usergroup.mako')
+
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list