[Mpuls-commits] r2357 - wasko/branches/2.0/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Apr 15 09:31:02 CEST 2010
Author: torsten
Date: 2010-04-15 09:31:02 +0200 (Thu, 15 Apr 2010)
New Revision: 2357
Modified:
wasko/branches/2.0/mpulsweb/controllers/case.py
Log:
* mpulsweb/controllers/case.py (CaseController.keepActive): Split
function into "_keep_active_with_logbook" and
"_keep_active_without_logbook". If logbook is not enabled just the
last accesstime will be updated.
Modified: wasko/branches/2.0/mpulsweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case.py 2010-04-15 07:24:52 UTC (rev 2356)
+++ wasko/branches/2.0/mpulsweb/controllers/case.py 2010-04-15 07:31:02 UTC (rev 2357)
@@ -4,6 +4,7 @@
import formencode
from pylons import request, session, tmpl_context as c, app_globals as g
+from pylons.i18n import _
from pylons.controllers.util import redirect_to
@@ -338,6 +339,15 @@
@checkRole('cm')
@checkPrivacyStatement('keepActive')
def keepActive(self, id, confirmed):
+ # If logbook is enabled let the user give the reason why he keeps the
+ # case active.
+ if g.mpuls_config.is_enabled('case-module', 'logbook'):
+ return self._keep_active_with_logbook(id)
+ # Just refresh last access date.
+ else:
+ return self._keep_active_without_logbook(id)
+
+ def _keep_active_with_logbook(self, id):
entry = LogbookEntry()
entry.setDate(datetime.now())
entry.setKind(-2)
@@ -359,4 +369,23 @@
auto_insert_errors=False,
errors=c.form_errors)
+ def _keep_active_without_logbook(self, id):
+ id = self._checkInt(id)
+ case = self._loadCase(id)
+ try:
+ # Temporarily switch the state of the case to force refreshing the last
+ # access date.
+ state = case.getState().getState()
+ case.getState().setState(2)
+ case.getState().setState(state)
+ c.dialog_title = _('Case storage extended')
+ c.dialog_text = _('Please click on "OK" to continue')
+ c.url_ok = h.url_for(controller="/")
+ return render('/casemanagement/dialogs/success_keepactive.mako')
+ except:
+ log.exception('Can not refresh case in "_keep_active_without_logbook"')
+ raise
+
+ pass
+
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Mpuls-commits
mailing list