Re-indexing of Albums / Categories (or Admin Tools alphabetical sorting). Re-indexing of Albums / Categories (or Admin Tools alphabetical sorting).
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Re-indexing of Albums / Categories (or Admin Tools alphabetical sorting).

Started by JasonB, July 17, 2005, 04:44:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JasonB

This is a bit of a problem.  When you use the Admin Tools to perform a function on an album, you get the list presented to you in the order in which the albums / categories were created in the database, not in an alphabetical order.  Even in the new 1.4.1 beta, if you tell it to alphabetically sort albums and categories, it only does so in the display of the albums and the presentation of the Category Manager.  If you use the Admin Tools utility, despite all alphabetical sorting, you get everything presented to you in database creation order.  The larger your gallery, the harder it is to locate the album you want to deal with.

It would be very useful if there were a "reindex" function, so that the order of albums / categories could be maintaiined in the database in the same physical order as it is logically - or, probably even simpler, just have the list of albums in Admin Tools sorted alphabetically as it is in the Batch Add Files function when you go to select an album.

RatKing

Ok, here is the quick and dirty solution.

In albmgr.php look for the following code:
if (GALLERY_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $cat ORDER BY pos ASC");
} elseif (USER_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (USER_ID + FIRST_USER_CAT) . " ORDER BY pos ASC");


Replace with:
if (GALLERY_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $cat ORDER BY title ASC");
} elseif (USER_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (USER_ID + FIRST_USER_CAT) . " ORDER BY title ASC");


Ugly dirty bad all round but I didn't feel like making a full fletched mod for this one as it is to minor and will most likely only be set once in an admins life time anyway.

JasonB

Excellent.  Thank you!

(I still think that something like this should make it into the default code, but I'm happy with this for now.)

RatKing

I think if the option is in the beta it will make it in the main stream code in the very next release. The fact that it is not working is just what the beta is meant for to find those kinds of bugs and kill them before a release is done.  ;)

Joachim Müller

FrogFoot's advanced album sorting mod needs to be applied to the album dropdown in util.php as well. Volunteers welcome.

RatKing

GauGau - Drop me a IM with some more information on what exactly you mean by that and I should be able to make that work in a few days...

RatKing

GauGau - Drop me a IM with some more information on what exactly you mean by that and I should be able to make that work in a few days...

treehstn

I've been searching for most of the day in the forum trying to figure out if there is anything new about the issue originally discussed in the following thread.  I've searched in index.php, admin.php, albmgr.php for any references to sorting that I could update to "title" and no changes that I've made seem to work.  I haven't found any mods/hacks that work for 1.4.18.

http://forum.coppermine-gallery.net/index.php/topic,19911.0.html


Joachim Müller

I already posted in that thread what needs to be done. Since nobody replied there, reporting that he did what needs to be done, it has probably never been accomplished, so you have to live with what you have right now.
Merged.

boysmakesh.com

Quote from: RatKing on July 22, 2005, 04:11:18 PM
Ok, here is the quick and dirty solution.

In albmgr.php look for the following code:
if (GALLERY_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $cat ORDER BY pos ASC");
} elseif (USER_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (USER_ID + FIRST_USER_CAT) . " ORDER BY pos ASC");


Replace with:
if (GALLERY_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $cat ORDER BY title ASC");
} elseif (USER_ADMIN_MODE) {
    $result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (USER_ID + FIRST_USER_CAT) . " ORDER BY title ASC");


Ugly dirty bad all round but I didn't feel like making a full fletched mod for this one as it is to minor and will most likely only be set once in an admins life time anyway.


when i used this code i get error and my album manager never displayed.i compared with my original file and i found that
$result = cpg_db_query("SELECT ..... instead of wat u gave
$result = db_query("SELECT ......


Whether this change is related to database?or this due to the version of cpg?


Joachim Müller