Module: check_mk
Branch: master
Commit: b7cb288e7841828bb9fcb00acf093d1c8b1ca39c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b7cb288e784182…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue May 24 10:07:47 2011 +0200
WATO: snapin is foldable, right margin honored
---
ChangeLog | 1 +
web/htdocs/check_mk.css | 11 ++++++++++-
web/htdocs/htmllib.py | 7 +++++--
web/htdocs/wato.py | 18 ++++++++++++------
web/plugins/sidebar/wato.py | 2 +-
5 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fb6366f..24beb99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
WATO:
* Configration files can now be administered via the WEB UI
(config_files in multisite.mk is obsolete)
+ * Snapin is tree-based and foldable
* Bulk operation on host lists (inventory, tags changed, etc)
MK Livestatus:
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 029ea0d..912eeaf 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -56,6 +56,15 @@ b.treeangle.title {
font-weight: bold;
color: #ffffff;
}
+ul.treeangle {
+ /* border: 1px solid #4060ff; */
+ padding-left: 20px;
+}
+ul.treeangle li {
+ margin: 0px;
+ margin-left: 16px;
+ padding-left: 20px;
+}
/*
__ __ _
@@ -352,7 +361,7 @@ div.snapin ul {
margin: 0;
padding: 0;
padding-left: 16px;
- width: 220px;
+ /* width: 220px; Bei mehrstufigen Einrueckungen stimmt der rechte Rand nicht */
}
li.sidebar {
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 8b29899..07febe4 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -671,8 +671,11 @@ class html:
self.write('<img align=absbottom class="treeangle"
id="treeimg.%s.%s" '
'src="images/tree_%s.png" %s>' %
(treename, id, img_num, onclick))
- self.write('<b class="treeangle title" class=treeangle
%s>%s</b><br>' %
- (onclick, title))
+ if title[0] == '<': # custom HTML code
+ self.write(title)
+ else:
+ self.write('<b class="treeangle title" class=treeangle
%s>%s</b><br>' %
+ (onclick, title))
self.write('<ul class="treeangle" style="display: %s"
id="tree.%s.%s">' %
((not isopen) and "none" or "", treename, id))
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 5f5f259..ba6de35 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -967,20 +967,26 @@ def render_link_tree(h, format):
load_folder_config()
def render_folder(f):
+
+ subfolders = f["folders"]
path = f["path"]
+ filename = "/" + "/".join(path) + "/"
if len(path) > 0:
- filename = "/" + "/".join(path) + "/"
url = "wato.py?filename=" + htmllib.urlencode(filename)
- html.write(format % (url, f["title"]))
+ if len(subfolders) == 0:
+ title = format % (url, f["title"])
+ else:
+ title = '<a target=main href="%s">%s</a>' %
(url, f["title"])
else:
- html.write('<a target=main
href="wato.py">%s</a>' % f["title"])
+ title = '<a target=main href="wato.py">%s</a>'
% f["title"]
- subfolders = f["folders"]
if len(subfolders) > 0:
- html.write('<ul>')
+ html.begin_foldable_container('wato', filename, False, title)
for sf in sort_by_title(subfolders.values()):
render_folder(sf)
- html.write('</ul>')
+ html.end_foldable_container()
+ else:
+ html.write(title)
render_folder(g_root_folder)
diff --git a/web/plugins/sidebar/wato.py b/web/plugins/sidebar/wato.py
index fdee6f1..1766f7b 100644
--- a/web/plugins/sidebar/wato.py
+++ b/web/plugins/sidebar/wato.py
@@ -48,7 +48,7 @@ def ajax_wato_files(h):
global html
html = h
if config.may("use_wato"):
- format = ("<li class=sidebar>%s</li>" %
link("XX", "XX")).replace("XX", "%s")
+ format = ("<li>%s</li>" % link("XX",
"XX")).replace("XX", "%s")
wato.render_link_tree(html, format)