[Mpuls-commits] r1847 - in wasko/branches/2.0: . jmdweb/controllers jmdweb/templates/statement/dialogs mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Feb 26 15:14:47 CET 2010
Author: torsten
Date: 2010-02-26 15:14:45 +0100 (Fri, 26 Feb 2010)
New Revision: 1847
Removed:
wasko/branches/2.0/jmdweb/controllers/statement.py
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/jmdweb/templates/statement/dialogs/missing_statement_body.mako
wasko/branches/2.0/mpulsweb/controllers/privacy.py
Log:
Moved handling of the declaration of consent into mpulsbase.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-02-26 13:58:12 UTC (rev 1846)
+++ wasko/branches/2.0/ChangeLog 2010-02-26 14:14:45 UTC (rev 1847)
@@ -62,6 +62,13 @@
* mpulsweb/model/case.py (MpulsCase.make_anonymizable): Ensure that
the current phase is finished. Then make the case consistent.
+ * jmdweb/templates/statement/dialogs/missing_statement_body.mako:
+ Adopted links to new privacy controller
+ * mpulsweb/controllers/privacy.py (PrivacyController.decline):
+ Implemented all methods used to set or decline the declaration of
+ consent in mpuls, which is the most important privacy statement.
+ Decline does not yet do a full anonymization.
+
2010-02-25 Bernhard Herzog <bh at intevation.de>
* waskaweb/templates/casemanagement/caselist.mako (fields): Port
Deleted: wasko/branches/2.0/jmdweb/controllers/statement.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/statement.py 2010-02-26 13:58:12 UTC (rev 1846)
+++ wasko/branches/2.0/jmdweb/controllers/statement.py 2010-02-26 14:14:45 UTC (rev 1847)
@@ -1,203 +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.
-#
-# Copyright (c) 2007 by Intevation GmbH
-# Authors:
-# Torsten Irländer <torsten.irlaender at intevation.de>
-#
-
-import logging
-
-from mpulsweb.lib.base import c, h, redirect_to, render, session
-from mpulsweb.lib.security import checkRole
-from mpulsweb.controllers.privacy import PrivacyController
-
-from jmdweb.lib.base import BaseController
-from jmdweb.lib.search import INCONSISTENCY_CHECK_AFTER
-
-from jmdweb.model.phase_transition import PHASE_DESCRIPTIONS
-
-from jmdweb.controllers.case import ANONYMIZE_CONFIRM, \
- MARKANONYMIZE_CONFIRM_TEXT, MARKANONYMIZE_SUCCESS, \
- MARKANONYMIZE_SUCCESS_TEXT, \
- MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT,\
- MARKANONYMIZE_CLEARING_PHASE_FAILED_TEXT, \
- _completeAnonymizedCase, \
- _determineAnonymizedCaseEndPhase
-
-
-log = logging.getLogger(__name__)
-
-
-HEADER = u"""Einverständniserklärung setzen?"""
-ACCEPT_QUESTION = u"""\
-Sie haben angegeben, dass eine Einverständniserklärung des Jugendlichen
-zur Erfassung, Verarbeitung und Speicherung personenbezogener Daten
-vorliegt. Sind Sie sicher das diese Angabe korrekt ist?"""
-SET_EE_ACCEPT_SUCCESS_HEADER = u"""Einwilligungserklärung gesetzt!"""
-SET_EE_ACCEPT_SUCCESS_TEXT = u"""\
-Bitte klicken Sie auf "OK", um mit der Bearbeitung der Fallakte fortzufahren."""
-SET_EE_ACCEPT_FAILED_HEADER = u"""Einwilligungserklärung nicht gesetzt!"""
-SET_EE_ACCEPT_FAILED_TEXT = u"""\
-Bei dem Setzen der Einwilligunserklärung ist ein Fehler
-aufgetreten. Bitte klicken Sie auf "OK", um fortzufahren."""
-SET_EE_DECLINE_FAILED_HEADER = u"""Fallakte wurde nicht anonymisiert!"""
-SET_EE_DECLINE_FAILED_TEXT = u"""\
-Bei dem Anonymisieren der Fallakte ist ein Fehler aufgetreten. Die
-Fallakte wurde nicht anonymisiert. Bitte klicken Sie auf "OK",
-um zur Fallaktenübersicht fortzufahren."""
-MARK_EE_DECLINE_INCOMPLETE_PHASE_FAILED = u"""\
-Die Einwilligungserklärung wurde nicht zurückgezogen!"""
-MARK_EE_DECLINE_INCOMPLETE_PHASE_FAILED_TEXT = u"""\
-<p>Das Zurückziehen der Einwilligungserklärung führt zur Anonymisierung der
-Akte.</p>
-%s""" % MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT
-MARK_EE_DECLINE_CLEARING_PHASE_FAILED_TEXT = u"""\
-<p>Das Zurückziehen der Einwilligungserklärung führt zur Anonymisierung der
-Akte.</p>
-%s""" % MARKANONYMIZE_CLEARING_PHASE_FAILED_TEXT
-
-
-class StatementController(PrivacyController):
-
- @checkRole('cm_ka')
- def index(self):
- redirect_to(controller="waska", action="start")
-
- @checkRole('cm_ka')
- def listStatements(self, id):
- return render('statement/list_statements.mako')
-
- @checkRole('cm_ka')
- def printPrivacyStatement(self, id):
- id = self._checkInt(id)
- case = self._loadCase(id)
- statement = case.getPrivacyStatement()
- c.content = statement.fillout()
- return render('statement/default_statement.mako')
-
- @checkRole('cm_ka')
- def printDiscretionStatement(self, id):
- id = self._checkInt(id)
- case = self._loadCase(id)
- statement = case.getDiscretionStatement()
- c.content = statement.fillout()
- return render('statement/default_statement.mako')
-
- @checkRole('cm_ka')
- def setPrivacyStatement(self, id):
- id = self._checkInt(id)
- case = self._loadCase(id)
- c.ds_id = id
- c.targeturl = h.url_for(controller="/case", action="digest", id=id)
- return render('statement/edit.mako')
-
- @checkRole('cm_ka')
- def acceptPrivacyStatement(self, id, confirmed):
- id = self._checkInt(id)
- confirmed = self._checkBool(confirmed)
- case = self._loadCase(id)
- if confirmed:
- try:
- statement = case.getPrivacyStatement()
- statement.sign()
- # TODO: Think about refreshing the state of the privacy
- # statement in the statement model
- session_case = session.get('case')
- session_case.privacy_statement = True
- session.save()
- c.success_for = SET_EE_ACCEPT_SUCCESS_HEADER
- c.success_text = SET_EE_ACCEPT_SUCCESS_TEXT
- c.url_ok = h.url_for(controller="/case", action="digest",
- id=case.id)
- return render('statement/dialogs/ee_accept_success.mako')
- except:
- c.failed_for = SET_EE_ACCEPT_FAILED_HEADER
- c.failed_text = SET_EE_ACCEPT_FAILED_TEXT
- c.url_ok = h.url_for(controller='/statement',
- action='setPrivacyStatement', id=case.id)
- return render('/statement/dialogs/ee_accept_failed.mako')
- else:
- c.confirm_for = HEADER
- c.question = ACCEPT_QUESTION
- c.url_yes = h.url_for(controller="statement",
- action="acceptPrivacyStatement",
- id=id, confirmed="1")
- c.url_no = h.url_for(controller="/case", action="select",
- id=id, confirmed=0)
- return render('statement/dialogs/confirm.mako')
-
- @checkRole('cm_ka')
- def declinePrivacyStatement(self, id, confirmed):
- id = self._checkInt(id)
- confirmed = self._checkBool(confirmed)
- case = self._loadCase(id)
- if ((not case.getState().phasesAreConsistent()
- or not case.getState().phasesAreCompleted())
- and case.isYoungerThan(INCONSISTENCY_CHECK_AFTER)):
- c.notification_for = MARK_EE_DECLINE_INCOMPLETE_PHASE_FAILED
- if case.getState().getPhase() in (CLEAR_START, CLEAR_ENDE):
- c.notification_text = \
- MARK_EE_DECLINE_CLEARING_PHASE_FAILED_TEXT
- else:
- c.notification_text = \
- MARK_EE_DECLINE_INCOMPLETE_PHASE_FAILED_TEXT
- c.url_ok = "/case/digest/%s" % id
- return render('/casemanagement/dialogs/failed_markanonymize_phase_incomplete.mako')
- if confirmed:
- try:
- statement = case.getPrivacyStatement()
- statement.decline()
- # Mark case for anonymizion
- case.getState().setState(4)
-
- _completeAnonymizedCase(case)
- # TODO: Think about refreshing the state of the privacy
- # statement in the statement model
- session_case = session.get('case')
- session_case.privacy_statement = True
- session.save()
- c.success_for = MARKANONYMIZE_SUCCESS
- c.success_text = MARKANONYMIZE_SUCCESS_TEXT
- c.url_ok = h.url_for ('/case_overview')
- return render('/statement/dialogs/ee_decline_success.mako')
- except:
- c.failed_for = SET_EE_DECLINE_FAILED_HEADER
- c.failed_text = SET_EE_DECLINE_FAILED_TEXT
- c.url_ok = h.url_for ('/case_overview')
- return render('/statement/dialogs/ee_decline_failed.mako')
- else:
- c.confirm_for = ANONYMIZE_CONFIRM
- c.question = MARKANONYMIZE_CONFIRM_TEXT % \
- PHASE_DESCRIPTIONS[_determineAnonymizedCaseEndPhase(case)]
- c.url_yes = h.url_for(controller="statement",
- action="declinePrivacyStatement",
- id=id, confirmed="1")
- c.url_no = h.url_for(controller="/case", action="select", \
- id=id, confirmed=0)
- return render('statement/dialogs/confirm.mako')
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:
Modified: wasko/branches/2.0/jmdweb/templates/statement/dialogs/missing_statement_body.mako
===================================================================
--- wasko/branches/2.0/jmdweb/templates/statement/dialogs/missing_statement_body.mako 2010-02-26 13:58:12 UTC (rev 1846)
+++ wasko/branches/2.0/jmdweb/templates/statement/dialogs/missing_statement_body.mako 2010-02-26 14:14:45 UTC (rev 1847)
@@ -3,21 +3,29 @@
<h1><img src="/images/alert.png"/>${_('statement_dialog_header_statement_no')}</h1>
<p>${_('statement_dialog_p_statement_no_explanation')}</p>
% if h.hasRole(['cm_ka']):
-<p>${_('statement_dialog_p_options') % h.link_to(_('statement_edit_a_statement_form_printversion'), h.url_for(controller="statement", action="printPrivacyStatement", id=c.ds_id))}
+ <p>${_('statement_dialog_p_options') % h.link_to(_('statement_edit_a_statement_form_printversion'), h.url_for(controller="privacy", action="printStatement", id=c.ds_id))}
-<ol>
-<li><strong>${_('statement_dialog_li_statement_accepted')}</strong>${_('statement_dialog_li_statement_accepted_explanation')}</li>
-<li><strong>${_('statement_dialog_li_statement_unclear')}</strong>${_('statement_dialog_li_statement_unclear_explanation')}</li>
-<li><strong>${_('statement_dialog_li_statement_declined')}</strong>${_('statement_dialog_li_statement_declined_explanation')}</li>
-</ol>
-<p>
-<a class="button" href="${h.url_for(controller="statement", action="acceptPrivacyStatement", id=c.ds_id, confirmed=0)}">${_('statement_dialog_li_statement_accepted')}</a>
-<a class="button" href="${c.targeturl}">${_('statement_dialog_li_statement_unclear')}</a>
-<a class="button" href="${h.url_for(controller="statement", action="declinePrivacyStatement", id=c.ds_id, confirmed=0)}">${_('statement_dialog_li_statement_declined')}</a>
-</p>
+ <ol>
+ <li>
+ <strong>${_('statement_dialog_li_statement_accepted')}</strong>
+ ${_('statement_dialog_li_statement_accepted_explanation')}
+ </li>
+ <li><strong>${_('statement_dialog_li_statement_unclear')}</strong>
+ ${_('statement_dialog_li_statement_unclear_explanation')}
+ </li>
+ <li><strong>${_('statement_dialog_li_statement_declined')}</strong>
+ ${_('statement_dialog_li_statement_declined_explanation')}
+ </li>
+ </ol>
+ </p>
+ <p>
+ <a class="button" href="${h.url_for(controller="privacy", action="accept", id=c.ds_id, confirmed=0)}">${_('statement_dialog_li_statement_accepted')}</a>
+ <a class="button" href="${c.targeturl}">${_('statement_dialog_li_statement_unclear')}</a>
+ <a class="button" href="${h.url_for(controller="privacy", action="decline", id=c.ds_id, confirmed=0)}">${_('statement_dialog_li_statement_declined')}</a>
+ </p>
% else:
-<p>
-<a class="button" href="/case/select/${c.ds_id}/1">${_('statement_dialog_a_ok')}</a>
-</p>
+ <p>
+ <a class="button" href="/case/select/${c.ds_id}/1">${_('statement_dialog_a_ok')}</a>
+ </p>
% endif
Modified: wasko/branches/2.0/mpulsweb/controllers/privacy.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/privacy.py 2010-02-26 13:58:12 UTC (rev 1846)
+++ wasko/branches/2.0/mpulsweb/controllers/privacy.py 2010-02-26 14:14:45 UTC (rev 1847)
@@ -1,8 +1,25 @@
# -*- coding: utf-8 -*-
import logging
-from mpulsweb.lib.base import BaseController, render
+from pylons import app_globals as g
+
+from mpulsweb.lib.security import checkRole
+from mpulsweb.lib.base import BaseController, render, c, h
+from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase
+
+from mpulsweb.controllers.case import ANONYMIZE_CONFIRM, \
+ MARKANONYMIZE_CONFIRM_TEXT, MARKANONYMIZE_SUCCESS, MARKANONYMIZE_SUCCESS_TEXT \
+
+HEADER = u"""Einverständniserklärung setzen?"""
+ACCEPT_QUESTION = u"""\
+Sie haben angegeben, dass eine Einverständniserklärung des Jugendlichen
+zur Erfassung, Verarbeitung und Speicherung personenbezogener Daten
+vorliegt. Sind Sie sicher das diese Angabe korrekt ist?"""
+SET_EE_ACCEPT_SUCCESS_HEADER = u"""Einwilligungserklärung gesetzt!"""
+SET_EE_ACCEPT_SUCCESS_TEXT = u"""\
+Bitte klicken Sie auf "OK", um mit der Bearbeitung der Fallakte fortzufahren."""
+
log = logging.getLogger(__name__)
class PrivacyController(BaseController):
@@ -12,17 +29,88 @@
in WASKA/WASKO) or similar. Additionally it is possible to list available
static statements.
'''
+ @checkRole('cm')
def index(self):
return self.listStatements()
+ @checkRole('cm')
def listStatements(self):
'''Will render a list of available static statements related to privacy in mpuls'''
return render('privacy/list_statements.mako')
- def accept(self, id):
- pass
+ @checkRole('cm')
+ def printStatement(self, id):
+ id = self._checkInt(id)
+ case = self._loadCase(id)
+ statement = case.getPrivacyStatement()
+ c.content = statement.fillout()
+ return render('statement/default_statement.mako')
- def decine(self, id):
- pass
+ @checkRole('cm')
+ def set(self,id):
+ c.targeturl = h.url_for(controller="/case", action="digest", id=id)
+ c.ds_id = id
+ return render('statement/edit.mako')
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:
+ @checkRole('cm')
+ def accept(self, id, confirmed):
+ id = self._checkInt(id)
+ confirmed = self._checkBool(confirmed)
+ case = self._loadCase(id)
+ if confirmed:
+ statement = case.getPrivacyStatement()
+ statement.sign()
+ # TODO: Think about refreshing the state of the privacy
+ # statement in the statement model
+ session_case = session.get('case')
+ session_case.privacy_statement = True
+ session.save()
+ c.dialog_title = SET_EE_ACCEPT_SUCCESS_HEADER
+ c.dialog_text = SET_EE_ACCEPT_SUCCESS_TEXT
+ c.url_ok = h.url_for(controller="/case", action="digest",
+ id=case.id)
+ return render('statement/dialogs/ee_accept_success.mako')
+ else:
+ c.dialog_title = HEADER
+ c.dialog_text = ACCEPT_QUESTION
+ c.url_yes = h.url_for(controller="statement",
+ action="acceptPrivacyStatement",
+ id=id, confirmed="1")
+ c.url_no = h.url_for(controller="/case", action="select",
+ id=id, confirmed=0)
+ return render('statement/dialogs/confirm.mako')
+
+ @checkRole('cm')
+ def decline(self, id, confirmed=False):
+ id = self._checkInt(id)
+ confirmed = self._checkBool(confirmed)
+ case = self._loadCase(id)
+
+ # TODO: Implement check if the case fullfills the minimum requirement
+ # for abortion.
+
+ if confirmed:
+ statement = case.getPrivacyStatement()
+ statement.decline()
+ # Mark case for anonymizion
+ #case.getState().setState(4)
+ #case.make_anonymizable()
+
+ c.dialog_title = MARKANONYMIZE_SUCCESS
+ c.dialog_text = MARKANONYMIZE_SUCCESS_TEXT
+ c.url_ok = h.url_for ('/case_overview')
+ return render('/statement/dialogs/ee_decline_success.mako')
+ else:
+ # Get description of the phase which will be set after anonymisation
+ pdescriptions = g.mpuls_config.get('phases', 'description')[0]
+ phase = pdescriptions.get(determineAnonymizedCaseEndPhase(case))
+ c.dialog_title = ANONYMIZE_CONFIRM
+ c.dialog_text = MARKANONYMIZE_CONFIRM_TEXT % phase
+ c.url_yes = h.url_for(controller="privacy",
+ action="decline",
+ id=id, confirmed="1")
+ c.url_no = h.url_for(controller="/case", action="select", \
+ id=id, confirmed=0)
+ return render('statement/dialogs/confirm.mako')
+
+# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8MARKANONYMIZE_SUCCESS, MARKANONYMIZE_SUCCESS_TEXT:
More information about the Mpuls-commits
mailing list