Module: check_mk
Branch: master
Commit: 64e03b4a555093310fb5f831a0cde03ad38f38e7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=64e03b4a555093…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 17 18:16:01 2012 +0200
Redesign of view filter forms
---
web/htdocs/htmllib.py | 7 +++--
web/htdocs/views.css | 54 ++++++++++++++++++++++++++++++++++++++++-
web/htdocs/views.py | 36 +++++++++++++++++-----------
web/plugins/views/filters.py | 28 ++++++++++++++-------
4 files changed, 97 insertions(+), 28 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index df141c6..4163ec0 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -436,8 +436,8 @@ class html:
self.write(r'''onmouseover='this.style.backgroundImage="url(\"images/contextlink%s_hi.png\")";'
''' % what)
self.write(r'''onmouseout='this.style.backgroundImage="url(\"images/contextlink%s.png\")";'
''' % what)
- def number_input(self, varname, deflt = "", size=8):
- self.text_input(varname, str(deflt), "number", size=size)
+ def number_input(self, varname, deflt = "", size=8, style=""):
+ self.text_input(varname, str(deflt), "number", size=size, style=style)
def text_input(self, varname, default_value = "", cssclass =
"text", label = None, id = None, **args):
if default_value == None:
@@ -451,7 +451,8 @@ class html:
mytype = "text"
if "autocomplete" in args:
addprops += " autocomplete=\"%s\"" %
args["autocomplete"]
-
+ if args.get("style"):
+ addprops += " style=\"%s\"" % args["style"]
value = self.req.vars.get(varname, default_value)
error = self.user_errors.get(varname)
diff --git a/web/htdocs/views.css b/web/htdocs/views.css
index 92c0af5..e29eb1a 100644
--- a/web/htdocs/views.css
+++ b/web/htdocs/views.css
@@ -124,13 +124,63 @@ table.navi tr.form td.whiteborder {
border-bottom: 1px solid #fff;
}
-table.navi tr.form div.whiteborder, table.navi tr.form table.whiteborder {
+table.navi tr.form div.whiteborder,
+table.navi tr.form table.whiteborder {
border-left: 1px solid #fff;
border-right: 1px solid #fff;
margin: 0;
padding: 0;
border-bottom: 1px solid #fff;
- width: 100%;
+ /* width: 100%; */
+}
+
+table.navi tr.form div.whiteborder {
+ padding: 5px;
+}
+
+div.whiteborder table.form {
+ margin: 0px;
+ background-image: none;
+}
+
+table.navi tr.form {
+ /* background-image: url("images/form_background.png");
+ background-repeat: repeat; */
+}
+table.navi div.whiteborder table.form {
+ background-image: url("images/form_background.png");
+ background-repeat: repeat;
+}
+
+div.floatfilter {
+ margin: 0px 3px 3px 0px;
+ width: 320px;
+ height: 45px;
+ /* display: inline-block; */
+ float: left;
+ border: 1px solid #458;
+ box-shadow: 0.5px 0.5px 1px #444;
+ background-image: url("images/form_background.png");
+ background-repeat: repeat;
+}
+
+div.floatfilter input[type=text] {
+ width: 307px;
+}
+
+div.floatfilter .legend {
+ color: white;
+ margin-bottom: 2px;
+ width: 310px;
+ height: 15px;
+ background-image: url("images/form_background.png");
+ background-repeat: repeat;
+ padding: 1px 5px;
+}
+
+div.floatfilter .content {
+ margin-top: 3px;
+ margin-left: 3px;
}
/*-------------------------------------------------------------------------.
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index c897f36..d4f48af 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -100,8 +100,9 @@ def show_filter_form(is_open, filters):
html.write("<td>")
html.begin_form("filter")
html.write("<div class=whiteborder>\n")
+ html.write("<table><tr><td>")
- html.write("<table class=\"form\">\n")
+ ### HIRN html.write("<table class=\"form\">\n")
# sort filters according to title
s = [(f.sort_index, f.title, f) for f in filters if f.available()]
@@ -113,21 +114,28 @@ def show_filter_form(is_open, filters):
f.display()
html.write('</div>')
else:
- if col == 0:
- html.write("<tr>")
- html.write("<td class=legend>%s</td>" % title)
- html.write("<td class=content>")
+ html.write('<div class=floatfilter>')
+ ### if col == 0:
+ ### html.write("<tr>")
+ html.write('<div class=legend>%s</div>' % title)
+ ### html.write("<td class=legend>%s</td>" % title)
+ ### html.write("<td class=content>")
+ html.write('<div class=content>')
f.display()
- html.write("</td>")
- if col == config.filter_columns - 1:
- html.write("</tr>\n")
- col = (col + 1) % config.filter_columns
- if col == 1:
- html.write("<td class=legend></td>\n<td
class=content></td></tr>\n")
- html.write('<tr><td class="legend button" colspan=%d>'
% (config.filter_columns * 2))
+ ### html.write("</td>")
+ html.write("</div>")
+ ### if col == config.filter_columns - 1:
+ ### html.write("</tr>\n")
+ ### col = (col + 1) % config.filter_columns
+ html.write("</div>")
+ ### if col == 1:
+ ### html.write("<td class=legend></td>\n<td
class=content></td></tr>\n")
+ ### html.write('<tr><td class="legend button"
colspan=%d>' % (config.filter_columns * 2))
+ html.write("</td></tr><tr><td>")
html.button("search", _("Search"), "submit")
- html.write("</td></tr>\n")
- html.write("</table>\n")
+ html.write("</td></tr></table>")
+ ### html.write("</td></tr>\n")
+ ### html.write("</table>\n")
html.hidden_fields()
html.end_form()
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index b0318c8..9ecf71b 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -191,7 +191,7 @@ class FilterServiceState(Filter):
html.begin_checkbox_group()
for var, text in [(self.prefix + "st0", "OK"), (self.prefix +
"st1", "WARN"), \
(self.prefix + "st2", "CRIT"), (self.prefix
+ "st3", "UNKNOWN"),
- (self.prefix + "stp", "PENDING")]:
+ (self.prefix + "stp", "PEND.")]:
#if html.mobile:
#text = text[:1]
html.checkbox(var, True, label=text)
@@ -367,21 +367,31 @@ class FilterTime(Filter):
def __init__(self, info, name, title, column):
self.column = column
self.name = name
- self.ranges = [ (1, _("sec")), (60, _("min")), (3600,
_("hours")), (86400, _("days")) ]
+ self.ranges = [
+ (86400, _("days")),
+ (3600, _("hours")),
+ (60, _("min")),
+ (1, _("sec")),
+ ]
Filter.__init__(self, name, title, info, [ name ] + [ name + "_" + n
for (s, n) in self.ranges], [column])
def display(self):
+ html.select(self.name,
[("since",_("since")),("before", _("before"))],
"since")
+ html.write(" ")
for s, n in self.ranges:
htmlvar = self.name + "_" + n
html.write("<nobr>")
- html.number_input(htmlvar, 0, 2)
+ html.number_input(htmlvar, 0, 2, style="width: 22px; text-align:
right;")
html.write(" %s</nobr> " % n)
- if config.filter_columns > 1:
- html.write("<br>\n")
- current = html.var(self.name, "since")
- for t in [ "before", "since" ]:
- html.radiobutton(self.name, t, current == t, t + " ")
- html.write(" ")
+ # if config.filter_columns > 1:
+ # html.write("<br>\n")
+
+ # current = html.var(self.name, "since")
+ # for t, title in [
+ # ("before", _("before")),
+ # ("since", _("since")) ]:
+ # html.radiobutton(self.name, t, current == t, title + "
")
+ # html.write(" ")
def filter(self, infoname):
range = self.get_time_range()