Module: check_mk
Branch: master
Commit: 17b52225c6cfb678c6cb988e8bc46f39d31abb02
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=17b52225c6cfb6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 11:24:39 2016 +0100
#2969 FIX Fixed folding of sidebar in Google Chrome
---
.werks/2969 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/js/sidebar.js | 29 ++++++++++++++++-------------
web/htdocs/sidebar.py | 6 +++---
4 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/.werks/2969 b/.werks/2969
new file mode 100644
index 0000000..b76203a
--- /dev/null
+++ b/.werks/2969
@@ -0,0 +1,9 @@
+Title: Fixed folding of sidebar in Google Chrome
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453890266
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index dfc730c..6cae073 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -269,6 +269,7 @@
* 2966 FIX: Quicksearch: Fixed sorting of results when not only searching for hosts
* 2967 FIX: Hosts/Services: Hiding action menu trigger for empty menus
* 2968 FIX: Closing quicksearch results when moving mouse out of sidebar area
+ * 2969 FIX: Fixed folding of sidebar in Google Chrome
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js
index e5330d5..4b199cd 100644
--- a/web/htdocs/js/sidebar.js
+++ b/web/htdocs/js/sidebar.js
@@ -403,13 +403,13 @@ function debug(s) {
// but without scrolling. The height of the header and footer divs need
// to be treated here.
var g_just_resizing = 0;
-function setSidebarHeight() {
+function set_sidebar_size() {
var oHeader = document.getElementById('side_header');
var oContent = document.getElementById('side_content');
var oFooter = document.getElementById('side_footer');
var height = pageHeight();
- // Resize sidebar frame on Chrome (and other webkit browsers)
+ // Resize sidebar frame on Chrome (and other webkit browsers).
if (isWebkit()) {
var oldcols = parent.document.body.cols.split(",");
var oldwidth = parseInt(oldcols[0]);
@@ -417,7 +417,7 @@ function setSidebarHeight() {
// Note: previously this was "var width = oHeader.clientWidth;" and
worked
// fine. It stopped working - probably with new Chrome versions. We do not
// know yet if the new way also works on old Chrome versions.
- var target_width = parseInt(oldwidth * 280.0 / width);
+ var target_width = parseInt(oldwidth * sidebar_width() / width);
var newcols = target_width.toString() + ",*";
parent.document.body.cols = newcols;
}
@@ -528,31 +528,34 @@ function dragScroll(event) {
return false;
}
+function sidebar_width()
+{
+ if (g_sidebar_folded)
+ return 10;
+ else
+ return 280;
+}
+
function fold_sidebar()
{
g_sidebar_folded = true;
document.getElementById('check_mk_sidebar').style.position =
"relative";
document.getElementById('check_mk_sidebar').style.left = "-265px";
document.getElementById('side_footer').style.display = "none";
- if (isWebkit()) {
- var oldcols = parent.document.body.cols.split(",");
- var oldwidth = parseInt(oldcols[0]);
- var new_width = 10.0 / 280.0 * oldwidth;
- parent.document.body.cols = new_width.toString() + ",*";
- }
- else
- parent.document.body.cols = "10,*";
+ document.getElementById('side_version').style.display = "none";
+ parent.document.body.cols = sidebar_width() + ",*";
get_url('sidebar_fold.py?fold=yes');
}
function unfold_sidebar()
{
+ g_sidebar_folded = false;
document.getElementById('check_mk_sidebar').style.position = "";
document.getElementById('check_mk_sidebar').style.left = "0";
document.getElementById('side_footer').style.display = "";
- parent.document.body.cols = "280,*";
- g_sidebar_folded = false;
+ document.getElementById('side_version').style.display = "";
+ parent.document.body.cols = sidebar_width() + ",*";
get_url('sidebar_fold.py?fold=');
}
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 67de2f0..a129a71 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -249,7 +249,7 @@ def page_side():
html.write('<body class="side')
if config.screenshotmode:
html.write(" screenshotmode")
- html.write('" onload="initScrollPos(); setSidebarHeight();
init_messages(%s);" '
+ html.write('" onload="initScrollPos(); set_sidebar_size();
init_messages(%s);" '
'onunload="storeScrollPos()">\n' % interval)
html.write('<div id="check_mk_sidebar">\n')
@@ -285,11 +285,11 @@ def page_side():
html.write("sidebar_restart_time = %s\n" % time.time())
html.write("sidebar_update_interval = %0.2f;\n" %
config.sidebar_update_interval)
html.write("registerEdgeListeners();\n")
- html.write("setSidebarHeight();\n")
+ html.write("set_sidebar_size();\n")
html.write("refresh_snapins = %r;\n" % refresh_snapins)
html.write("restart_snapins = %r;\n" % restart_snapins)
html.write("sidebar_scheduler();\n")
- html.write("window.onresize = function() { setSidebarHeight(); };\n")
+ html.write("window.onresize = function() { set_sidebar_size(); };\n")
html.write("if (contentFrameAccessible()) { update_content_location();
};\n")
html.write("</script>\n")