[Mpuls-commits] r1862 - in wasko/branches/2.0: . jmdweb/controllers mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 1 08:42:19 CET 2010
Author: torsten
Date: 2010-03-01 08:42:18 +0100 (Mon, 01 Mar 2010)
New Revision: 1862
Added:
wasko/branches/2.0/mpulsweb/controllers/casedocument.py
Removed:
wasko/branches/2.0/jmdweb/controllers/casedocument.py
Modified:
wasko/branches/2.0/ChangeLog
Log:
Moved casedocument controller to mpulsweb
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-03-01 07:40:50 UTC (rev 1861)
+++ wasko/branches/2.0/ChangeLog 2010-03-01 07:42:18 UTC (rev 1862)
@@ -1,3 +1,10 @@
+2010-03-01 Torsten Irländer <torsten.irlaender at intevation.de>
+
+ * jmdweb/controllers/casedocument.py: Import BaseController from
+ mpulsweb.
+ * mpulsweb/controllers/casedocument.py,
+ jmdweb/controllers/casedocument.py: Moved.
+
2010-02-26 Bernhard Herzog <bh at intevation.de>
* mpulsweb/lib/app_globals.py (Globals.__init__): tell paste to
Deleted: wasko/branches/2.0/jmdweb/controllers/casedocument.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/casedocument.py 2010-03-01 07:40:50 UTC (rev 1861)
+++ wasko/branches/2.0/jmdweb/controllers/casedocument.py 2010-03-01 07:42:18 UTC (rev 1862)
@@ -1,121 +0,0 @@
-# -*- coding: utf-8 -*-
-import logging
-
-import paste
-
-from pylons import request, session, tmpl_context as c
-from pylons.controllers.util import redirect_to
-
-from mpulsweb.lib.base import BaseController, render
-from mpulsweb.lib.security import checkRole
-import mpulsweb.lib.helpers as h
-
-from mpulsweb.model.document import Document, deleteDocument
-
-log = logging.getLogger(__name__)
-
-SET_ATTACHMENT_SUCCESS_HEADER = u"""Anlage hinzugefügt!"""
-SET_ATTACHMENT_SUCCESS_TEXT = u"""\
-Bitte klicken Sie auf "OK", um fortzufahren."""
-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?"""
-
-class CasedocumentController(BaseController):
-
- @checkRole(('admin_ka', 'cm_ka'))
- def index(self, id):
- return self.overview(id)
-
- @checkRole(('admin_ka', 'cm_ka'))
- def overview(self, id):
- id = self._checkInt(id)
- case = self._loadCase(id)
- c.files = case.getDocuments()
- return render('/documents/case_overview.mako')
-
- @checkRole('cm_ka')
- def new(self):
- return render('/documents/case_new.mako')
-
- @checkRole('cm_ka')
- def newAction(self):
- try:
- case = int(request.POST['case'])
- except:
- redirect_to(controller="casedocument", action="index")
-
- try:
- doc = Document()
- myfile = None
- try:
- myfile = request.POST.get('file')
- if not myfile is None:
- doc.create(myfile.filename, myfile.file, case)
- c.success_for = SET_ATTACHMENT_SUCCESS_HEADER
- c.success_text = SET_ATTACHMENT_SUCCESS_TEXT
- c.url_ok = h.url_for(controller="/casedocument",
- action="index", id=case)
- return render('/documents/dialogs/success_attachment.mako')
- finally:
- if not myfile is None:
- try:
- myfile.file.close()
- except:
- pass
- except Exception, e:
- log.exception(e)
- c.failed_for = SET_ATTACHMENT_FAILED_HEADER
- c.failed_text = SET_ATTACHMENT_FAILED_TEXT
- c.url_ok = h.url_for(controller="/casedocument",
- action="new", id=case)
- return render('/documents/dialogs/failed_attachment.mako')
-
- @checkRole(('admin_ka', 'cm_ka'))
- def show(self, id):
- id = self._checkInt(id)
- try:
- document = Document(id)
- document.load(True)
- data = paste.fileapp.DataApp(document.data,
- content_type=document.mime,
- cache_control='must-revalidate',
- pragma='public')
- return data(request.environ, self.start_response)
- except Exception, e:
- log.exception(e)
- redirect_to(controller="case", action="documents")
-
- @checkRole('cm_ka')
- def delete(self, id, 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/1" % (id)
- c.url_no = h.url_for(controller="/casedocument", action="index",
- id=session['case'].id)
- return render('/casemanagement/dialogs/confirm_delete_attachment.mako')
Copied: wasko/branches/2.0/mpulsweb/controllers/casedocument.py (from rev 1861, wasko/branches/2.0/jmdweb/controllers/casedocument.py)
Property changes on: wasko/branches/2.0/mpulsweb/controllers/casedocument.py
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the Mpuls-commits
mailing list