[Mpuls-commits] r5269 - waska/branches/waska3/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 30 09:30:13 CEST 2011


Author: torsten
Date: 2011-08-30 09:30:12 +0200 (Tue, 30 Aug 2011)
New Revision: 5269

Removed:
   waska/branches/waska3/waskaweb/controllers/logbook.py
Log:
L?\195?\182sche WASKA-spezifischen Logbook controller. Verwende controller aus der
Basis.


Deleted: waska/branches/waska3/waskaweb/controllers/logbook.py
===================================================================
--- waska/branches/waska3/waskaweb/controllers/logbook.py	2011-08-30 07:29:16 UTC (rev 5268)
+++ waska/branches/waska3/waskaweb/controllers/logbook.py	2011-08-30 07:30:12 UTC (rev 5269)
@@ -1,122 +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.
-
-import logging
-
-from mpulsweb.controllers.logbook import LogbookController, get_sort
-from mpulsweb.model.logbook import Logbook
-
-from mpulsweb.lib.base import c, render, request, session
-from mpulsweb.lib.db import db
-from mpulsweb.lib.security import checkRole
-
-log = logging.getLogger(__name__)
-
-class LogbookController(LogbookController):
-    @checkRole(('cm_ka'))
-    def index(self, id):
-        return self.overview(id)
-
-    def overview(self, id):
-        sort, order = get_sort(request.params)
-        id = self._checkInt(id)
-
-        # Load logbook
-        logbook = Logbook()
-        logbook.loadById(int(id), sort, order)
-        c.logbook = logbook
-
-        # Build evaluations
-        c.eval_effort = logbook.getEvaluation()
-        type_statistics = logbook.getTypEvaluation()
-        c.eval_typ_effort = type_statistics
-        
-        
-        # Update the case data with the evaluation statistics. Do not this if
-        # the user manually edited the fields in the form page.
-        conn, cur = None, None
-        try:
-            update_case = True
-            conn = db.getConnection()
-            
-            # Decide here whether to update or not.
-            # Roland: it is not yet clear till we will do the automatic update
-            # of the statistics (e.g. till X required fields are filled)
-            
-            #sql_load = "SELECT xyz FROM master_tbl_view WHERE id = %s" % id
-            #cur = conn.cursor()
-            #cur.execute(sql_load)
-            #row = cur.fetchone()
-            
-            new_data = {'id': id}
-            formed_suffix = {-1: 'ka', 0: 'aufsuchend', 1: 'nicht_aufsuchend'}
-            
-            sql_update = 'UPDATE master_tbl_view SET '
-            # Set the data for the different types
-            for logbook_type in type_statistics['types']:
-                if logbook_type['typ'] != None:
-                    tagebuch_kontakte = 'tagebuch_anzahl_kontakte_%s' % \
-                                 formed_suffix.get(logbook_type['typ'], 'ka')
-                    tagebuch_aufwand  = 'tagebuch_aufwand_stunden_%s' % \
-                                 formed_suffix.get(logbook_type['typ'], 'ka')
-                    tagebuch_prozent  = 'tagebuch_prozent_%s' % \
-                                formed_suffix.get(logbook_type['typ'], 'ka')
-    
-                    sql_update = sql_update + ' %(kontakte)s = %%(%(kontakte)s)s, ' % \
-                                        {'kontakte': tagebuch_kontakte}
-                    sql_update = sql_update + ' %(aufwand)s = %%(%(aufwand)s)s, ' % \
-                                        {'aufwand': tagebuch_aufwand}
-                    sql_update = sql_update + ' %(prozent)s = %%(%(prozent)s)s, ' % \
-                                        {'prozent': tagebuch_prozent}
-
-                    new_data[tagebuch_kontakte] = logbook_type['amount']
-                    new_data[tagebuch_aufwand] = logbook_type['time']
-                    new_data[tagebuch_prozent] = logbook_type['percent']
-            
-            # Set the data for the general statistics
-            
-            sql_update = sql_update + 'tagebuch_anzahl_kontakte_gesamt = %s, ' % \
-                                            type_statistics['total']['amount']
-            sql_update = sql_update + 'tagebuch_aufwand_stunden_gesamt = %s, ' % \
-                                            type_statistics['total']['time']
-            sql_update = sql_update + 'tagebuch_prozent_gesamt = %s ' % \
-                                            type_statistics['total']['percent']
-            
-            #now put all together
-            sql_update = sql_update + ' WHERE id = %(id)s'
-            
-            # Roland: this will change, once it is decided how and when we will
-            # update the statistics. Till then, don't do anything
-            #if update_case:
-            
-            #if type_statistics['types']:
-            #    cur = conn.cursor()
-            #    cur.execute(sql_update, new_data)
-            #    conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
-        
-        return render('/logbook/overview.mako')
\ No newline at end of file



More information about the Mpuls-commits mailing list