album change date shouldnt be the newer date of items in it?

nando

Joined: 2003-08-16
Posts: 8
Posted: Sun, 2003-08-31 22:51

im using gallery 1.3.3 and the thing is that the albums change date doesnt correspond with the change date of photos or albums inside it...

something like :

album 1 (change date = 15 August)
subalbum 2 (change date = 20 August)

is this corrected in gallery 1.4 ???

is there a way so my album change date is the newest change date of albums or photos inside it??

:roll:

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2003-09-01 10:17

Please read my note in:
http://gallery.sf.net/forums.php?topic=8072

It hasn't been done yet. Please submit a bug report and/or a fix and we'll get on it fairly soon.

-Beckett (

)

 
nando

Joined: 2003-08-16
Posts: 8
Posted: Tue, 2003-09-02 13:50

the thing is that i dunno much about the way gallery works, data types,etc.
i changed the function getLastModificationDate to be recursive but i got an error that i dont understand.

If you could help me do it recursive then i could start working in an iterative way of doing it (recursively it's easier for me :P )

This is the code i made:

function getLastModificationDate() {
$time = $this->getModificationDate(0,$this);
return date("M d, Y", $time);
}

function getModificationDate($newerTime,$actualAlbum) {
global $gallery;

$dir = $actualAlbum->getAlbumDir();

$time = $actualAlbum->fields["last_mod_time"];

// Older albums may not have this field.
if (!$time) {
$stat = fs_stat("$dir/album.dat");
$time = $stat[9];
}

if ($time > $newerTime){
$newerTime = $time;
}

for ($i=1; $i <= $this->numPhotos(1); $i++) {
if ($actualAlbum->isAlbumName($i)) {
$albumTemp = new Album();
$albumTemp->load($actualAlbum->isAlbumName($i));
$time = $actualAlbum->getModificationDate($newerTime,$albumTemp);
if ($time > $newerTime){
$newerTime = $time;
}
}
}
return $newerTime;
}

The first function is because i didnt want to have to modify all the files that call getLastModificationDate.

The second function is the recursive.

and the error is:

Last changed on ERROR: requested index [10] out of bounds [9]ERROR: requested index [11] out of bounds [9]ERROR: requested index [12] out of bounds [9]ERROR: requested index [13] out of bounds [9]ERROR: requested index [14] out of bounds [9]ERROR: requested index [10] out of bounds [9]ERROR: requested index [11] out of bounds [9]ERROR: requested index [12] out of bounds [9]ERROR: requested index [13] out of bounds [9]ERROR: requested index [14] out of bounds [9]ERROR: requested index [5] out of bounds [4]ERROR: requested index [6] out of bounds [4]ERROR: requested index [7] out of bounds [4]ERROR: requested index [8] out of bounds [4]ERROR: requested index [9] out of bounds [4]ERROR: requested index [10] out of bounds [4]ERROR: requested index [11] out of bounds [4] (...)

i think that is one error for each subalbum. and that repeats for every root album on my gallery

Actually i dont know much about the Album Object and which Object should i use to make the recursive call.

it would be nice if somebody could explain what's happening or help me or something :roll: :wink:

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Wed, 2003-09-03 16:40

Okay. I don't have time to debug this now.

The concept behind this fix would be to, after modifying the album date, to call $album->save(TRUE) recursively on each parent album. Lemme throw together some code. This would go wherever the save() function is called for whatever you're looking at (again, sorry, no time to look at your code right now).

$albumDB = new AlbumDB(FALSE);
$album = $albumDB->getAlbumByName($gallery->session->albumName, FALSE); /* current album */
while (!$album->isRoot()) {
   $album->save(TRUE); /* reset mod date */
   $root = $album->getRootAlbumName(); /* get parent */
   $album = $albumDB->getAlbumByName($root, FALSE);
}

Okay... I haven't really looked at your code. Not all of this might be necessary, but that's the general idea.

Play a bit, then come back with questions.

-Beckett (

)

 
nando

Joined: 2003-08-16
Posts: 8
Posted: Fri, 2003-09-26 12:22

mmm... i dont have much time to do it, but i'll try...

wouldn't be better to change the function save (with that code) instead of copying that every time the funciton save() is called ???