like Commands)
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: ad8e87a8d5226f9bd374b32102053f296609dd49
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad8e87a8d5226f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Jun 3 19:16:55 2012 +0200
Better implementation of narrow forms (like Commands)
---
web/htdocs/forms.py | 4 ++--
web/htdocs/pages.css | 9 +++++++++
web/htdocs/valuespec.py | 3 ++-
web/htdocs/views.css | 9 ---------
web/htdocs/views.py | 2 +-
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/web/htdocs/forms.py b/web/htdocs/forms.py
index 60fcec9..99f3efa 100644
--- a/web/htdocs/forms.py
+++ b/web/htdocs/forms.py
@@ -112,7 +112,7 @@ def strip_bad_chars(x):
else:
return s.translate(None, "'&;<>\"")
-def header(title, isopen = True, table_id = ""):
+def header(title, isopen = True, table_id = "", narrow = False):
global g_header_open
global g_section_open
global g_section_isopen
@@ -126,7 +126,7 @@ def header(title, isopen = True, table_id = ""):
table_id = ' id="%s"' % table_id
else:
table_id = ''
- html.write('<table %s class=nform>' % table_id)
+ html.write('<table %s class="nform%s">' % (table_id, narrow
and " narrow" or ""))
fold_id = strip_bad_chars(title)
g_section_isopen = html.begin_foldable_container(
html.form_name and html.form_name or "nform", fold_id, isopen,
title, indent="nform")
diff --git a/web/htdocs/pages.css b/web/htdocs/pages.css
index ce03d08..5bc4414 100644
--- a/web/htdocs/pages.css
+++ b/web/htdocs/pages.css
@@ -626,6 +626,15 @@ table.nform td.legend.simple {
padding-top: 5px;
}
+table.nform.narrow td.legend {
+ height: 18px;
+}
+
+table.nform.narrow td.content {
+ height: 18px;
+ padding-bottom: 2px;
+}
+
table.nform td.legend div.title {
float: left;
overflow: hidden;
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 76c3906..599995b 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1666,6 +1666,7 @@ class Dictionary(ValueSpec):
self._columns = kwargs.get("columns", 1) # possible: 1 or 2
self._render = kwargs.get("render", "normal") # also:
"form" -> use forms.section()
+ self._form_narrow = kwargs.get("form_narrow", False) # used if render
== "form"
self._headers = kwargs.get("headers")
def render_input(self, varprefix, value):
@@ -1714,7 +1715,7 @@ class Dictionary(ValueSpec):
self.render_input_form_header(varprefix, value, self.title(), None)
def render_input_form_header(self, varprefix, value, title, sections):
- forms.header(title)
+ forms.header(title, narrow=self._form_narrow)
for param, vs in self._elements:
if sections and param not in sections:
continue
diff --git a/web/htdocs/views.css b/web/htdocs/views.css
index d28c7af..e6c4f57 100644
--- a/web/htdocs/views.css
+++ b/web/htdocs/views.css
@@ -222,15 +222,6 @@ div.view_form {
margin-bottom: 10px;
}
-#commands table.nform td.legend {
- height: 18px;
-}
-
-#commands table.nform td.content {
- height: 18px;
- padding-bottom: 2px;
-}
-
/*-------------------------------------------------------------------------.
| _ _ |
| | | __ _ _ _ ___ _ _| |_ ___ |
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7c2000b..8e35f9e 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1996,7 +1996,7 @@ def show_command_form(is_open, datasource):
html.hidden_field("actions", "yes")
html.hidden_fields() # set all current variables, exception action vars
# html.write('<table class="form">')
- forms.header(_("Commands"))
+ forms.header(_("Commands"), narrow=True)
# Commands are defined in plugins/views/commands.py. Iterate
# over all command definitions and render HTML input fields.