Is it my imagination, or are files not listed in alphbetical order?

For example, after reloading the browser or clicking the 'file name' column heading,
the list displays as:

primary01-th.jpg
assess01.jpg
assess01-po.jpg
assess01-sq.jpg
primary01-sq.jpg
assess01-th.jpg
primary01-la.jpg
assess01-la.jpg
primary01.jpg
primary01-po.jpg

but should be:

assess01.jpg
assess01-la.jpg
assess01-po.jpg
assess01-sq.jpg
assess01-th.jpg
primary01.jpg
primary01-la.jpg
primary01-po.jpg
primary01-sq.jpg
primary01-th.jpg

The latter is obviously much clearer and easier to navigate
(and for our school website it would help younger chilren to learn about alphabetical order!).

However, I have no idea how difficult it is to order items using php and sql queries. Maybe
it is something that can't easily be fixed? I brought it up just in case it was simply a typo
in the code and easily adjusted.

Cheers.

CommentFileSizeAuthor
#10 imce_extras.js_.txt9.6 KBjasek
#8 imce_extras.js_.txt9.59 KBjasek

Comments

jfgeiger’s picture

I've noticed that the sort order the filenames has no order at all. The default is random, and if you click on the file name, it just reverse the files, still in the random order. Clicking on the size or date does a proper sort, but not the files.

You can view this on the demo site as well, so it's not an issue with my installation.

talyia’s picture

I had started another thread regarding this over at http://drupal.org/node/305312.
Another user notified me about this thread so I am moving all further discussion from my other thread to this one.
Below is a copy from my post over at the other one...

Hi all,

First of all, IMCE is a really excellent module! I use it together with BUEditor and I couldn't be happier as this is the perfect combo for me:)
There is just one thing... the sorting of images uploaded in the file browser doesn't seem to be working as it should. Clicking on the filename header at the top of the file browser window does not sort the files alphabetically. This makes things a little more time consuming for me when I am trying to upload content as I have almost 100 files in each directory of image folders that I have to look thru, and when I am uploading several bits of content, along with several different images, it takes a lot longer than it should as I try to find the one image I am looking for.

A minor issue but it would be WONDERFUL if this would work. I haven't seen any other complaints, so is there a setting I am missing? I couldn't find anything in the IMCE settings under Admin.

Thanks a lot in advance for your help:)

Christine

-Anti-’s picture

Unfortunately I think ufku hasn't been monitoring this module since the mid-July release of 6.x-1.1. I think alphabetical-ordering would probably a simple thing to fix (it's likely just to be a typo in the script or something, because earlier versions sorted OK), but it looks like ufku is perhaps busy with other things.

This is what scares me to death about using Drupal! Support is excellent whilst the devs are interested in their modules, but it is only natural for them to move on to other technologies and skills eventually!

arh1’s picture

Title: alphabetical order » initial file sorting is broken

it appears that the default sorting is wonky when the IMCE window is first opened (no logic to the sorting that i can see), but that it can be fixed by sorting by another column heading, and then by the file name again.

@talyia -- and yes, you can sort by column headings! (just discovered this.) the script allows you to click the headings to sort by that criteria, the mouse just doesn't turn into the familiar "pointer" icon, so it's not obvious. (this could be fixed w/ a one-line CSS patch, which i hope to get to soon...)

steps to reproduce (in Firefox anyway; mileage could vary across browsers):
1) open the IMCE window from any link (no intelligible default sorting)
2) click the 'Size' column heading (files are sorted by size correctly)
3) click the 'File name' column heading (files are sorted by file name correctly)

@-Anti- -- (this discussion should really be had elsewhere, but just a quick note): i know the feeling of fear(!), but keep in mind that this is all open source and freely distributed code (free as in speech and beer). hypothetically, any of us could chip in and contribute something to the development (be it a clear bug report, or a patch for the code). and keep in mind that, as i recall, ufku did port the project from D5 to D6 very quickly recently, so i don't think s/he's disinterested. anyway, we're making progress!

talyia’s picture

Thank you arh1:)

