Module: check_mk
Branch: master
Commit: 63168fcc2d9d8ef100ce959571eb5ec705f53aa1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=63168fcc2d9d8e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 6 16:20:40 2019 +0100
7231 FIX Fixed possible broken folding of form parts when using localized GUI
Change-Id: I0d390a8142102f8e4fcc03b99eb08b4144c4caa4
---
.werks/7231 | 10 ++++++++++
cmk/gui/forms.py | 27 +++++++--------------------
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/.werks/7231 b/.werks/7231
new file mode 100644
index 0000000..e8885c9
--- /dev/null
+++ b/.werks/7231
@@ -0,0 +1,10 @@
+Title: Fixed possible broken folding of form parts when using localized GUI
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1551885586
+Class: fix
+
+
diff --git a/cmk/gui/forms.py b/cmk/gui/forms.py
index 1d830e9..0aaac26 100644
--- a/cmk/gui/forms.py
+++ b/cmk/gui/forms.py
@@ -24,6 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+import base64
import six
from cmk.gui.htmllib import HTML
@@ -235,24 +236,6 @@ def edit_valuespec(vs,
# New functions for painting forms
-twofivesix = "".join(map(chr, range(0, 256)))
-
-
-def strip_bad_chars(x):
- s = "".join([c for c in x if c > ' ' and c < 'z'])
-
- if isinstance(x, unicode):
- s = unicode(s)
- return s.translate({
- ord(u"'"): None,
- ord(u"&"): None,
- ord(u";"): None,
- ord(u"<"): None,
- ord(u">"): None,
- ord(u"\""): None,
- })
- return s.translate(twofivesix, "'&;<>\"")
-
def header(title, isopen=True, table_id="", narrow=False, css=None):
global g_header_open, g_section_open, g_section_isopen
@@ -262,9 +245,13 @@ def header(title, isopen=True, table_id="", narrow=False,
css=None):
html.open_table(
id_=table_id if table_id else None,
class_=["nform", "narrow" if narrow else None, css if css
else None])
- fold_id = strip_bad_chars(title)
+
g_section_isopen = html.begin_foldable_container(
- html.form_name and html.form_name or "nform", fold_id, isopen, title,
indent="nform")
+ treename=html.form_name if html.form_name else "nform",
+ id_=base64.b64encode(title.encode("utf-8") if isinstance(title,
unicode) else title),
+ isopen=isopen,
+ title=title,
+ indent="nform")
html.tr(html.render_td('', colspan=2), class_=["top",
"open" if g_section_isopen else "closed"])
g_header_open = True
g_section_open = False