Module: check_mk
Branch: master
Commit: aa9e7091b38c1f9be5cf26df7d1255555b82d692
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa9e7091b38c1f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 7 14:10:29 2014 +0200
ListOfMultiple: new option for setting width
---
web/htdocs/valuespec.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index b32705f..5edd1ad 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -904,9 +904,9 @@ class ListOf(ValueSpec):
class ListOfMultiple(ValueSpec):
def __init__(self, choices, **kwargs):
ValueSpec.__init__(self, **kwargs)
- self._choices = choices
+ self._choices = choices
self._choice_dict = dict(choices)
-
+ self._size = kwargs.get("size")
self._add_label = kwargs.get("add_label", _("Add element"))
def del_button(self, varprefix, ident):
@@ -946,7 +946,10 @@ class ListOfMultiple(ValueSpec):
html.write("<br>")
choosable = [('', '')] + [ (ident, vs.title()) for ident, vs in
self._choices if ident not in value ]
- html.select(varprefix + '_choice', choosable)
+ attrs = {}
+ if self._size != None:
+ attrs["style"] = "width: %dex" % self._size
+ html.select(varprefix + '_choice', choosable, attrs=attrs)
html.javascript('vs_listofmultiple_init(\'%s\');' % varprefix)
html.jsbutton(varprefix + '_add', self._add_label,
"vs_listofmultiple_add('%s')" % varprefix)