hierarchy of sites which do not exist in original directory
Message-ID: <559a842e.wzIE8PXgyxPg/m7v%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 371f0e15c3ff28b0a3be3adf974ad3a910d28422
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=371f0e15c3ff28…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 6 15:35:28 2015 +0200
Fixed detecting icons in local/ hierarchy of sites which do not exist in original
directory
---
web/htdocs/htmllib.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 1d0b83f..484a9ad 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -365,13 +365,18 @@ class html:
def detect_icon_path(self, icon_name):
# Detect whether or not the icon is available as images/icon_*.png
# or images/icons/*.png. When an icon is available as internal icon,
- # always use this onec
+ # always use this one
+ is_internal = False
if defaults.omd_root:
- base_path = defaults.omd_root+"/share/check_mk/web/htdocs/images"
- else:
- base_path = defaults.web_dir+"/htdocs/images"
-
- if os.path.exists(base_path+'/icon_'+icon_name+'.png'):
+ rel_path =
"share/check_mk/web/htdocs/images/icon_"+icon_name+".png"
+ if os.path.exists(defaults.omd_root+"/"+rel_path):
+ is_internal = True
+ elif os.path.exists(defaults.omd_root+"/local/"+rel_path):
+ is_internal = True
+ elif
os.path.exists(defaults.web_dir+"/htdocs/images/icon_"+icon_name+".png"):
+ is_internal = True
+
+ if is_internal:
return "images/icon_%s.png" % icon_name
else:
return "images/icons/%s.png" % icon_name