Resource types

 
 
Picture of Chris S
Re: Files in Folders: Always folded out as default?
 

I too am finding this to be an issue and am currently looking right now to work away around this, as you say if the top level folder was open that would be great.

 
Average of ratings: -
Picture of Pieterjan Heyse
Re: Files in Folders: Always folded out as default?
 

Did someone open a feature request in the tracker about this?

 
Average of ratings: -
Picture of Florian Zillner
Open Top folder upon load
 

According to Jean Michels hint, open your <moodle_root_dir>/mod/folder/module.js file.

If you do not want to edit two files, just edit this one. Find the if conditional which checks for the expand_all option and comment out the following line.

if (expand_all) {
   //tree.expandAll();
}

Next, to select the top folder to be opened on page load, add right before the call of the render() function the following line:

tree.getNodeByIndex(1).expand();
tree.render();

Your whole module.js file should look like this:

 

/**
* Javascript helper function for Folder module
*
* @package mod
* @subpackage folder
* @copyright 2009 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

 

M.mod_folder = {};

 

M.mod_folder.init_tree = function(Y, expand_all) {
Y.use('yui2-treeview', function(Y) {
var tree = new Y.YUI2.widget.TreeView("folder_tree");

 

tree.subscribe("clickEvent", function(node, event) {
   // we want normal clicking which redirects to url
return false;
});

 

if (expand_all) {
   //tree.expandAll();
}
tree.getNodeByIndex(1).expand();
tree.render();
});
}

 

 
Average of ratings: -
Picture of Kalle Nielsen
Ang: Open Top folder upon load
 

Jean Michels patch works fine - but we need the first level to be unfolded. Tried Florians suggestion.

Commented out as this:
   //tree.expandAll();

Added as suggested 
tree.getNodeByIndex(1).expand();

It didn't help - still the top folder is collapsed.
Others having the same problem?

 
Average of ratings: -
Picture of Florian Zillner
Re: Ang: Open Top folder upon load
 

Did you purge your Moodle caches after editing the Javascript file? I just tried it and it works as expected/said before.

 
Average of ratings: -
Picture of Kalle Nielsen
Ang: Re: Ang: Open Top folder upon load
 

THANK YOU! 
I did empty browser-cache, but had forgotten to delete Moodle server cache via /admin/purgecaches.php

It works just fine smile

 
Average of ratings: -