Module: check_mk
Branch: master
Commit: 97232b6efb4ee901c03ff7269d2ccf9b857da89f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=97232b6efb4ee9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Apr 27 17:29:01 2012 +0200
ValueSpec ListOf: repair horizontal mode
---
web/htdocs/check_mk.css | 7 +++++--
web/htdocs/js/checkmk.js | 22 +++++++++++++++++-----
web/htdocs/valuespec.py | 3 ++-
web/htdocs/wato.py | 2 +-
4 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index a86abc5..4eed256 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -312,8 +312,7 @@ div.warning {
| \ \ / / _` | | | | |/ _ \___ \| '_ \ / _ \/ __| |
| \ V / (_| | | |_| | __/___) | |_) | __/ (__ |
| \_/ \__,_|_|\__,_|\___|____/| .__/ \___|\___| |
-| |_| |
-+--------------------------------------------------------------------------+
+| |_| |
+--------------------------------------------------------------------------+
| Styles needed for HTML code produced by valuespec.py. |
'-------------------------------------------------------------------------*/
@@ -391,6 +390,10 @@ table.valuespec_listof option[selected] {
font-weight: bold;
}
+table.listofstrings.horizontal td {
+ padding-right: 5px;
+}
+
table.listchoice {
cell-spacing: 0px;
}
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index f5e816b..1990135 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -1429,12 +1429,24 @@ function list_of_strings_extend(oInput, j) {
splitted[splitted.length-1] = "" + num;
var newName = splitted.join("_");
- var oTr = oInput.parentNode.parentNode;
+ var oTd = oInput.parentNode;
+ var oTr = oTd.parentNode;
var oTBody = oTr.parentNode;
- var oNewTr = document.createElement("TR");
- oNewTr.innerHTML = oTr.innerHTML.replace('"' + oldName +
'"', '"' + newName + '"');
- oTBody.appendChild(oNewTr);
- var oNewTd = oNewTr.childNodes[0];
+ var oNewTd;
+
+ var horiz = oTBody.parentNode.classList.contains("horizontal");
+
+ if (!horiz) {
+ var oNewTr = document.createElement("TR");
+ oNewTr.innerHTML = oTr.innerHTML.replace('"' + oldName +
'"', '"' + newName + '"');
+ oTBody.appendChild(oNewTr);
+ oNewTd = oNewTr.childNodes[0];
+ }
+ else {
+ var oNewTd = document.createElement("TD");
+ oNewTd.innerHTML = oTd.innerHTML.replace('"' + oldName +
'"', '"' + newName + '"');
+ oTr.appendChild(oNewTd);
+ }
for (var j in oNewTd.childNodes) {
var o = oNewTd.childNodes[j];
if (o.tagName == "INPUT") {
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 8607b14..682ce62 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -499,7 +499,8 @@ class ListOfStrings(ValueSpec):
while html.has_var(vp + "_%d" % nr):
html.del_var(vp + "_%d" % nr)
nr += 1
- html.write('<table border=0 cellspacing=0 cellpadding=0
id="%s">' % vp)
+ html.write('<table class="listofstrings %s" border=0
cellspacing=0 cellpadding=0 id="%s">' % (
+ self._vertical and "vertical" or "horizontal", vp))
if not self._vertical:
html.write('<tr>')
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2f99a4b..95d3b54 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1881,7 +1881,7 @@ def mode_edithost(phase, new, cluster):
# Cluster: nodes
if cluster:
- vs = ListOfStrings(valuespec = TextAscii(size = 19))
+ vs = ListOfStrings(valuespec = TextAscii(size = 19),
orientation="horizontal")
html.write('<tr><td class=legend>' + _("Nodes")
+
'<br><i>%s</i></td>' %
_('Enter the host names of the cluster nodes. These '
'hosts must be present in WATO. '))