Module: check_mk
Branch: master
Commit: db396d2c84ce7986ad7085557696e13ba4a276f0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db396d2c84ce79…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Aug 31 14:53:30 2015 +0200
Fix overriding of js files via local/
---
web/htdocs/htmllib.py | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 533289a..664ae20 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -836,18 +836,24 @@ class html:
# b) in OMD environments, add the Check_MK version to the version (prevents
update problems)
# c) load the minified javascript when not in debug mode
for js in [ "checkmk", "graphs" ] + javascripts:
+ filename_for_browser = None
if defaults.omd_root:
- base_dir = defaults.omd_root +
"/share/check_mk/web/htdocs/js"
- if not self.enable_debug and os.path.exists(base_dir + "/"
+ js + "_min.js"):
- fname = '%s_min-%s' % (js, defaults.check_mk_version)
- elif os.path.exists(base_dir + "/" + js +
".js"):
- fname = '%s-%s' % (js, defaults.check_mk_version)
+ rel_path = "/share/check_mk/web/htdocs/js"
+ if self.enable_debug:
+ min_parts = [ "", "_min" ]
else:
- continue
+ min_parts = [ "_min", "" ]
+
+ for min_part in min_parts:
+ path_pattern = defaults.omd_root + "%s" + rel_path +
"/" + js + min_part + ".js"
+ if os.path.exists(path_pattern % "") or
os.path.exists(path_pattern % "/local"):
+ filename_for_browser = '%s%s-%s' % (js, min_part,
defaults.check_mk_version)
+ break
else:
- fname = '%s' % js
+ filename_for_browser = js
- self.javascript_file(fname)
+ if filename_for_browser:
+ self.javascript_file(filename_for_browser)
if self.browser_reload != 0:
if self.browser_redirect != '':