Yes, I know that clicking on file name column heading will (should) sort the column but it is not working for me. I clicked on the 'Size' column heading first, as you suggested and then clicked on the "File name" heading again but it is still not sorting it alphabetically for me:((

I then tried various things after that... clicking on the other column headings too, and then clicking back on the "file name" column, but to no avail:(

Christine

-Anti-’s picture

> I then tried various things after that... clicking on the other column headings too,
> and then clicking back on the "file name" column, but to no avail :(

I can confirm that this doesn't work for me either (Firefox 3).

> i know the feeling of fear(!), but keep in mind that this is all open source

Yeah, I know. But the only reason I'm using drupal *at all* is IMCE. For our school website the main feature is that everyone has their own browsable folder to keep work and media in. IMCE is the only thing that comes close to what we wanted in any of the CMS packages available. But I'm understandably nervous building an entire website on the foundation of one contributed module, especially since D6 is otherwise quite lame in some other key areas!

talyia’s picture

Just checking to see if anyone has more input about this issue?

Thanks,
Christine

jasek’s picture

StatusFileSize
new9.59 KB

Hi all,

I found some solution which worked for me, it's just one-liner, so I post it there (because I'm new here and really don't know where it should be).

in file imce/js/imce_extras.js on line 120 i put:

imce.vars.cid || imce.vars.dsc ? imce.columnSort(imce.vars.cid, imce.vars.dsc) : imce.columnSort(0, 0), $(imce.cols[0]).addClass('asc');

in stead of:

imce.vars.cid || imce.vars.dsc ? imce.columnSort(imce.vars.cid, imce.vars.dsc) : $(imce.cols[0]).addClass('asc');

so as you can see, i add command for initial sorting, which was imho missing.

I hope it's gonna work for some of you as well. (Modified file attached)

talyia’s picture

WONDERFUL!!!! I am going to try this out and will report back later:)

UPDATE:

Okay, it is working a LOT LOT better than before but there are still issues.

1. It is in descending order instead of ascending order (but this is a minor issue and definitely one I can live with)
2. It sorts according to first letter only and that's it.

Here is an example of one of my directories and how it sorted:

highlightsreverse_04.jpg
highlightsreverse_03.jpg
highlightsreverse_02.jpg
highlightsreverse_01.jpg
highlights_04.jpg
highlights_magcover.jpg
highlights_03.jpg
highlights_02.jpg
highlights_01.jpg
highlights_magcoverreverse.jpg
articles_11_0808_leelife_library_tn.jpg
articles_08_brain_tn.jpg
articles_06_fashion_tn.jpg
articles_05_brawn_tn.jpg
articles_09_vanishingact_tn.jpg
articles_04_garden_tn.jpg
articles_03_food_tn.jpg
articles_01_lizcrandall_tn.jpg
articles_07_momitude_tn.jpg
articles_12_0808_leelife_luckydogs_tn.jpg
articles_02_bag_tn.jpg
articles_05_brawn.jpg
articles_11_0808_leelife_library_02.jpg
articles_11_0808_leelife_library_01.jpg
articles_08_brain.jpg
articles_06_fashion_01.jpg
articles_01_lizcrandall_04a.jpg
articles_01_lizcrandall_03a.jpg
articles_04_garden_03.jpg
articles_04_garden_02.jpg
articles_04_garden_01.jpg
articles_01_lizcrandall_10.jpg
articles_01_lizcrandall_07.jpg
articles_11_0808_leelife_library_05.jpg
articles_07_momitude.jpg
articles_02_bag_ednadowdell.jpg
articles_01_lizcrandall_09.jpg
articles_04_garden_04.jpg
articles_01_lizcrandall_03.jpg
articles_01_lizcrandall_02.jpg
articles_12_0808_leelife_luckydogs_06.jpg
articles_01_lizcrandall_08.jpg
articles_01_lizcrandall_06.jpg
articles_01_lizcrandall_05.jpg
articles_09_vanishingact_02.jpg
articles_02_bag_beckyfreeman.jpg
articles_09_vanishingact_01.jpg
articles_01_lizcrandall_01.jpg
articles_12_0808_leelife_luckydogs_05.jpg
articles_12_0808_leelife_luckydogs_01.jpg
articles_11_0808_leelife_library_03.jpg
articles_02_bag_pamflournoy.jpg
articles_12_0808_leelife_luckydogs_04.jpg
articles_12_0808_leelife_luckydogs_03.jpg
articles_02_bag_rhondanichols.jpg
articles_01_lizcrandall_04.jpg
articles_12_0808_leelife_luckydogs_02.jpg
articles_11_0808_leelife_library_04.jpg
articles_09_vanishingact_03.jpg
articles_06_fashion_02.jpg
articles_03_food.jpg

jasek’s picture

StatusFileSize
new9.6 KB

Hi,

thank you for report, i have looked at it once more and i think i've fixed no. 2 issue. Descending order is because of settings are stored in cookies, if you delete them, it will fall back in asc.

Updated file attached...

-Anti-’s picture

Thanks for your work on this.
Sorting by first letter is certainly better than no sorting at all.

I have to say that I'm surprised that lists aren't sorted by their entire strings. I thought this type of thing is what computers do best, and would've thought that php/javascript made it easy for programmers to do?

I hope this gets fixed properly in future, so that users can find their files more easily.

Cheers.

jasek’s picture

I'm not sure which version you have tried, the second (last) sorts by the whole string, not just by the first letter.

-Anti-’s picture

Status: Active » Needs review

Sorry... I misread your reply to talyia - thought you'd fixed asc/dec.
That's really great that you've fixed the sorting problem completely!

Thanks!

I've changed the status to 'patch with review', so ufku might see it on return in 2009.

talyia’s picture

Jasek,
Thank you SO much for your work with this:))

Very very much appreciated!

Christine

kipkoan’s picture

In addition to the above, I rewrote the imce.firstSort function to make it work better:

//sort the list for the first time
imce.firstSort = function() {
  if (!imce.vars.cid) {
    if (imce.vars.asc) {
      imce.columnSort(imce.vars.cid, imce.vars.asc);
      $(imce.cols[0]).removeClass('asc');
      $(imce.cols[0]).addClass('desc');
    }
    else {
      imce.columnSort(imce.vars.cid, imce.vars.dsc);
      $(imce.cols[0]).removeClass('desc');
      $(imce.cols[0]).addClass('asc');
    }
  }
};

Also, I have fixed the directory sort by adding 1 line to the inc/page.inc file (line #928):

sort($directory['subdirectories']);

thomjjames’s picture

Hi,

I can confirm that #10 and #15 seem to fix the issue for me.

Thanks
Tom

Idran’s picture

Same here, for files at least. Although the extra line for sorting subdirectories doesn't seem to work on my system.

emerygjr’s picture

I applied #10 and #15 and it does sort but only descending and will not toggle. You can sort on of he other columns then back to the File name to sort descending. I cannot get it to sort ascending.

Thanks
Emery

ufku’s picture

Status: Needs review » Fixed

thank you all for contributing.
patch was committed.
initial sorting function is now:

imce.firstSort = function() {
  imce.columnSort(imce.vars.cid, imce.vars.dsc);
}
-Anti-’s picture

Hey welcome back!!
I hope your tour of duty was 'uneventful'.

And thanks for your continued development of IMCE.

ufku’s picture

Thanks. After a waste of 6 months it's nice to be here again.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

knieblond’s picture

Title: initial file sorting is broken » initial file sorting is "still" broken
Version: 6.x-1.1 » 6.x-1.2
Status: Closed (fixed) » Active

Hello there!

I don't know if I am the only one, but this issue is still alive!

I'm working with module version 6.1.2 and the sorting by file name seems to me still some kind of dizzy although it is mentioned to be fixed. I am a bit disappointed about that - on the demo page it's also not working.

What can I do to get it finally work fine for me?!

ufku’s picture

Status: Active » Closed (duplicate)
truyenle’s picture

Version: 6.x-1.2 » 6.x-1.3
Priority: Minor » Normal

Me either. It doesn't sort at all. I'm using version 6.x-1.3.

Any help would be very much appreciated.

Thanks