Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Re-indexing of Albums / Categories (or Admin Tools alphabetical sorting).  (Read 11749 times)

0 Members and 1 Guest are viewing this topic.

JasonB

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 37
    • The Big Squiff

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.
Logged

RatKing

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
    • Personal website

Ok, here is the quick and dirty solution.

In albmgr.php look for the following code:
Code: [Select]
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:
Code: [Select]
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.
Logged

JasonB

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 37
    • The Big Squiff

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.)
Logged

RatKing

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
    • Personal website

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.  ;)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de

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

RatKing

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
    • Personal website

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...
Logged

RatKing

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
    • Personal website

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...
Logged

treehstn

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
Sorting albums & categories in Admin Tools
« Reply #7 on: August 02, 2008, 11:17:15 pm »

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

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Sorting albums & categories in Admin Tools
« Reply #8 on: August 03, 2008, 11:44:32 am »

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.
Logged

boysmakesh.com

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Re-indexing of Albums / Categories (or Admin Tools alphabetical sorting).
« Reply #9 on: November 15, 2008, 02:45:34 am »

Ok, here is the quick and dirty solution.

In albmgr.php look for the following code:
Code: [Select]
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:
Code: [Select]
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?

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.