From 53c46ffb2e4b4d4fd3da09356bd01e4b766db1b5 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Tue, 26 May 2020 17:37:56 +0800 Subject: [PATCH] MDL-68723 filepicker: Display parent content in filemanger tree view --- repository/filepicker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repository/filepicker.js b/repository/filepicker.js index 934085f2e07..6cdb64c3c1c 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -260,13 +260,18 @@ YUI.add('moodle-core_filepicker', function(Y) { // manually call dynload for parent elements in the tree so we can load other siblings if (options.dynload) { var root = scope.treeview.getRoot(); + // Whether search results are currently displayed in the active repository in the filepicker. + // We do not want to load siblings of parent elements when displaying search tree results. + var isSearchResult = typeof options.callbackcontext.active_repo !== 'undefined' && + options.callbackcontext.active_repo.issearchresult; while (root && root.children && root.children.length) { root = root.children[0]; if (root.path == mytreeel.path) { root.origpath = options.filepath; root.origlist = fileslist; + } else if (!root.isLeaf && root.expanded && !isSearchResult) { + Y.bind(options.treeview_dynload, options.callbackcontext)(root, null); } - // Removed bind as of MDL-62415 as it overwrites the search tree results } } } else {