Module: check_mk
Branch: master
Commit: ad39b496426a145ee8e821f988706f533832a8f2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad39b496426a14…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 19 08:39:47 2014 +0100
#1777 FIX Fixed js error making the "add to visual" link break on pages with
context
When opening e.g. the detail page of a host or a view which has hardcoded filters
set, the "add to visual" link might not work because of a syntax error.
---
.werks/1777 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 12 ++++++++++--
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.werks/1777 b/.werks/1777
new file mode 100644
index 0000000..49c70fe
--- /dev/null
+++ b/.werks/1777
@@ -0,0 +1,11 @@
+Title: Fixed js error making the "add to visual" link break on pages with
context
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418974714
+
+When opening e.g. the detail page of a host or a view which has hardcoded filters
+set, the "add to visual" link might not work because of a syntax error.
diff --git a/ChangeLog b/ChangeLog
index 13a677e..a7b65db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@
* 1766 FIX: Fixed exceptions in Web GUI when host or service groups used non ascii
characters in names...
* 1773 FIX: Fixed different exceptions when using localized multisite
* 1774 FIX: IE: Always use the latest available rendering enginge of the used
browser...
+ * 1777 FIX: Fixed js error making the "add to visual" link break on pages
with context...
WATO:
* 1760 Added search form to manual checks page
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 9396b47..e2a5bd8 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -900,11 +900,19 @@ class html:
if self.myfile == "view":
mode_name = self.var('mode') == "availability" and
"availability" or "view"
- encoded_vars = self.attrencode([ (k, v != None and v or '') for k,v
in self.page_context.items() ])
+
+ encoded_vars = []
+ for k, v in self.page_context.items():
+ if v == None:
+ v = ''
+ elif type(v) == unicode:
+ v = v.encode('utf-8')
+ encoded_vars.append((k, v))
+
h += '<div class="visualadd"><a
class="visualadd" href="javascript:void(0)" ' \
'onclick="toggle_add_to_visual(event, this, \'%s\', %s,
{\'name\': \'%s\'})">' \
'<img class=statusicon
src="images/status_add_dashlet.png"
title="%s"></a></div>\n' % \
- (mode_name, encoded_vars, self.var('view_name'), _("Add
this view to..."))
+ (mode_name, self.attrencode(repr(encoded_vars)),
self.var('view_name'), _("Add this view to..."))
for img, tooltip in self.status_icons.items():
if type(tooltip) == tuple: