directories would not open)
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: f7e61635e5f3e9a575fea19197b091a37f80d05a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f7e61635e5f3e9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu May 24 10:52:00 2012 +0200
FIX: fix folding in custom links (directories would not open)
---
ChangeLog | 1 +
web/htdocs/js/sidebar.js | 33 ---------------------------------
web/plugins/sidebar/shipped.py | 17 ++++-------------
3 files changed, 5 insertions(+), 46 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e1bc3e2..2458dd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* Hostgroup view BI Boxes omits the root level
* Finalized layout if view options and commands/filters/painteroptions.
* FIX: remove nasty JS error in sidebar
+ * FIX: fix folding in custom links (directories would not open)
Mobile:
* FIX: Fixed logtime filter settings in all mobile views
diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js
index f0496f3..bac4a02 100644
--- a/web/htdocs/js/sidebar.js
+++ b/web/htdocs/js/sidebar.js
@@ -664,39 +664,6 @@ function addBookmark() {
get_url("add_bookmark.py?title=" + escape(title) + "&href=" +
escape(href), updateContents, "snapin_bookmarks");
}
-function toggle_folder(o, folderId) {
- var par = o.parentNode;
- var next = null;
- var one_more = false;
- var img = null;
-
- for (var i in par.childNodes) {
- var child = par.childNodes[i];
- if (one_more && child.tagName == "DIV") {
- next = child;
- break;
- }
- if (child == o)
- one_more = true;
- }
-
- for (var i in o.childNodes) {
- var child = o.childNodes[i];
- if (child.tagName == "IMG") {
- img = child;
- break;
- }
- }
-
- if (next)
- toggle_tree_state('customlinks', folderId, next);
-
- child = null;
- par = null;
- next = null;
- img = null;
-}
-
/************************************************
* Save/Restore scroll position
*************************************************/
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index 06ea8a9..f0f6f46 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -1156,20 +1156,11 @@ def render_custom_links():
try:
if type(entry[1]) == type(True):
idss = ids + [str(n)]
- if states.get(''.join(idss), entry[1] and 'on' or
'off') == 'on': # open
- display = "display: block; "
- img = "link_folder_open.gif"
- else:
- display = "display: none; "
- img = "link_folder.gif"
- html.write('<h3 onclick="toggle_folder(this,
\'%s\');" ' % ''.join(idss))
-
html.write('onmouseover="this.style.cursor=\'pointer\';" ')
-
html.write('onmouseout="this.style.cursor=\'auto\';">')
- html.write('<img src="images/%s"
align="center" />' % img)
- html.write("%s</h3>\n" % entry[0])
- html.write('<div style="%s" class=sublist>' %
display)
+ is_open = entry[1]
+ id = '/'.join(idss)
+ html.begin_foldable_container("customlinks", id,
isopen=entry[1], title=entry[0])
render_list(idss, entry[2])
- html.write('</div>\n')
+ html.end_foldable_container()
elif type(entry[1]) == str:
frame = len(entry) > 3 and entry[3] or "main"
if len(entry) > 2 and entry[2]: