Commit 6355a6ca authored by Nitish Bezzala's avatar Nitish Bezzala
Browse files

Display of files in folders does not follow alphanumberic conventions


(Bug 1180775)

The sort function adds a 0 in front of folders and a 1 in front of file
names to display folders first. So, the sort order is really by numbers,
and if a file has a number in the beginning, it ends up at the end of
the list.

I am separating the initial number and the file name with an 'a'
character, so that the sort order is - first folders, then files, and
all sorted by title.

Change-Id: I1367ebeaf030582beaac1892799dc844ecb51407
Signed-off-by: default avatarNitish Bezzala <nbezzala@yahoo.com>
parent b5e18a45
......@@ -354,8 +354,8 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
// Sort folders before files; then use nat sort order.
public static function my_files_cmp($a, $b) {
return strnatcasecmp((-2 * isset($a->isparent) + ($a->artefacttype != 'folder')) . $a->title,
(-2 * isset($b->isparent) + ($b->artefacttype != 'folder')) . $b->title);
return strnatcasecmp((-2 * isset($a->isparent) + ($a->artefacttype != 'folder')) . 'a' . $a->title,
(-2 * isset($b->isparent) + ($b->artefacttype != 'folder')) . 'a' . $b->title);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment