[Mpuls-commits] r1115 - wasko/branches/2.0/waskaweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 2 11:30:02 CET 2010
Author: torsten
Date: 2010-02-02 11:30:01 +0100 (Tue, 02 Feb 2010)
New Revision: 1115
Modified:
wasko/branches/2.0/waskaweb/controllers/casedocument.py
Log:
* waskaweb/controllers/casedocument.py
(CasedocumentController.delete): New. Moved from controllers.document.
Modified: wasko/branches/2.0/waskaweb/controllers/casedocument.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/casedocument.py 2010-02-02 10:20:17 UTC (rev 1114)
+++ wasko/branches/2.0/waskaweb/controllers/casedocument.py 2010-02-02 10:30:01 UTC (rev 1115)
@@ -3,13 +3,14 @@
import paste
-from pylons import request, response, session, tmpl_context as c, h
+from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
from waskaweb.lib.base import BaseController, render
from waskaweb.lib.security import checkRole
+import waskaweb.lib.helpers as h
from waskaweb.model.case import CaseFactory, LoadCaseNotExistsError
-from waskaweb.model.document import Document
+from waskaweb.model.document import Document, deleteDocument
log = logging.getLogger(__name__)
@@ -18,6 +19,11 @@
SET_ATTACHMENT_FAILED_HEADER = u"""Keine Anlage hinzugefügt!"""
SET_ATTACHMENT_FAILED_TEXT = u"""Vergewissern Sie sich, ob der angegebene Pfad korrekt ist. Anlagen können direkt über den "Browse" bzw. "Durchsuchen" Button ausgewählt werden. Bitte klicken Sie auf "OK", um fortzufahren."""
+SET_ATTACHMENT_SUCCESS_DELETE_HEADER = u"""Anlage gelöscht!"""
+SET_ATTACHMENT_SUCCESS_DELETE_TEXT = u"""Bitte klicken Sie auf "OK", um fortzufahren."""
+SET_ATTACHMENT_CONFIRM_DELETE_HEADER = u"""Anlage löschen?"""
+SET_ATTACHMENT_CONFIRM_DELETE_TEXT = u"""Wollen Sie die Anlage wirklich löschen und die Daten unwiederbringlich verlieren?"""
+
def loadCase(id):
factory = CaseFactory()
try:
@@ -86,3 +92,28 @@
except Exception, e:
log.exception(e)
redirect_to(controller="case", action="documents")
+
+ @checkRole('cm_ka')
+ def delete(self, id, case, confirmed):
+ id = self._checkInt(id)
+ confirmed = self._checkBool(confirmed)
+ if confirmed == 1:
+ try:
+ deleteDocument(id, True)
+ except Exception, e:
+ log.exception(e)
+ c.url_ok = h.url_for(controller="/casedocument",
+ action="index" ,
+ id=session['case'].id)
+ c.success_for = SET_ATTACHMENT_SUCCESS_DELETE_HEADER
+ c.success_text = SET_ATTACHMENT_SUCCESS_DELETE_TEXT
+ return render('/casemanagement/dialogs/delete_attachment_success.mako',
+ id=session['case'].id)
+ else:
+ c.context = "../main.mako"
+ c.confirm_for = SET_ATTACHMENT_CONFIRM_DELETE_HEADER
+ c.question = SET_ATTACHMENT_CONFIRM_DELETE_TEXT
+ c.url_yes = "/casedocument/delete/%d/%d/1" % (id, session['case'].id)
+ c.url_no = h.url_for(controller="/casedocument", action="index",
+ id=session['case'].id)
+ return render('/casemanagement/dialogs/confirm_delete_attachment.mako')
More information about the Mpuls-commits
mailing list