[Mpuls-commits] r1716 - wasko/branches/2.0/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 23 17:57:15 CET 2010
Author: torsten
Date: 2010-02-23 17:57:14 +0100 (Tue, 23 Feb 2010)
New Revision: 1716
Modified:
wasko/branches/2.0/mpulsweb/controllers/case.py
Log:
* mpulsweb/controllers/case.py: Copied some functions from jmdweb to
mpulsweb
Modified: wasko/branches/2.0/mpulsweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case.py 2010-02-23 16:40:26 UTC (rev 1715)
+++ wasko/branches/2.0/mpulsweb/controllers/case.py 2010-02-23 16:57:14 UTC (rev 1716)
@@ -5,16 +5,88 @@
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
+
from mpulsweb.lib.base import BaseController, render, h
+from mpulsweb.lib.navigation import get_navigation
from mpulsweb.lib.security import checkRole
from mpulsweb.lib.validators import SetStandinForm, SetEditorForm
from mpulsweb.model.user import UserGroupList, UserListObject
+from mpulsweb.controllers.formularpage import get_rendered_page
+
log = logging.getLogger(__name__)
class CaseController(BaseController):
+ def init_case(self, id):
+ '''Return a case object'''
+ case = self._loadCase(id)
+ # New session code
+ session_case = case.getSessionCase()
+ session['case'] = session_case
+
+ open_folders = []
+ navigation = get_navigation(id)
+ session['render_mode'] = 'ro'
+ session['navigation.tree'] = navigation
+ session['navigation.openfolders'] = open_folders
+ session.save()
+ return case
+
+ @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
+ def index(self):
+ redirect_to(controller="/case_overview")
+
+ @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
+ def digest(self, id):
+ id = self._checkInt(id)
+ case = self.init_case(id)
+ c.case = case
+ c.last_access = case.getState().getAccessTime()
+ c.daysToMaxSavetime = case.getState().daysToMaxSavetime()
+ c.maxsavetime = case.getState().getMaxSavetime()
+ c.finished = case.getState().isCmFinished()
+ c.canceled = case.getState().isCmCanceled()
+ return render('/casemanagement/digest.mako')
+
#
+ # Printing
+ #
+ @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
+ def printdigest(self, id):
+ c.print_version = 1
+ return self.digest(id)
+
+ @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
+ def printAll(self, id, empty='0'):
+ c.print_version = 1
+ out = []
+ case = self._loadCase(id)
+ c.case = case
+ render_mode = session['render_mode']
+ session['render_mode'] = 'ro'
+ session.save()
+ digest = render('/casemanagement/digest_body.mako')
+ out.append(unicode(digest, 'utf-8'))
+ navigation = session.get('navigation.tree')
+ if navigation:
+ for item in navigation.getAllItems():
+ out.append(get_rendered_page(item.key))
+ c.formular = "".join(out)
+ session['render_mode'] = render_mode
+ session.save()
+ return render('/formularpage/formular.mako')
+
+ #
+ # Create new case
+ #
+
+ @checkRole('cm_ka')
+ def new2(self):
+ c.case = session.get('case')
+ return render('/casemanagement/new.mako')
+
+ #
# ORGANISATION (standin and editor settings)
#
More information about the Mpuls-commits
mailing list