[ansel] datatree_order and datatree_parents questions
Heath S. Hendrickson
heath at outerspaceconsultants.com
Tue May 11 09:18:41 PDT 2004
Chuck Hagenbuch wrote:
> Quoting "Heath S. Hendrickson" <heath at outerspaceconsultants.com>:
>
>> 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).
>
>
> reorder() actually will now refuse to work on objects without parents,
> so this
> won't work.
>
And I kept looking at that trying to figure out what that bit of code
was doing... I read the comment about top-level and didn't think about
it again.
>> 2) Add the image to the end of the gallery
>
>
> I'd prefer this one. You have the number of images in the gallery -
> any reason
> you can't set the new order to numImages + 1?
>
Doh! I was sitting here trying to think up some cleaver way of doing
this and didn't even think of the obvious.
>> 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.
>
>
> It'd also necessitate a lot of recursion to traverse the tree. Right
> now you can
> get a full tree, no matter the depth, with a constant number of
> queries. This
> won't be changing.
>
Fair enough. Coming into this late in the game, I'm just trying to
understand as much as I can about why things are done the way they are.
So to move a gallery, you'd just have to get the lineage of where you
want it to go and make that the datatree_parent of the gallery, right?
I know that there is move() function in the datatree driver, does that
move the object and any children?
h
More information about the ansel
mailing list