[Mpuls-commits] r1485 - in wasko/branches/2.0: mpulsweb/controllers waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 11 08:15:00 CET 2010


Author: torsten
Date: 2010-02-11 08:15:00 +0100 (Thu, 11 Feb 2010)
New Revision: 1485

Added:
   wasko/branches/2.0/mpulsweb/controllers/appointment.py
Removed:
   wasko/branches/2.0/waskaweb/controllers/appointment.py
Log:
* mpulsweb/controllers/appointment.py,
waskaweb/controllers/appointment.py: Moved controller to mpulsbase.
Adapted imports.


Copied: wasko/branches/2.0/mpulsweb/controllers/appointment.py (from rev 1484, wasko/branches/2.0/waskaweb/controllers/appointment.py)


Property changes on: wasko/branches/2.0/mpulsweb/controllers/appointment.py
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: wasko/branches/2.0/waskaweb/controllers/appointment.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/appointment.py	2010-02-11 07:13:10 UTC (rev 1484)
+++ wasko/branches/2.0/waskaweb/controllers/appointment.py	2010-02-11 07:15:00 UTC (rev 1485)
@@ -1,207 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2007, 2008 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
-from datetime import datetime
-
-import formencode
-
-from mpulsweb.lib.base import BaseController, c, redirect_to, render, request
-from mpulsweb.lib.helpers import dd_mm_YYYY, HH_MM
-from mpulsweb.lib.security import checkRole
-from mpulsweb.model.appointment import GlobalAppointmentOverview, \
-     GlobalAppointmentFactory
-
-from mpulsweb.lib.validators import CreateAppointmentForm
-
-log = logging.getLogger(__name__)
-
-DELETE_APPOINT_CONFIRM = u'Löschen Termin'
-DELETE_APPOINT_CONFIRM_TEXT = u"""\
-Wollen Sie wirklich den Termin löschen und die Daten unwiederbringlich
-verlieren?"""
-DELETE_APPOINT_NOTIFICATION_SUCCESS = u'Termin gelöscht'
-DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
-Der Termin wurde erfolgreich gelöscht. Klicken Sie auf 'OK', um zur
-Terminübersicht zu gelangen."""
-
-DELETE_APPOINT_NOTIFICATION_FAILED = u'Termin nicht gelöscht'
-DELETE_APPOINT_NOTIFICATION_TEXT_FAILED = u"""\
-Bei dem Löschen des Termins ist einer Fehler aufgetreten.  Der Termin
-wurde nicht gelöscht. Klicken Sie auf 'OK', um zur Terminübersicht zu
-gelangen."""
-
-CREATE_APPOINT_NOTIFICATION_SUCCESS = u"""Termin erstellt"""
-CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
-Der Termin wurde erfolgreich erstellt. Klicken Sie auf 'OK', um zur
-Terminübersicht zu gelangen."""
-
-EDIT_APPOINT_NOTIFICATION_SUCCESS = u"""Termin bearbeitet"""
-EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
-Der Termin wurde erfolgreich bearbeitet. Klicken Sie auf 'OK', um zur
-Terminübersicht zu gelanden."""
-
-
-class AppointmentController(BaseController):
-
-    @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
-    def index(self):
-        redirect_to(action='overview')
-
-    @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
-    def overview(self):
-        c.appointmentlist = GlobalAppointmentOverview()
-        return render('/appointments/overview.mako')
-
-    @checkRole(('admin_ka'))
-    def create(self):
-        c.form_errors = {}
-        c.form_result = {}
-        cd = datetime.now()
-        c.form_defaults = {'start_date': dd_mm_YYYY(cd),
-                           'start_time': HH_MM(cd),
-                           'case_id': None}
-        form = render('/appointments/new.mako')
-        return formencode.htmlfill.render(unicode(form, 'utf-8'),
-                                          defaults=c.form_defaults)
-
-    @checkRole(('admin_ka'))
-    def createAction(self):
-        validator = CreateAppointmentForm()
-        factory = GlobalAppointmentFactory()
-        c.form_errors = {}
-        c.form_result = {}
-        try:
-            try:
-                form_result = validator.to_python(request.params)
-                # Create appointment
-                appointment = factory.createNew()
-                appointment.setData(form_result)
-                appointment.store()
-                c.success_for = CREATE_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/success_create_appointment.mako')
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                form = render('/appointments/new.mako')
-                return formencode.htmlfill.render(unicode(form, 'utf-8'),
-                                                  defaults=c.form_result,
-                                                  auto_insert_errors=False,
-                                                  errors=c.form_errors)
-        except:
-            return render('/tests/trace.mako')
-
-    @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
-    def show(self, id):
-        factory = GlobalAppointmentFactory()
-        c.appointment = factory.loadById(id)
-        return render('/appointments/show.mako')
-
-    @checkRole(('admin_ka'))
-    def edit(self, id):
-        id = self._checkInt(id)
-        factory = GlobalAppointmentFactory()
-        app = factory.loadById(id)
-
-        c.form_result = {'start_date': dd_mm_YYYY(app.start_date),
-                         'start_time': HH_MM(app.start_date),
-                         'end_date': dd_mm_YYYY(app.end_date),
-                         'end_time': HH_MM(app.end_date),
-                         'title': app.title,
-                         'id': app.id,
-                         'description': app.description}
-
-        c.form_errors = {}
-        form = render('/appointments/edit.mako')
-        return formencode.htmlfill.render(unicode(form, 'utf-8'),
-                                          defaults=c.form_result,
-                                          auto_insert_errors=False,
-                                          errors=c.form_errors)
-
-    @checkRole(('admin_ka'))
-    def editAction(self):
-        validator = CreateAppointmentForm()
-        factory = GlobalAppointmentFactory()
-        c.form_errors = {}
-        c.form_result = {}
-        try:
-            try:
-                form_result = validator.to_python(request.params)
-                # Load appointment and set data
-                appointment = factory.loadById(form_result.get('id'))
-                appointment.setData(form_result)
-                appointment.store()
-                c.success_for = EDIT_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/success_edit_appointment.mako')
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                form = render('/appointments/edit.mako')
-                return formencode.htmlfill.render(unicode(form, 'utf-8'),
-                                                  defaults=c.form_result,
-                                                  auto_insert_errors=False,
-                                                  errors=c.form_errors)
-        except:
-            return render('/tests/trace.mako')
-
-    @checkRole(('admin_ka'))
-    def delete(self, id, confirmed=False):
-        id = self._checkInt(id)
-        confirmed = self._checkBool(confirmed)
-        factory = GlobalAppointmentFactory()
-        if confirmed == 1:
-            appointment = factory.loadById(id)
-            if appointment.delete():
-                c.success_for = DELETE_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/success_delete_appointment.mako')
-            else:
-                c.failed_for = DELETE_APPOINT_NOTIFICATION_FAILED
-                c.failed_text = DELETE_APPOINT_NOTIFICATION_TEXT_FAILED
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/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 = "/appointment/delete/%s/1" % id
-            c.url_no = "/appointment/overview/"
-            return render('/appointments/dialogs/confirm.mako')
-
-    @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
-    def save(self):
-        return render('/appointments/new.mako')
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list