Module: check_mk
Branch: master
Commit: ee35d76804135ec5fb826219c411dec15478ac47
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ee35d76804135e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 1 16:48:03 2011 +0200
Multisite: load all CSS style sheets in htdocs/css
---
web/htdocs/css/README | 2 ++
web/htdocs/htmllib.py | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/web/htdocs/css/README b/web/htdocs/css/README
new file mode 100644
index 0000000..4d0aec6
--- /dev/null
+++ b/web/htdocs/css/README
@@ -0,0 +1,2 @@
+Put your custom *.css file here. They will all be loaded
+automatically.
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index b09bab5..ea4b466 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -158,6 +158,21 @@ class html:
self.output_format = "html"
self.status_icons = {}
+ def plugin_stylesheets(self):
+ global plugin_stylesheets
+ try:
+ return plugin_stylesheets
+ except:
+ plugins_paths = [ defaults.web_dir + "/htdocs/css" ]
+ if defaults.omd_root:
+ plugins_paths.append(defaults.omd_root +
"/local/share/check_mk/web/htdocs/css")
+ plugin_stylesheets = set([])
+ for dir in plugins_paths:
+ for fn in os.listdir(dir):
+ if fn.endswith(".css"):
+ plugin_stylesheets.add(fn)
+ return plugin_stylesheets
+
def set_output_format(self, f):
self.output_format = f
@@ -455,8 +470,14 @@ class html:
self.write(title)
self.write('''</title>
<link rel="stylesheet" type="text/css"
href="check_mk.css">''')
+
+ # Load all style sheets in htdocs/css
+ for css in self.plugin_stylesheets():
+ self.write(' <link rel="stylesheet"
type="text/css" href="css/%s">' % css)
+
if config.custom_style_sheet:
self.write(' <link rel="stylesheet"
type="text/css" href="%s">' % config.custom_style_sheet)
+
self.write('''
<script type='text/javascript'
src='js/check_mk.js'></script>
<script type='text/javascript'
src='js/hover.js'></script>