Module: check_mk
Branch: master
Commit: ecd33d690808900f87df90a6720b3665c49c7659
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ecd33d69080890…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Aug 1 13:50:22 2013 +0200
Make size of text input for command line wider
---
web/htdocs/check_mk.css | 1 +
web/htdocs/htmllib.py | 17 +++++++++++------
web/htdocs/valuespec.py | 13 +++++--------
web/plugins/wato/active_checks.py | 2 +-
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 0f378ed..a71ace0 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -361,6 +361,7 @@ div.warning a {
'-------------------------------------------------------------------------*/
table.dictionary {
+ width: 100%;
}
table.dictionary b.header {
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 8f7e6d9..f85a6b0 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -390,15 +390,19 @@ class html:
def add_form_var(self, varname):
self.form_vars.append(varname)
- def text_input(self, varname, default_value = "", cssclass =
"text", label = None, id = None, submit = None, **args):
+ def text_input(self, varname, default_value = "", cssclass =
"text", label = None, id = None,
+ submit = None, attrs = {}, **args):
if default_value == None:
default_value = ""
addprops = ""
add_style = ""
if "size" in args and args["size"]:
- addprops += " size=%d" % (args["size"] + 1)
- if "width:" not in args.get("style", "") and
not self.mobile:
- add_style = "width: %d.8ex; " % args["size"]
+ if args["size"] == "max":
+ add_style = "width: 100%; "
+ else:
+ addprops += " size=%d" % (args["size"] + 1)
+ if "width:" not in args.get("style", "")
and not self.mobile:
+ add_style = "width: %d.8ex; " % args["size"]
if "type" in args:
mytype = args["type"]
@@ -433,8 +437,9 @@ class html:
if id:
addprops += " id='%s'" % id
- html += "<input type=%s class=%s value=\"%s\"
name=\"%s\"%s>" % \
- (mytype, cssclass, self.attrencode(value), varname, addprops)
+ attributes = ' ' + ' '.join([ '%s="%s"' % (k,
v) for k, v in attrs.iteritems() ])
+ html += "<input type=%s class=%s value=\"%s\"
name=\"%s\"%s%s>" % \
+ (mytype, cssclass, self.attrencode(value), varname, addprops,
attributes)
if error:
html += "</x>"
self.set_focus(varname)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 082419f..15b93aa 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -308,7 +308,7 @@ class TextAscii(ValueSpec):
def __init__(self, **kwargs):
ValueSpec.__init__(self, **kwargs)
self._label = kwargs.get("label")
- self._size = kwargs.get("size", 25)
+ self._size = kwargs.get("size", 25) # also possible:
"max"
self._strip = kwargs.get("strip", True)
self._allow_empty = kwargs.get("allow_empty", True)
self._read_only = kwargs.get("read_only")
@@ -331,8 +331,8 @@ class TextAscii(ValueSpec):
if self._label:
html.write(self._label)
html.write(" ")
- html.text_input(varprefix, str(value), size = self._size,
- read_only = self._read_only)
+
+ html.text_input(varprefix, str(value), size = self._size, read_only =
self._read_only)
self.render_buttons()
def render_buttons(self):
@@ -386,10 +386,6 @@ class TextUnicode(TextAscii):
def __init__(self, **kwargs):
TextAscii.__init__(self, **kwargs)
- def render_input(self, varprefix, value):
- html.text_input(varprefix, value, size = self._size)
- self.render_buttons()
-
def from_html_vars(self, varprefix):
return html.var_utf8(varprefix, "").strip()
@@ -563,7 +559,8 @@ class TextAreaUnicode(TextUnicode):
if value == None:
value = "" # should never happen, but avoids exception for invalid
input
if self._rows == "auto":
- attrs = { "onkeyup" : 'valuespec_textarea_resize(this);' }
+ func = 'valuespec_textarea_resize(this);'
+ attrs = { "onkeyup" : func, "onmousedown" : func,
"onmouseup" : func, "onmouseout" : func }
if html.has_var(varprefix):
rows = len(html.var(varprefix).splitlines())
else:
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index d21fe40..bc129e8 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -846,7 +846,7 @@ register_rule(group,
"directory (<tt>~/lib/nagios/plugins</tt>)
within your site directory.<br><br>"
"<b>Passive checks</b>: Do no specify a
command line if you want "
"to define passive checks."),
- size = 80,
+ size = "max",
)
),
( "command_name",