[ansel] datatree_order and datatree_parents questions

Heath S. Hendrickson heath at outerspaceconsultants.com
Mon May 10 19:31:08 PDT 2004


I'm revisiting my reordering pages, in an attempt to make it better 
implemented and to allow for single image reordering.

I'm hoping someone can point me in the right direction for making the 
changes to write the datatree order when an image is added to a 
gallery.   As I see it, there are two options:

1) Add the image to the start of the gallery
    Actually, this like the easiest to implement as the datatree 
function reorder() will take care of the incrementing of all the 
existing images order value automatically.  I'll just have to make some 
tweaks to the delete function to make sure that we don't leave any gaps 
when an image is deleted (and this may not be necessary, but I haven't 
looked yet).

2) Add the image to the end of the gallery
    This is the trickier one as I'll have to determine the present max 
value of datatree_order for all images in the gallery.  Is there an easy 
way to do this with existing functions, or do I just code up a new 
datatree function to do it?  I'd rather not grab all images for a 
gallery just to determine this value as that would have a performance 
impact on the upload process. I'm planning on using "SELECT 
MAX(datatree_order) FROM horde_datatree WHERE ... and then I realized 
that I'd have to do some joining on tables as the images in the 
horde_datatree table don't have the parent gallery indicated in the 
datatree_parents field...I also noticed that the datatree_parents field 
contains the full tree position for the given object

    1   Gallery 1
    2    -- sub-gallery 2               :1
    3    -- -- sub-sub gallery 3       :1:2
    ...

Can someone provide a little background on why the full lineage is 
stored and not just the direct ascendant?  If it were only the direct 
parent, then it would make a number of things simpler, not the least of 
which are the image ordering issue I'm working on as well as the gallery 
and image move functions.

h




More information about the ansel mailing list