Dead brain with ZTUtils TreeMaker/SimpleTreeMaker
Hi, I didn't find any documentation about ZTUtils TreeMaker/SimpleTreeMaker classes. There's not the shadow of a doc about this in the Zope help, in zope.org, even in google. Only Batch is documented. So I've tried to hack the ZTUtils package and understood some of its features (like LazyFilter, make_query, make_hidden_input and some others) but I'm stuck understanding how to play with TreeMaker, SimpleTreeMaker, SimpleTreenode and related feature. And of course stuck integrating those in templates. Any pointer to docs and examples somewhere ? Mant thanks in advance. -- Gilles
Gilles Lenfant wrote:
Any pointer to docs and examples somewhere ?
Copy zpt_examples.zexp from Products/PageTemplates/examples/ to your import/ directory and import it. Among the sample code in it is an implementation of the ZMI Folder tree using TreeMaker. I wrote TreeMaker as a basic tool for dtml-tree-like operations, but never really polished or documented it once I had the fundamentals working. TreeMaker is meant to work as follows: 1. Create a TreeMaker instance. 2. Specify how your object tree is defined. For example, use setChildAccess to indicate that each of your objects has a 'kids' attribute that contains a list of children, and setIdAttr to indicate that each object's 'path' attribute should be used to identify it. 3. Pass your root object to the tree() method. The result is a tree of TreeNode objects. The 'expanded' argument of tree() controls how much of this tree is built. 4. Use the TreeNode's walk() method to apply a function to the tree, such as one that produces an HTML representation. The flat() method gives you a preorder list of the objects in the tree, which can be combined with encodeExpansion to save the state of the tree. SimpleTreeMaker adds a branch() method to nodes that makes it easier to generate a tree of link from a ZPT. Cheers, Evan @ 4-am
Gilles Lenfant wrote at 2003-11-12 15:29 +0100:
I didn't find any documentation about ZTUtils TreeMaker/SimpleTreeMaker classes. There's not the shadow of a doc about this in the Zope help, in zope.org, even in google. Only Batch is documented.
So I've tried to hack the ZTUtils package and understood some of its features (like LazyFilter, make_query, make_hidden_input and some others) but I'm stuck understanding how to play with TreeMaker, SimpleTreeMaker, SimpleTreenode and related feature. And of course stuck integrating those in templates.
Any pointer to docs and examples somewhere ?
Look into ".../Products/PageTemplates/examples". Be warned: we found several bugs in the tree building code. I think, I reported them to the collector. -- Dieter
participants (3)
-
Dieter Maurer -
Evan Simpson -
Gilles Lenfant