Module: check_mk
Branch: master
Commit: 16da594edf2cb8d3d426ec14ef0a3427d55d4d64
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=16da594edf2cb8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 20 11:37:02 2014 +0100
Fixed dashlet deletion after latest confirm dialog change
---
web/htdocs/dashboard.py | 2 +-
web/htdocs/htmllib.py | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 77cd07c..b8834b4 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -977,7 +977,7 @@ def page_delete_dashlet():
html.context_button(_('Back'), back_url, 'back')
html.end_context_buttons()
- result = html.confirm(_('Do you really want to delete this dashlet?'), method
= 'GET')
+ result = html.confirm(_('Do you really want to delete this dashlet?'),
method='GET', add_transid=True)
if result == False:
html.footer()
return # confirm dialog shown
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index d2f20ad..c43be21 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -1128,7 +1128,12 @@ class html:
else:
return False
- def confirm(self, msg, method="POST", action=None):
+ # The confirm dialog is normally not a dialog which need to be protected
+ # by a transid itselfs. It is only a intermediate step to the real action
+ # But there are use cases where the confirm dialog is used during rendering
+ # a normal page, for example when deleting a dashlet from a dashboard. In
+ # such cases, the transid must be added by the confirm dialog.
+ def confirm(self, msg, method="POST", action=None, add_transid=False):
if self.var("_do_actions") == _("No"):
# User has pressed "No", now invalidate the unused transid
self.check_transaction()
@@ -1137,9 +1142,7 @@ class html:
if self.mobile:
self.write('<center>')
self.write("<div class=really>%s" % msg)
- # The confirm dialog is never a dialog which need to be protected
- # by a transid itselfs. It is only a intermediate step to the real action
- self.begin_form("confirm", method=method, action=action,
add_transid=False)
+ self.begin_form("confirm", method=method, action=action,
add_transid=add_transid)
self.hidden_fields(add_action_vars = True)
self.button("_do_confirm", _("Yes!"),
"really")
self.button("_do_actions", _("No"), "")