[Zope] well-behaved dtml-tree tag without frames

Andreas Leitner nozone@sbox.tugraz.at
21 Jan 2002 13:25:11 +0100


Hi,

I would like to build an interface similar to zopes management
interface, but without using frames.

I have played around with dtml-tree tag now for some time, but it always
behaves weird in some cases. 

Let's say my ZOPE tree looks like this

(every object where no type is given in braces is a folder)

/
/show_tree
/index_html
/visible_tree
/visible_tree/A
/visible_tree/A/foo (method)
/visible_tree/A/bar (method)
/visible_tree/B/
/visible_tree/B/C
/visible_tree/B/C/one (method)
/visible_tree/B/C/two (method)
/visible_tree/C


index_html is some default page.
show_tree contains a dtml-tree tag (see below) that renders folders and
methods of /visible_tree.
Now index_html, foo, bar, one and two all include a <dtml-var show_tree>
tag. On every page the user should see the same navigation tree.
(Objects might be expanded or not though)

Now this is how my /show_tree looks like:
--
<dtml-tree id="/show_tree" skip_unauthorized expr="/visible_tree"
branches="objectValues">
<a href="<dtml-var absolute_url>">
	<dtml-var title_or_id>
</a>
</dtml-tree>
--

Now, this tree should behave exactly like the tree in the zope
management interface, but it does not. It changes it's state (open and
closed branches) seemingly randomly. I believe this is because the state
of the tree-tag is stored at the current object and not at a global spot
(which is what I would want).

The Zope book tells me:
--
id=string
The name of a method or id to determine tree state. It defaults to tpId
which most Zope objects support. This attribute is for advanced usage
only.
--

Now this seems to do what I want, but I am not sure I understand the
paragraph correctly. Is this id used as a key to store the state in some
global DB, or does the id need to return some kind of tree-status
object. In what context will the id be applied?

The book "Zope - web application construction kit" tells me something
different about id (of dtml-tree):
--
ID
The name of an attribute or a method that is used to set the ID of an
object. The default method is tpId.
The attribute should be applied by advanced users only.
-- 

Now this paragraph seems to express that "id" is not corresponding to
the dtml-tree tag itself, but to it's nodes ??!!!!

And what the heck is tpId tpURL and where can I buy one? Docs say most
objects implement it, but if I type /visible_tree/A/foo/tpId or
/visible_tree/A/foo/tpURL I just get error messages back.


Please help me out on this one, it's been a real nightmare thus far.

tia,
Andreas