forth navigation fixes
Message-ID: <54339703.AdsysKD0liPjZ9Xh%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: e2aecb012b2d5eaa0585c8c4353b34ea2f24d610
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e2aecb012b2d5e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 7 09:32:11 2014 +0200
Additional dashboard / dashlet back/forth navigation fixes
---
web/htdocs/dashboard.py | 17 ++++++++++-------
web/htdocs/views.py | 2 +-
web/htdocs/visuals.py | 6 ++++--
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index abf730a..5ad17c3 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -680,10 +680,7 @@ def page_create_view_dashlet():
if create:
import views
- # %s can not be added using html.makeuri(), replaced with datasource later
- url = html.makeuri([], filename = "create_view_dashlet_infos.py")
- url += '&datasource=%s'
-
+ url = html.makeuri([('back', html.makeuri([]))], filename =
"create_view_dashlet_infos.py")
views.page_create_view(next_url=url)
else:
@@ -698,8 +695,13 @@ def page_create_view_dashlet_infos():
# Create a new view by choosing the datasource and the single object types
visuals.page_create_visual('views', _("View"),
views.multisite_datasources[ds_name]['infos'],
- next_url =
'edit_dashlet.py?name=%s&type=view&datasource=%s&single_infos=%%s' %
- (html.urlencode(html.var('name')), ds_name))
+ next_url = html.makeuri_contextless([
+ ('name', html.var('name')),
+ ('type', 'view'),
+ ('datasource', ds_name),
+ ('back', html.makeuri([])),
+ ('next', html.makeuri_contextless([('name',
html.var('name')), ('edit', '1')],'dashboard.py')),
+ ], filename = 'edit_dashlet.py'))
def choose_view(name):
import views
@@ -822,6 +824,7 @@ def page_edit_dashlet():
html.begin_context_buttons()
back_url = html.var('back', 'dashboard.py?name=%s&edit=1' %
board)
+ next_url = html.var('next', back_url)
html.context_button(_('Back'), back_url, 'back')
html.end_context_buttons()
@@ -906,7 +909,7 @@ def page_edit_dashlet():
visuals.save('dashboards', dashboards)
- html.immediate_browser_redirect(1, back_url)
+ html.immediate_browser_redirect(1, next_url)
if mode == 'edit':
html.message(_('The dashlet has been saved.'))
else:
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index a646a88..f23839b 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -241,7 +241,7 @@ def page_create_view(next_url = None):
if not next_url:
next_url = html.makeuri([('datasource', ds)], filename =
"create_view_infos.py")
else:
- next_url = next_url % ds
+ next_url = next_url + '&datasource=%s' % ds
html.http_redirect(next_url)
return
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 130b305..c4b22b9 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -390,8 +390,10 @@ def page_create_visual(what, title, info_keys, next_url = None):
vs_infos.validate_value(single_infos, 'single_infos')
if not next_url:
- next_url =
'edit_'+what_s+'.py?mode=create&single_infos=%s'
- html.http_redirect(next_url % ','.join(single_infos))
+ next_url =
'edit_'+what_s+'.py?mode=create&single_infos=%s' %
','.join(single_infos)
+ else:
+ next_url += '&single_infos=%s' %
','.join(single_infos)
+ html.http_redirect(next_url)
return
except MKUserError, e: