[ansel] Patch for setting order on image upload

Heath S. Hendrickson heath at outerspaceconsultants.com
Thu May 13 18:58:18 PDT 2004


Ben Chavet wrote:

>
> Then you put it in the wrong place.
>
Ah, now I see what you mean.  It's not so much in the wrong place as the 
call is wrong.  I put the modifications in the addImage() function, 
which is called when an image is added to a gallery.  I just didn't 
realize that $this->data[] was setting values on the gallery and not the 
image (the setOrder() call worked, which added to my confusion).

> The 'date-created' attribute is only set once...when the gallery is 
> created.
>
> I think you've got the right idea, but you are trying to store the 
> information
> in the wrong place.  This information should be stored by the images, 
> not the
> galleries.

Yup, attached is a patch that uses the correct call to set the value in 
the *image* data and not the gallery.

h
-------------- next part --------------
Index: lib/Gallery.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/lib/Gallery.php,v
retrieving revision 1.58
diff -u -r1.58 Gallery.php
--- lib/Gallery.php	10 May 2004 03:26:48 -0000	1.58
+++ lib/Gallery.php	14 May 2004 01:32:01 -0000
@@ -292,6 +300,12 @@
         // Update the modified flag.
         $this->data['last-modified'] = time();
 
+        // Set the upload date flag.
+        $imageOb->set('date-uploaded', time(), true);
+
+        // Set the order for the image to the end of the gallery.
+        $this->setOrder($imageOb->getId(), $this->data['num-images']);
+
         // Store changes to the gallery.
         $this->update();
 


More information about the ansel mailing list