Module: check_mk
Branch: master
Commit: 7ab33bb837f99236ce5beadd6aada11df49706a5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7ab33bb837f992…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jan 21 16:37:04 2013 +0100
Fix two bugs in value specs ListOf and Foldable
---
ChangeLog | 2 ++
web/htdocs/pages.css | 5 ++++-
web/htdocs/valuespec.py | 21 ++++++++++++++-------
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 378b33e..4ec22b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
WATO:
* Added hr_mem check to the memory checkgroup to make it configurable in WATO
+ * FIX: list valuespecs could not be extended after once saving
+ * FIX: fix title of foldable areas contained in list valuespecs
1.2.1i5:
Core:
diff --git a/web/htdocs/pages.css b/web/htdocs/pages.css
index 1444c71..2bf6d35 100644
--- a/web/htdocs/pages.css
+++ b/web/htdocs/pages.css
@@ -623,10 +623,13 @@ table.nform tr.heading > td:hover {
background-image: url("images/white_20percent.png");
}
+table.nform > tbody > tr td {
+ color: black;
+}
+
table.nform > tbody > tr > td {
vertical-align: middle;
height: 27px;
- color: black;
}
table.nform > tbody > tr > td.simple {
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 0b985db..37ec526 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -656,11 +656,12 @@ class ListOf(ValueSpec):
value = [None] * count # dummy for the loop
else:
filled_in = False
- html.hidden_field('%s_count' % varprefix,
- str(len(value)),
- id = '%s_count' % varprefix,
- add_var = True
- )
+ count = len(value)
+
+ html.hidden_field('%s_count' % varprefix,
+ str(count),
+ id = '%s_count' % varprefix,
+ add_var = True)
# Actual table of currently existing entries
html.write('<table class="valuespec_listof"
id="%s_table">' % varprefix)
@@ -2058,13 +2059,19 @@ class Foldable(ValueSpec):
def render_input(self, varprefix, value):
try:
- title = self._title_function(value)
+ title_value = value
+ if html.form_submitted():
+ try:
+ title_value = self._valuespec.from_html_vars(varprefix)
+ except:
+ pass
+ title = self._title_function(title_value)
except:
title = self._valuespec.title()
if not title:
title = _("(no title)")
html.begin_foldable_container("valuespec_foldable", varprefix,
self._open,
- title, False)
+ title, False)
html.help(self._valuespec.help())
self._valuespec.render_input(varprefix, value)
html.end_foldable_container()