[SOLVED] Sort order for album list

aarora

Joined: 2004-08-05
Posts: 6
Posted: Thu, 2004-08-05 16:41

I just downloaded Gallery2 last night and set up a test site using migrated data from my gallery 1.x instance. Looks awesome.

As we know by now that the album ordering is not preserved as part of the migration. I was actually wondering if there will be an option to keep the album list in a sorted order, like there is for the album itself. I want to be able to sort by directory name (not title), because I prefix all of my directories with a date (i.e. 2004-05-30_-_My_Album).

Also, it would be nice to choose ascending or descending since I want to be able to show the latest albums first.

Thanks...and keep up the great work!

Anil

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2004-08-05 17:07

On any G2 album choose "edit album" and pick the "Album Basics" tab.. sort order is at the top. It does have ascending/descending, but it doesn't have sort by (path) name.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Thu, 2004-08-05 17:12
aarora wrote:
As we know by now that the album ordering is not preserved as part of the migration

It's on my task list, though.

:D

 
aarora

Joined: 2004-08-05
Posts: 6
Posted: Thu, 2004-08-05 17:38
mindless wrote:
On any G2 album choose "edit album" and pick the "Album Basics" tab

Hmm...the wording around that ("Edit Album", "Album basics") is not that intuitive...but I'm sure that'll get fixed at some point. Is it possible to add a sort by name (path name/file name)?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2004-08-05 18:04

Right now you can't sort by path or file name, but we will eventually add many more sort types (it's relatively easy to do).

 
aarora

Joined: 2004-08-05
Posts: 6
Posted: Thu, 2004-08-05 18:13
bharat wrote:
Right now you can't sort by path or file name, but we will eventually add many more sort types (it's relatively easy to do).

Cool...thanks...

 
kcl

Joined: 2004-09-29
Posts: 6
Posted: Sat, 2004-10-23 14:18

Hi,

here is a patch that allows me to sort by name. I am using an similar scheme as aarora to archive my pictures.

It's seemed enough, but maybe someone could have a look at it if something else needs to be done to make it complete.

Index: modules/core/AdminCore.inc
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/core/AdminCore.inc,v
retrieving revision 1.52
diff -u -r1.52 AdminCore.inc
--- modules/core/AdminCore.inc	8 Oct 2004 01:35:36 -0000	1.52
+++ modules/core/AdminCore.inc	23 Oct 2004 14:02:53 -0000
@@ -233,6 +233,7 @@
 	  'modificationTimestamp' => $module->translate('Last Changed Date'),
 		    'description' => $module->translate('Description'),
 		       'keywords' => $module->translate('Keywords'),
+		  'pathComponent' => $module->translate('Name'),
 		      'viewCount' => $module->translate('View Count'));
 	
 	/* Set up our sort direction selection list */
Index: modules/core/ItemEditAlbum.inc
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/core/ItemEditAlbum.inc,v
retrieving revision 1.47
diff -u -r1.47 ItemEditAlbum.inc
--- modules/core/ItemEditAlbum.inc	19 Oct 2004 22:59:33 -0000	1.47
+++ modules/core/ItemEditAlbum.inc	23 Oct 2004 14:02:54 -0000
@@ -423,6 +423,7 @@
 	  'modificationTimestamp' => $module->translate('Last Changed Date'),
 		    'description' => $module->translate('Description'),
 		       'keywords' => $module->translate('Keywords'),
+		  'pathComponent' => $module->translate('Name'),
 		      'viewCount' => $module->translate('View Count'));
 
 	/* Set up our sort direction selection list */
Index: modules/core/classes/helpers/GalleryChildEntityHelper_simple.class
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/core/classes/helpers/GalleryChildEntityHelper_simple.class,v
retrieving revision 1.12
diff -u -r1.12 GalleryChildEntityHelper_simple.class
--- modules/core/classes/helpers/GalleryChildEntityHelper_simple.class	8 Oct 2004 01:35:37 -0000	1.12
+++ modules/core/classes/helpers/GalleryChildEntityHelper_simple.class	23 Oct 2004 14:02:56 -0000
@@ -471,6 +471,11 @@
 	    $condition = '[GalleryItem::id] = [GalleryChildEntity::id]';
 	    break;
 
+	case 'pathComponent':
+	    $orderColumn = '[GalleryFileSystemEntity::pathComponent]';
+	    $condition = '[GalleryFileSystemEntity::id] = [GalleryChildEntity::id]';
+	    break;
+
 	case 'viewCount':
 	    $orderColumn = '[GalleryItemAttributesMap::viewCount]';
 	    $condition = '[GalleryItemAttributesMap::itemId] = [GalleryChildEntity::id]';
 
kcl

Joined: 2004-09-29
Posts: 6
Posted: Wed, 2004-10-27 18:12

I updated the patch for the current cvs head. It would be nice if this could be integrated.

Thanks!

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2004-10-27 19:54

I applied this patch to the core code. Good work, kcl .. thanks!