Re: Patch for setting order on image upload

"Heath S. Hendrickson" <[email protected]>
Newsgroups gmane.comp.horde.ansel
Message-ID <[email protected]>
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

-- 
ansel mailing list - Join the hunt: http://horde.org/bounties/#ansel
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
Gallery.php.patch_setOrderOnUpload2 (text/plain, 712 B)
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();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.