Module: check_mk
Branch: master
Commit: 318fcfedda0ed18a430b8fc0c7e8369e79495842
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=318fcfedda0ed1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 23 14:57:12 2018 +0200
6357 FIX Facelift theme: Icon buttons were not using themed buttons
The facelift theme was using the classic icons for icon buttons instead of
the icons it should use.
Change-Id: Ie090f53269243d355c34d04bd5ede17aa80198fe
---
.werks/6357 | 12 ++++++++++++
cmk/gui/htmllib.py | 21 ++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/.werks/6357 b/.werks/6357
new file mode 100644
index 0000000..de27a48
--- /dev/null
+++ b/.werks/6357
@@ -0,0 +1,12 @@
+Title: Facelift theme: Icon buttons were not using themed buttons
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1532169118
+
+The facelift theme was using the classic icons for icon buttons instead of
+the icons it should use.
diff --git a/cmk/gui/htmllib.py b/cmk/gui/htmllib.py
index 3d787f9..6365ae0 100644
--- a/cmk/gui/htmllib.py
+++ b/cmk/gui/htmllib.py
@@ -2812,6 +2812,25 @@ hy
return "images/icons/%s.png" % icon_name
+ def _detect_themed_image_path(self, img_path):
+ """Detect whether or not the original file or a themed image
should be loaded by the client
+
+ Priority:
+ 1. In case a theme is active: themes/[img_path] in site local hierarchy
+ 2. In case a theme is active: themes/[img_path] in standard hierarchy
+ 3. [img_path] in site local hierarchy
+ 4. [img_path] in standard hierarchy
+ """
+
+ if self._theme and self._theme != "classic":
+ rel_path = "share/check_mk/web/htdocs/themes/%s/%s" % (self._theme,
img_path)
+ if os.path.exists(cmk.paths.omd_root+"/"+rel_path) or
os.path.exists(cmk.paths.omd_root+"/local/"+rel_path):
+ return "themes/%s/%s" % (self._theme, img_path)
+
+ return img_path
+
+
+
def render_icon_button(self, url, help, icon, id=None, onclick=None,
style=None, target=None, cssclass=None,
ty="button"):
@@ -2821,7 +2840,7 @@ hy
# TODO: Can we clean this up and move all button_*.png to internal_icons/*.png?
if ty == "button":
- icon = "images/button_" + icon + ".png"
+ icon = self._detect_themed_image_path("images/button_" + icon +
".png")
icon = HTML(self.render_icon(icon, cssclass="iconbutton"))