Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34748

Filesystem repository does not sort filenames in file picker

    Details

    • Testing Instructions:
      Hide

      1. Enable and configure FileSystem repository, add several files (both images and non-images) and create several directories there.
      2. Create a folder resource
      3. Open filepicker to add files to filearea, select filesystem repository and make sure files are sorted alphabetically by default
      4. Open filepicker to insert image in the description textarea and make sure that only images and directories are displayed and they are sorted by name as well

      extra testing possible : language variation, adding numbers to file names

      Show
      1. Enable and configure FileSystem repository, add several files (both images and non-images) and create several directories there. 2. Create a folder resource 3. Open filepicker to add files to filearea, select filesystem repository and make sure files are sorted alphabetically by default 4. Open filepicker to insert image in the description textarea and make sure that only images and directories are displayed and they are sorted by name as well extra testing possible : language variation, adding numbers to file names
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      wip-MDL-34748-master

      Description

      Whether viewing as icons or a list, the files in a filesystem repository appear in what seems to be a random order when listed in the File Picker. This would be much more useful if the entries were alphabetized.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            usernamenumber Brad added a comment -

            Patch that fixes the problem (alphabetizes by title) in 2.2.1

            Show
            usernamenumber Brad added a comment - Patch that fixes the problem (alphabetizes by title) in 2.2.1
            Hide
            marina Marina Glancy added a comment -

            hi Brad,
            Thanks for mentioning it and submitting a patch.

            Can you make a small change to the patch please so that function sort_by_title is inside the class and we don't declare a global function in the plugin.
            See example 3 in http://au2.php.net/manual/en/function.usort.php

            Marina

            Show
            marina Marina Glancy added a comment - hi Brad, Thanks for mentioning it and submitting a patch. Can you make a small change to the patch please so that function sort_by_title is inside the class and we don't declare a global function in the plugin. See example 3 in http://au2.php.net/manual/en/function.usort.php Marina
            Hide
            usernamenumber Brad added a comment -

            Updated patch per Marina Glancy's request (thanks for the quick response!)

            Show
            usernamenumber Brad added a comment - Updated patch per Marina Glancy's request (thanks for the quick response!)
            Hide
            marina Marina Glancy added a comment - - edited

            that's great. Thanks. I changed it a little so that subfolders are listed first.

            Show
            marina Marina Glancy added a comment - - edited that's great. Thanks. I changed it a little so that subfolders are listed first.
            Hide
            stronk7 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
            stronk7 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
            skodak Petr Skoda added a comment -

            strcmp() and strtolower() breaks for utf8 strings, please use our textlib library instead...

            Show
            skodak Petr Skoda added a comment - strcmp() and strtolower() breaks for utf8 strings, please use our textlib library instead...
            Hide
            marina Marina Glancy added a comment -

            Hi Dan, I want to re-submit it considering Petr's comment. Can you return it to work in progress please?

            Show
            marina Marina Glancy added a comment - Hi Dan, I want to re-submit it considering Petr's comment. Can you return it to work in progress please?
            Hide
            nebgor Aparup Banerjee added a comment -

            Hi Marina,

            perhaps (Petr means) at https://github.com/marinaglancy/moodle/compare/master...wip-MDL-34748-master#L0R142 we could do :-
            collatorlib::ksort($list['list'], collatorlib::SORT_NATURAL);

            Show
            nebgor Aparup Banerjee added a comment - Hi Marina, perhaps (Petr means) at https://github.com/marinaglancy/moodle/compare/master...wip-MDL-34748-master#L0R142 we could do :- collatorlib::ksort($list ['list'] , collatorlib::SORT_NATURAL);
            Hide
            nebgor Aparup Banerjee added a comment -

            reopening for Marina.

            Show
            nebgor Aparup Banerjee added a comment - reopening for Marina.
            Hide
            marina Marina Glancy added a comment -

            there is no function in textlib or collatorlib to sort an array of arrays by property or to compare strings.

            So I had to retrieve list of dirs and files first, then sort it and then fill the $list['list']

            Show
            marina Marina Glancy added a comment - there is no function in textlib or collatorlib to sort an array of arrays by property or to compare strings. So I had to retrieve list of dirs and files first, then sort it and then fill the $list ['list']
            Hide
            nebgor Aparup Banerjee added a comment -

            Thanks for asorting that out Marina! :-D

            that's been integrated into 22,23 and master.

            Show
            nebgor Aparup Banerjee added a comment - Thanks for asorting that out Marina! :-D that's been integrated into 22,23 and master.
            Hide
            fred Frédéric Massart added a comment -

            Works like a charm on 2.2, 2.3 and master! \o/

            Show
            fred Frédéric Massart added a comment - Works like a charm on 2.2, 2.3 and master! \o/
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility!

            Many thanks for your collaboration, yay!

            Closing, ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility! Many thanks for your collaboration, yay! Closing, ciao

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/12