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: showAlbumsUpdatedOverLastDays has different sort order than lastalb  (Read 5164 times)

0 Members and 1 Guest are viewing this topic.

jerx

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 85

You can show the last updated albums in coppermine by putting lastalb into the breadcrump. It displays the recent added albums sorted according to creation date.
The showAlbumsUpdatedOverLastDays function of cpmfetch shows recent added albums, too, but they are sorted in alphabetical order.

In my opinion the sort order of coppermine is better, because it is much easier to keep track of new albums. The first album is the most recent and the last album is the oldest of the recent albums. This might be not important for one time users, but regular visitors will benefit. They won' t have to read the whole list in order to determine which albums have not been visited yet.

Is it difficult to change the sort order of that function?
« Last Edit: January 26, 2007, 06:34:38 am by vuud »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: showAlbumsUpdatedOverLastDays has different sort order than lastalb
« Reply #1 on: January 26, 2007, 12:53:13 am »

You can show the last updated albums in coppermine by putting lastalb into the breadcrump. It displays the recent added albums sorted according to creation date.
The showAlbumsUpdatedOverLastDays function of cpmfetch shows recent added albums, too, but they are sorted in alphabetical order.

In my opinion the sort order of coppermine is better, because it is much easier to keep track of new albums. The first album is the most recent and the last album is the oldest of the recent albums. This might be not important for one time users, but regular visitors will benefit. They won' t have to read the whole list in order to determine which albums have not been visited yet.

Is it difficult to change the sort order of that function?

That function is one of the first I added into cpmfetch, and is showing its age.  I've put off working on it because I am planning a rewrite of the output mechanism to support CSS or HTML or TEXT, etc...  And that function does some html.

Anyway,  I agree 100% with your comments and opinions on this...  I've just never thought about it or considered it until you brought it up.

That function uses getMediaAdded since in the cpmfetch_dao.php file... this one groups by category id, then album id, then sorts by category name and then picture mtime.

Hmmm, I am gonna have to run some queries to envision this...

But I agree that the output order should be by last added photo



Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

jerx

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 85
Re: showAlbumsUpdatedOverLastDays has different sort order than lastalb
« Reply #2 on: January 26, 2007, 05:18:26 am »

Your explanations helped a lot. Thank you! I think I have solved it.

The original function in cpmfetch_dao.php looks like this:
Code: [Select]
function getMediaAddedSince ($timestamp) {
$retval = "";
if (is_numeric($timestamp)) {
$sqlcode = 'SELECT ' . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
// . " WHERE p.aid = a.aid AND a.category = c.cid "
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' $this->privacyfilter AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY c.name, p.mtime';

$retval = $this->dbExecuteSql($sqlcode);
}

return($this->covertResultsetToArray($retval));
}

I changed it to:
Code: [Select]
function getMediaAddedSince ($timestamp) {
$retval = "";
if (is_numeric($timestamp)) {
$sqlcode = 'SELECT ' . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
// . " WHERE p.aid = a.aid AND a.category = c.cid "
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' $this->privacyfilter AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY p.ctime DESC';

$retval = $this->dbExecuteSql($sqlcode);
}

return($this->covertResultsetToArray($retval));
}

This groups the pictures by album id and then sorts by picture creation time, at least I think so. It seems to work. My albums are listed the same order I created them.

What I do not understand is, that the pictures are grouped by category first. I think if you only group by album id, you get the same results. Or does this speed up ordering and sorting?
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: showAlbumsUpdatedOverLastDays has different sort order than lastalb
« Reply #3 on: January 26, 2007, 05:36:39 am »

This groups the pictures by album id and then sorts by picture creation time, at least I think so. It seems to work. My albums are listed the same order I created them.

What I do not understand is, that the pictures are grouped by category first. I think if you only group by album id, you get the same results. Or does this speed up ordering and sorting?

It could be that another function is using this call...  I am not sure, perhaps the categories updated...

Its been awhile and its probably due for a rewrite anyway.

So you all set then?


Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

jerx

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 85
Re: showAlbumsUpdatedOverLastDays has different sort order than lastalb
« Reply #4 on: January 26, 2007, 05:47:53 am »

Yes, everything is fine now. This can be marked as solved. Thanks for your help!
Logged
Pages: [1]   Go Up
 

Page created in 0.036 seconds with 20 queries.