Change default folder_tree to collapsed instead of expanded

Change default folder_tree to collapsed instead of expanded

by Melissa Ochsner -
Number of replies: 12

Is it possible to make the folder tree default to collapsed intead of expanded when you select a Folder activity? We are using Moodle 2.0.2+ (Build: 20110323) See screen shots.

  1. I click a folder activity to view files...
     folder activity
  2. They view as expanded...
     expanded
  3. I want them to view as collapsed...
     Collapsed
Average of ratings: -
In reply to Melissa Ochsner

Re: Change default folder_tree to collapsed instead of expanded

by Glenys Hanson -

Hi Melissa,

I can't help you directly but this seems to be a theme question. If you put the name of the theme in your title maybe the author of that theme would help you.

Cheers,

Glenys

In reply to Glenys Hanson

Re: Change default folder_tree to collapsed instead of expanded

by Melissa Ochsner -

Thanks Glenys! I will try there.

Melissa

In reply to Melissa Ochsner

Re: Change default folder_tree to collapsed instead of expanded

by Neil Prior -

I'm looking into this myself. It's not a theme issue though. It's controlled by the Folder renderer but I can't quite see how to edit the code to get the desired effect, yet....

http://docs.moodle.org/dev/Output_renderers

http://xref.icheb.info/xrefmoodle2_0_2/nav.html?mod/folder/renderer.php.source.html 

Neil 

In reply to Neil Prior

Re: Change default folder_tree to collapsed instead of expanded

by Dave Jones -

Hi Neil

Dont have a solution but I think it has something to do with the <li> </li> part of the coding, I have alter code on the navigation block to open collapsed 

In reply to Dave Jones

Re: Change default folder_tree to collapsed instead of expanded

by David Cousens -

I am getting a lot of requests from my course facilitators for the same thing - a default to a collapsed view. Some of them have extensive archives of past papers and markschemes that display as a seemingly endless and confusing list every time the folder is viewed.

 

A solution will be very much appreciated.

In reply to David Cousens

Re: Change default folder_tree to collapsed instead of expanded

by Mart Mangus -

Hello!

Had the same problem -- the solution (for Moodle 2.1.3+) to show all folder trees closed after loading is:

Change file mod/folder/renderer.php line 47 from

        $this->page->requires->js_init_call('M.mod_folder.init_tree', array(true)); 

to

        $this->page->requires->js_init_call('M.mod_folder.init_tree', array(false)); 

I think it would be good, when folder settings had option for that, so i created a ticket for that: http://tracker.moodle.org/browse/MDL-30790.

In reply to Mart Mangus

Re: Change default folder_tree to collapsed instead of expanded

by Alex Walker -

One of the Moodle core developers can provide more insight than I can, but it might be worth investigating whether this code collapses the tree with JavaScript (on page load) or in CSS.

If it collapses using CSS, it will be completely impossible for a user with JavaScript disabled to expand the tree (unless they also disable CSS and search through your page).

In reply to Alex Walker

Re: Change default folder_tree to collapsed instead of expanded

by Mart Mangus -

The code mentioned above does it with JavaScript on page load.

You can try it Yourself by turning off JavaScript in Your browser and loading some list wink 

In reply to Melissa Ochsner

Re: Change default folder_tree to collapsed instead of expanded

by Shashank Sharma -

its very simple...change in file ...
go to moodle>mod>folder>module.js ...
in dis file..change expendAll to cpllapseall