Moodle
  1. Moodle
  2. MDL-30790

Folder tree should have option to be collapsed or expanded after loading the page

    Details

    • Database:
      Any
    • Testing Instructions:
      Hide
      1. Create a folder resource.
        1. Create sub-folders with content.
        2. Make sure that "Show sub-folders expanded" is checked.
      2. View folder resource that you just made, verify that the sub-folders shown are expanded.
      3. Edit folder resource, make uncheck "Show sub-folders expanded"
      4. View folder resource that you just made, verify that the sub-folders shown are collapsed
      Show
      Create a folder resource. Create sub-folders with content. Make sure that "Show sub-folders expanded" is checked. View folder resource that you just made, verify that the sub-folders shown are expanded. Edit folder resource, make uncheck "Show sub-folders expanded" View folder resource that you just made, verify that the sub-folders shown are collapsed
    • Workaround:
      Hide

      Not a real workaround, but way to change currently hard coded behavior: http://moodle.org/mod/forum/discuss.php?d=180798#p838072

      Create new folder with a lot of sub folders and files.

      After loading the folder view, all the folders and sub folders and sub sub folders render opened.

      It is not comfortable to find the files even when You know the folder path.

      Show
      Not a real workaround, but way to change currently hard coded behavior: http://moodle.org/mod/forum/discuss.php?d=180798#p838072 Create new folder with a lot of sub folders and files. After loading the folder view, all the folders and sub folders and sub sub folders render opened. It is not comfortable to find the files even when You know the folder path.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull 2.4 Branch:
    • Pull Master Branch:
    • Rank:
      33728

      Issue Links

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for suggesting this.

        I've put that on the backlog.

        In the meantime feel free to help us work on this issue. If you are able to provide a patch, please add a patch label so we will spot it.

        Show
        Michael de Raadt added a comment - Thanks for suggesting this. I've put that on the backlog. In the meantime feel free to help us work on this issue. If you are able to provide a patch, please add a patch label so we will spot it.
        Hide
        Rex Lorenzo added a comment -

        Our developer worked out a patch to add in the functionality as requested for in this ticket. We had a faculty member with a similar request.

        Show
        Rex Lorenzo added a comment - Our developer worked out a patch to add in the functionality as requested for in this ticket. We had a faculty member with a similar request.
        Hide
        colin wheelhouse added a comment -

        I have applied the patch successfully to Moodle 2.3.2. However I would suggest that the top level folder be open so that the names of the subsequent folders inside can be seen and accessed quickly, rather than having to expand this folder to see what's inside. Surely the functionality ought to be that all folders can be seen and then the user chooses which folder to expand to access the contents?

        Show
        colin wheelhouse added a comment - I have applied the patch successfully to Moodle 2.3.2. However I would suggest that the top level folder be open so that the names of the subsequent folders inside can be seen and accessed quickly, rather than having to expand this folder to see what's inside. Surely the functionality ought to be that all folders can be seen and then the user chooses which folder to expand to access the contents?
        Hide
        Rex Lorenzo added a comment -

        Colin, or anyone else, can you please peer review/test my patch?

        To make the top level node expanded only, I had to use

        tree.getNodeByIndex(1).expand();          
        

        Because the following didn't work for some reason:

        tree.getRoot().expand();
        
        Show
        Rex Lorenzo added a comment - Colin, or anyone else, can you please peer review/test my patch? To make the top level node expanded only, I had to use tree.getNodeByIndex(1).expand(); Because the following didn't work for some reason: tree.getRoot().expand();
        Hide
        Matteo Scaramuccia added a comment -

        Hi Rex,
        I'm actually not a YUI2 tree expert, just a newbie: in learning that widget to read module.js in the SCORM module, my undestarding is that focus() is the method required to expand a node, starting from YAHOO 2.7.0.

        HTH,
        Matteo

        Show
        Matteo Scaramuccia added a comment - Hi Rex, I'm actually not a YUI2 tree expert, just a newbie : in learning that widget to read module.js in the SCORM module, my undestarding is that focus() is the method required to expand a node, starting from YAHOO 2.7.0 . HTH, Matteo
        Hide
        Rex Lorenzo added a comment -

        Matteo, I don't see a function "focus" defined for the YAHOO.widget.Node object.

        Show
        Rex Lorenzo added a comment - Matteo, I don't see a function "focus" defined for the YAHOO.widget.Node object.
        Hide
        Matteo Scaramuccia added a comment -

        See here: http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html#method_focus and the source, http://developer.yahoo.com/yui/docs/Node.js.html. It may not be useful since it requires an anchor. Again, it was just a thought, nothing but sharing my small experince: I'm far even from being a YAHOO widget simple user

        Show
        Matteo Scaramuccia added a comment - See here: http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html#method_focus and the source, http://developer.yahoo.com/yui/docs/Node.js.html . It may not be useful since it requires an anchor. Again, it was just a thought, nothing but sharing my small experince: I'm far even from being a YAHOO widget simple user
        Hide
        Andrés Chandía added a comment -

        Hi colin wheelhouse, I'm kind of newby to this interface, and I have found this thread because I'm facing the same issue trated here, You mention that you apply the patch succesfully, what I can not find is that patch, could you be so kind to indicate me which file I should download to apply it.

        thanks.

        Show
        Andrés Chandía added a comment - Hi colin wheelhouse, I'm kind of newby to this interface, and I have found this thread because I'm facing the same issue trated here, You mention that you apply the patch succesfully, what I can not find is that patch, could you be so kind to indicate me which file I should download to apply it. thanks.
        Hide
        Rex Lorenzo added a comment - - edited

        Andrés, you should be able to click on the diff urls to see what code changes are needed to apply the patch to your version of Moodle. If you know git, you can use "git cherry-pick" to apply the changes to your Moodle codebase (http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html). Else you can try copying and pasting the diff changes.

        I just added a new patch for 2.5.

        Show
        Rex Lorenzo added a comment - - edited Andrés, you should be able to click on the diff urls to see what code changes are needed to apply the patch to your version of Moodle. If you know git, you can use "git cherry-pick" to apply the changes to your Moodle codebase ( http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html ). Else you can try copying and pasting the diff changes. I just added a new patch for 2.5.
        Hide
        Andrés Chandía added a comment -

        Sorry for my ignorance, I went to the link about "git cherry-pick" but I couldn't realise what command should I use, and if I should run it from the moodle root directory or from the mof/folder, by the way my version is: Moodle 2.4.1+ (Build: 20130125)
        Thanks for your help!

        Show
        Andrés Chandía added a comment - Sorry for my ignorance, I went to the link about "git cherry-pick" but I couldn't realise what command should I use, and if I should run it from the moodle root directory or from the mof/folder, by the way my version is: Moodle 2.4.1+ (Build: 20130125) Thanks for your help!
        Hide
        Andrés Chandía added a comment -

        As I couldn't figure out how to apply git cherry-pick, I did it manually (copy-paste).
        Now I can see the option: "Show folders expanded", but no matter if checked or not now the folders are always collapsed in the root one.

        Show
        Andrés Chandía added a comment - As I couldn't figure out how to apply git cherry-pick, I did it manually (copy-paste). Now I can see the option: "Show folders expanded", but no matter if checked or not now the folders are always collapsed in the root one.
        Hide
        Rex Lorenzo added a comment - - edited

        Andres, make sure that you have upgraded the folder module, since this feature requires a new database column.

        Go to mod/folder/version.php and make sure that your version number ends in "01" and not "00". For example, normally the module version is:

        $module->version = 2013012100; // for the most current Moodle version

        Change it to:

        $module->version = 2013012101;

        Then go to "Site administration > Notifications" and make sure you upgrade your plugins.

        Show
        Rex Lorenzo added a comment - - edited Andres, make sure that you have upgraded the folder module, since this feature requires a new database column. Go to mod/folder/version.php and make sure that your version number ends in "01" and not "00". For example, normally the module version is: $module->version = 2013012100; // for the most current Moodle version Change it to: $module->version = 2013012101; Then go to "Site administration > Notifications" and make sure you upgrade your plugins.
        Hide
        Andrés Chandía added a comment -

        That did the trick, thanks, I had $module->version = 2012061701;
        and I changed to the one you suggest me: $module->version = 2013012101;

        Show
        Andrés Chandía added a comment - That did the trick, thanks, I had $module->version = 2012061701; and I changed to the one you suggest me: $module->version = 2013012101;
        Hide
        Jason Fowler added a comment -

        [Y] Syntax
        [Y] Output
        [Y] Whitespace
        [Y] Language
        [Y] Databases
        [Y] Testing
        [-] Security
        [-] Documentation
        [Y] Git
        [Y] Sanity check

        Show
        Jason Fowler added a comment - [Y] Syntax [Y] Output [Y] Whitespace [Y] Language [Y] Databases [Y] Testing [-] Security [-] Documentation [Y] Git [Y] Sanity check
        Hide
        Eloy Lafuente (stronk7) added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Rex Lorenzo added a comment -

        Rebased branch off of latest master. Resolved conflicts with another issue that added another field to the Folder module (MDL-37455).

        Show
        Rex Lorenzo added a comment - Rebased branch off of latest master. Resolved conflicts with another issue that added another field to the Folder module ( MDL-37455 ).
        Hide
        Damyon Wiese added a comment -

        Thanks Rex. This change looks ok to me. I did fix some white space issues in an extra patch - you might want to check your settings in your text editor.

        This has been integrated for master only - as is our policy for new features (http://docs.moodle.org/dev/Integration_Review#Process_for_requesting_a_non_bug-fix_backport)

        Show
        Damyon Wiese added a comment - Thanks Rex. This change looks ok to me. I did fix some white space issues in an extra patch - you might want to check your settings in your text editor. This has been integrated for master only - as is our policy for new features ( http://docs.moodle.org/dev/Integration_Review#Process_for_requesting_a_non_bug-fix_backport )
        Hide
        Frédéric Massart added a comment -

        I am failing this test because this new option does not work for folders displayed on the course page. I assume this could be fixed in another MDL, but to me this has to be fixed before it gets released. Nice feature by the way .

        Show
        Frédéric Massart added a comment - I am failing this test because this new option does not work for folders displayed on the course page. I assume this could be fixed in another MDL, but to me this has to be fixed before it gets released. Nice feature by the way .
        Hide
        Eloy Lafuente (stronk7) added a comment - - edited

        +1 to delegate the support for the new setting in course page to another issue. This looks nice enough to keep it as is (without reverting for re-adding it later).

        Show
        Eloy Lafuente (stronk7) added a comment - - edited +1 to delegate the support for the new setting in course page to another issue. This looks nice enough to keep it as is (without reverting for re-adding it later).
        Hide
        Eloy Lafuente (stronk7) added a comment -

        I've created MDL-38632 to make the setting to be observed when the folder is displayed inline in course page. So passing this. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - I've created MDL-38632 to make the setting to be observed when the folder is displayed inline in course page. So passing this. Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Grrr, also have discovered that the new DB column is 100% ignored in backup & restore. MDL-38633 created about that.

        Show
        Eloy Lafuente (stronk7) added a comment - Grrr, also have discovered that the new DB column is 100% ignored in backup & restore. MDL-38633 created about that.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        One more problem:

        "Column names should be always lowercase, simple and short, following the same rules as for variable names."

        (from http://docs.moodle.org/dev/Database)

        So perhaps we should consider moving this to "showexpanded" everywhere ?!?

        Show
        Eloy Lafuente (stronk7) added a comment - One more problem: "Column names should be always lowercase, simple and short, following the same rules as for variable names." (from http://docs.moodle.org/dev/Database ) So perhaps we should consider moving this to "showexpanded" everywhere ?!?
        Hide
        Marina Glancy added a comment -

        Please note that this seem to cause regression: MDL-38634

        Show
        Marina Glancy added a comment - Please note that this seem to cause regression: MDL-38634
        Hide
        Rex Lorenzo added a comment -

        Eloy, I can change the column name and remove the underscore. I don't need to provide upgrade code to rename the field, right? Since this hasn't hide the real master yet?

        Marina, I will take a look into the regression reported. Hopefully the patch I apply for this feature will also fix MDL-38632.

        Show
        Rex Lorenzo added a comment - Eloy, I can change the column name and remove the underscore. I don't need to provide upgrade code to rename the field, right? Since this hasn't hide the real master yet? Marina, I will take a look into the regression reported. Hopefully the patch I apply for this feature will also fix MDL-38632 .
        Hide
        Damyon Wiese added a comment -

        I added a followup issue to rename the column.

        Show
        Damyon Wiese added a comment - I added a followup issue to rename the column.
        Hide
        Damyon Wiese added a comment -

        This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).

        Thanks for your contributions!

        Show
        Damyon Wiese added a comment - This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads). Thanks for your contributions!
        Hide
        Marina Glancy added a comment -

        Hi Rex,
        the regression MDL-38634 is still not fixed, I'm assigning it to you.
        And also maybe I'm missing something but I don't see any difference whether the checkbox is checked or not - regardless of it the folder is expanded and subfolders are collapsed.

        Show
        Marina Glancy added a comment - Hi Rex, the regression MDL-38634 is still not fixed, I'm assigning it to you. And also maybe I'm missing something but I don't see any difference whether the checkbox is checked or not - regardless of it the folder is expanded and subfolders are collapsed.
        Hide
        Rex Lorenzo added a comment -

        Marina, what browser/os are you testing on? It works for me on Chrome/Mac.

        Show
        Rex Lorenzo added a comment - Marina, what browser/os are you testing on? It works for me on Chrome/Mac.
        Hide
        Mary Cooch added a comment -

        Removing docs_required label as this is documented here http://docs.moodle.org/25/en/Folder_resource_settings

        Show
        Mary Cooch added a comment - Removing docs_required label as this is documented here http://docs.moodle.org/25/en/Folder_resource_settings
        Hide
        Andrés Chandía added a comment - - edited

        Hi there, I can not update or upgrade my moodle via git, I got this error message:

        error: Your local changes to 'mod/folder/mod_form.php' would be overwritten by merge. Aborting.
        Please, commit your changes or stash them before you can merge.

        I've downloaded the stable 2.4 in a different directory, from there I've taken the file "mod/folder/mod_form.php" to replace the file contained at my installation, but the error remains the same, somebody knows what could be happening and how to solve this issue.

        Thanks for your help

        Show
        Andrés Chandía added a comment - - edited Hi there, I can not update or upgrade my moodle via git, I got this error message: error: Your local changes to 'mod/folder/mod_form.php' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge. I've downloaded the stable 2.4 in a different directory, from there I've taken the file "mod/folder/mod_form.php" to replace the file contained at my installation, but the error remains the same, somebody knows what could be happening and how to solve this issue. Thanks for your help
        Hide
        Mart Mangus added a comment -

        Hi there, I can not update or upgrade my moodle via git, I got this error message:

        error: Your local changes to 'mod/folder/mod_form.php' would be overwritten by merge. Aborting.
        Please, commit your changes or stash them before you can merge.

        I've downloaded the stable 2.4 in a different directory, from there I've taken the file "mod/folder/mod_form.php" to replace the file contained at my installation, but the error remains the same, somebody knows what could be happening and how to solve this issue.

        Hi! The problem is, that You have made local changes in Your "mod/folder/mod_form.php" file and git does not want to overwrite these. Simple solution would be to checkout the original content of the "mod/folder/mod_form.php" file with command "git checkout mod/folder/mod_form.php". After that You should be able to upgrade via git.

        A better place for this kind of questions were Moodle forums

        Show
        Mart Mangus added a comment - Hi there, I can not update or upgrade my moodle via git, I got this error message: error: Your local changes to 'mod/folder/mod_form.php' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge. I've downloaded the stable 2.4 in a different directory, from there I've taken the file "mod/folder/mod_form.php" to replace the file contained at my installation, but the error remains the same, somebody knows what could be happening and how to solve this issue. Hi! The problem is, that You have made local changes in Your "mod/folder/mod_form.php" file and git does not want to overwrite these. Simple solution would be to checkout the original content of the "mod/folder/mod_form.php" file with command "git checkout mod/folder/mod_form.php". After that You should be able to upgrade via git. A better place for this kind of questions were Moodle forums
        Hide
        Andrés Chandía added a comment -

        Thanks a lot and sorry for my ignorance, I'm totally new to git.

        Show
        Andrés Chandía added a comment - Thanks a lot and sorry for my ignorance, I'm totally new to git.

          People

          • Votes:
            8 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: