Module: check_mk
Branch: master
Commit: 3e7222e32cf5160bbb7007bd1535551164f71804
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e7222e32cf516…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Dec 23 15:06:37 2011 +0100
WATO: bugfix visibility of host tags dropdown menu after POST form
---
web/htdocs/htmllib.py | 2 +-
web/htdocs/wato.py | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 1572a03..faa9d8f 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -445,7 +445,7 @@ class html:
(onchange_code, varname, varname, attributes))
for value, text in options:
if value == None: value = ""
- sel = value.split('|')[0] == current and " selected" or
""
+ sel = value == current and " selected" or ""
self.write("<option
value=\"%s\"%s>%s</option>\n" % (value, sel, text))
self.write("</select>\n")
if varname:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a39e220..a4d73bf 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3529,8 +3529,10 @@ class HostTagAttribute(Attribute):
# But case could occur if tags definitions have been changed.
def render_input(self, value):
+ varname = "attr_" + self.name()
if value == None:
- value = "" # Important for tag groups with an empty tag entry
+ value = html.var(varname,"") # "" is important for tag
groups with an empty tag entry
+
# Tag groups with just one entry are being displayed
# as checkboxes
choices = []
@@ -3543,9 +3545,11 @@ class HostTagAttribute(Attribute):
else:
secondary_tags = []
choices.append(("|".join([ tagvalue ] + secondary_tags), e[1]))
- varname = "attr_" + self.name()
+ if value != "" and value == tagvalue:
+ value = value + "|" + "|".join(secondary_tags)
+
if len(choices) == 1:
- html.checkbox(varname, value != None, cssclass = '',
onclick='wato_fix_visibility();', add_attr = ["tags=%s"%choices[0][0]])
+ html.checkbox(varname, value != "", cssclass = '',
onclick='wato_fix_visibility();', add_attr = ["tags=%s"%choices[0][0]])
html.write(" " + choices[0][1])
else:
html.select(varname, choices, value,
onchange='wato_fix_visibility();')