[Mpuls-commits] r2085 - in wasko/branches/2.0: . jmdweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Mar 23 14:56:31 CET 2010
Author: torsten
Date: 2010-03-23 14:56:30 +0100 (Tue, 23 Mar 2010)
New Revision: 2085
Removed:
wasko/branches/2.0/jmdweb/controllers/administration.py
Modified:
wasko/branches/2.0/ChangeLog
Log:
Deleted. All functions are now defined in mpulsweb
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-03-23 13:55:21 UTC (rev 2084)
+++ wasko/branches/2.0/ChangeLog 2010-03-23 13:56:30 UTC (rev 2085)
@@ -21,6 +21,10 @@
* jmdweb/controllers/administration.py: Import all from mpulsweb
* jmdweb/lib/validators.py (DeleteUserHelperForm): Deleted. Defined in
mpulsweb now.
+ * mpulsweb/controllers/administration.py: Copied DeleteUserHelper from
+ jmdweb.
+ * jmdweb/controllers/administration.py: Deleted. DeleteUserHelper ist
+ now defined in 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/administration.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/administration.py 2010-03-23 13:55:21 UTC (rev 2084)
+++ wasko/branches/2.0/jmdweb/controllers/administration.py 2010-03-23 13:56:30 UTC (rev 2085)
@@ -1,156 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2007, 2008, 2010 Intevation GmbH, Germany, <info at intevation.de>
-#
-# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
-# Web-Anwendungs-Server fuer Kompetenzagenturen).
-#
-# mpuls WASKA is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Affero General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# mpuls WASKA is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Affero General Public
-# License along with mpuls WASKA. If not, see <http://www.gnu.org/licenses/>.
-#
-# mpuls WASKA has been developed on behalf of the
-# Projekttraeger im Deutschen Zentrum fuer Luft- und Raumfahrt e.V. (PT-DLR)
-# within the programme Kompetenzagenturen (Durchfuehrungsphase) funded by
-# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and
-# European Social Fund resources.
-#
-# Authors:
-# Torsten Irländer <torsten.irlaender at intevation.de>
-# Sascha L. Teichmann <teichmann at intevation.de>
-#
-
-import logging
-
-import formencode
-from formencode import htmlfill
-from pylons.i18n import _
-
-from mpulsweb.lib.base import c, redirect_to, render, request, session
-from mpulsweb.lib.security import checkRole
-from mpulsweb.lib.validators import DeleteUserHelperForm
-from mpulsweb.model.user import UserObject, UserListObject
-from mpulsweb.model.case import MpulsCaseOverview, MpulsCaseBundle
-from mpulsweb.controllers.administration import AdministrationController as BaseAdministrationController
-
-DELETE_USER_NOTIFICATION_SUCCESS = _('adm_delete_user_success_header')
-DELETE_USER_NOTIFICATION_TEXT_SUCCESS = _('adm_delete_user_success_text')
-
-DELETE_SELFUSER_FAILURE = _('adm_delete_selfuser_notification_header')
-DELETE_SELFUSER_FAILURE_TEXT = _('adm_delete_selfuser_notification_text')
-DELETE_USER_SUCCESS_HEADER = _('adm_delete_user_success_header')
-DELETE_USER_SUCCESS_TEXT = _('adm_delete_user_success_text')
-
-DELETE_USER_CONFIRM = _('adm_delete_user_confirm_header')
-DELETE_USER_CONFIRM_QUESTION = _('adm_delete_user_confirm_text')
-
-DIALOG_CONFIRM_SETEDITOR = _('adm_set_editor_header')
-SETEDITOR_NOTIFICATION_SUCCESS = _('adm_set_editor_success_text')
-SETEDITOR_NOTIFICATION_SUCCESS_REST = _('adm_set_editor_success_text_rest')
-SETEDITOR_NOTIFICATION_SUCCESS_HEAD = _('adm_set_editor_success_text_head')
-SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD = \
- _('adm_set_editor_success_text_rest_head')
-
-log = logging.getLogger(__name__)
-
-class AdministrationController(BaseAdministrationController):
-
- def index(self):
- redirect_to(action='overviewUser')
-
- @checkRole('admin')
- def deleteUser(self, id, confirmed='0'):
- id = self._checkInt(id)
- confirmed = self._checkBool(confirmed)
- try:
- uo = UserObject(id)
- # Make sure that the user can not delete himself
- if uo.id == session.get('USER_AUTHORIZED').id:
- c.failed_for = DELETE_SELFUSER_FAILURE
- c.failed_text = DELETE_SELFUSER_FAILURE_TEXT
- c.url_ok = "/administration/overviewUser"
- return render('/administration/dialogs/failed_delete_user.mako')
-
- if confirmed:
- # Check if there are cases for which the user is the editor. If
- # he is an editor then raise a dialog which allows the user to
- # transfer the cases.
- overview = MpulsCaseOverview()
- overview.search('editor:%s;'
- 'state:1;state:2;state:3;state:4;state:5'
- % uo.id)
- if overview.getDatasets():
- list = UserListObject()
- filter = [u.id for u in list.getAdminList()]
- filter.append(uo.id) #the user we want to delete
- c.user_list = list.getUserList(filter)
- c.cases = overview
- c.delete_user_id = id
- return render('/administration/delete_user_helper.mako')
- else:
- uo.delete()
- c.notification_for = DELETE_USER_NOTIFICATION_SUCCESS
- c.notification_text = DELETE_USER_NOTIFICATION_TEXT_SUCCESS
- c.success_for = DELETE_USER_SUCCESS_HEADER
- c.success_text = DELETE_USER_SUCCESS_TEXT
- c.url_ok = "/administration/overviewUser"
- return render('/administration/dialogs/success_delete_user.mako')
-
- else:
- c.context = "../main.mako"
- c.confirm_for = DELETE_USER_CONFIRM
- c.question = DELETE_USER_CONFIRM_QUESTION % (uo.last_name,
- uo.first_name,
- uo.login)
- c.url_yes = "/administration/deleteUser/%s/1" % id
- c.url_no = "/administration/overviewUser/"
- return render('/administration/dialogs/confirm_deleteuser.mako')
- except:
- return render('/tests/trace.mako')
-
- @checkRole('admin')
- def deleteUserHelper(self):
- validator = DeleteUserHelperForm()
- all_cases = MpulsCaseOverview()
- c.notification_for = DIALOG_CONFIRM_SETEDITOR
- c.form_errors = {}
- c.form_result = {}
- try:
- data = formencode.variabledecode.variable_decode(request.params)
- form_result = validator.to_python(data)
- case_bundle = MpulsCaseBundle(form_result.get('case_id', []))
- new_editor = UserObject(form_result.get('editor'))
- del_user = UserObject(form_result.get('user_id'))
- all_cases.search('editor:%s;state:1;state:2;state:3;state:4;state:5'
- % del_user.id)
- num = case_bundle.setEditor(form_result.get('editor'))
- rest = all_cases.numDatasets() - case_bundle.numDatasets()
- c.url_ok = ("/administration/deleteUser/%s/1"
- % form_result.get('user_id'))
- c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
- if rest > 0:
- c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD
- c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS_REST
- % (new_editor.first_name,
- new_editor.last_name,
- del_user.first_name, del_user.last_name))
- else:
- c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
- c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS
- % (new_editor.first_name,
- new_editor.last_name,
- del_user.first_name, del_user.last_name))
- return render('/administration/dialogs/notificate_delete_user_helper.mako')
- except formencode.Invalid, error:
- return self.deleteUser(form_result.get('user_id'), '1')
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Mpuls-commits
mailing list