[ansel] Patch for setting order on image upload

Heath S. Hendrickson heath at outerspaceconsultants.com
Tue May 11 11:50:13 PDT 2004


Attached is a small patch to lib/Gallery.php that does two things:

1) stores the current time() in the 'date-uploaded' attribute for future 
use (like a page of the last X images uploaded).  I did notice that a 
'date-created' attribute was being set in the Gallery.php code, but I 
haven't traced it through to know if that's reliable for uploaded time 
or if anything else might change that value... if it's reliable, then 
just remove this part of the patch (3 lines)

2) set's the datatree_order for an uploaded image to be the num-images 
for the gallery (placing it at the end of 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	11 May 2004 18:43:05 -0000
@@ -292,6 +292,12 @@
         // Update the modified flag.
         $this->data['last-modified'] = time();
 
+        // Set the upload date the  flag.
+        $this->data['date-uploaded'] = time();
+
+        // Set the order 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