[Mpuls-commits] r5390 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Sep 23 17:20:37 CEST 2011
Author: torsten
Date: 2011-09-23 17:20:37 +0200 (Fri, 23 Sep 2011)
New Revision: 5390
Modified:
base/trunk/mpulsweb/lib/dialogs.py
Log:
Modified render_error/confirm/success dialog. Added paramenter ctx to define
the context in which the dialog should be rendereres. Default is case-context.
Modified: base/trunk/mpulsweb/lib/dialogs.py
===================================================================
--- base/trunk/mpulsweb/lib/dialogs.py 2011-09-23 15:19:33 UTC (rev 5389)
+++ base/trunk/mpulsweb/lib/dialogs.py 2011-09-23 15:20:37 UTC (rev 5390)
@@ -73,17 +73,18 @@
# confirm dialog. Not that this means to loose information in the navigation
# path, as the dialogs do not have any information on this
-def get_dialog_template():
+def get_dialog_template(ctx="case"):
"""
Depending of the called url this function will return the context
(global/case) in which the dialog will be displayed
"""
# TODO: Parse url and return context
- return "case" # All dialogs are shown in case context for now
+ if not ctx: ctx = "case"
+ return ctx # All dialogs are shown in case context for now
def render_confirm(header=None, text=None, url_ok=None, url_abort=None,
- dyntext=None):
+ dyntext=None, ctx=None):
"""Returns the rendered confirm dialog"""
c.dialog_title = header or _('Default Header')
if dyntext and text:
@@ -92,10 +93,10 @@
c.dialog_text = text or _('Default Text')
c.url_ok = url_ok
c.url_abort = url_abort or url_for(controller="meta", action="index")
- return render('/dialogs/confirm_%s.mako' % get_dialog_template())
+ return render('/dialogs/confirm_%s.mako' % get_dialog_template(ctx))
-def render_success(header=None, text=None, url_ok=None, dyntext=None):
+def render_success(header=None, text=None, url_ok=None, dyntext=None, ctx=None):
"""Returns the rendered success dialog"""
c.dialog_title = header or _('Default Header')
if dyntext and text:
@@ -103,10 +104,10 @@
else:
c.dialog_text = text or _('Default Text')
c.url_ok = url_ok
- return render('/dialogs/success_%s.mako' % get_dialog_template())
+ return render('/dialogs/success_%s.mako' % get_dialog_template(ctx))
-def render_error(header=None, text=None, url_ok=None, dyntext=None):
+def render_error(header=None, text=None, url_ok=None, dyntext=None, ctx=None):
"""Returns the rendered error dialog"""
c.dialog_title = header or _('Default Header')
if dyntext and text:
@@ -114,7 +115,7 @@
else:
c.dialog_text = text or _('Default Text')
c.url_ok = url_ok
- return render('/dialogs/error_%s.mako' % get_dialog_template())
+ return render('/dialogs/error_%s.mako' % get_dialog_template(ctx))
def confirm(header=None, text=None, url_ok=None, url_abort=None, dynfunc=None):
More information about the Mpuls-commits
mailing list