Module: check_mk
Branch: master
Commit: f89337c03d95c287ce6251247c6fabd0a9235b1c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f89337c03d95c2…
Author: Roland Halbig <rh(a)mathias-kettner.de>
Date: Tue Jan 10 14:48:30 2017 +0100
Refactoring htmllib: changed mechanics of javascript_file.
Change-Id: I436b7763169f114d343ea6bc271c8dfcdae39901
---
web/htdocs/html_mod_python.py | 2 +-
web/htdocs/htmllib.py | 6 +++---
web/htdocs/valuespec.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/html_mod_python.py b/web/htdocs/html_mod_python.py
index abd5ab8..49eff00 100644
--- a/web/htdocs/html_mod_python.py
+++ b/web/htdocs/html_mod_python.py
@@ -329,7 +329,7 @@ class html_mod_python(htmllib.html):
for min_part in min_parts:
path_pattern = cmk.paths.omd_root + "%s" + rel_path + "/"
+ jsname + min_part + ".js"
if os.path.exists(path_pattern % "") or os.path.exists(path_pattern
% "/local"):
- filename_for_browser = '%s%s-%s' % (jsname, min_part,
cmk.__version__)
+ filename_for_browser = 'js/%s%s-%s.js' % (jsname, min_part,
cmk.__version__)
break
return filename_for_browser
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index cf7f980..61713e7 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -640,9 +640,9 @@ class HTMLGenerator(Escaper, OutputFunnel):
return self.write(self.render_javascript(code))
- def javascript_file(self, filename):
- """ <script type="text/javascript"
src="js/%(name)s.js"/>\n """
- return self.write(self._render_content_tag('script', '',
type_="text/javascript", src='js/%s.js' % filename))
+ def javascript_file(self, src):
+ """ <script type="text/javascript"
src="%(name)"/>\n """
+ return self.write(self._render_content_tag('script', '',
type_="text/javascript", src=src))
def render_img(self, src, **attrs):
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index e9410bf..f6d5ee8 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -4086,7 +4086,7 @@ class Color(ValueSpec):
if not value:
value = "#FFFFFF"
- html.javascript_file("colorpicker")
+ html.javascript_file("js/colorpicker.js")
# Holds the actual value for form submission
html.hidden_field(varprefix + "_value", value or '', varprefix
+ "_value", add_var = True)