Werner Fabian writes:
I posted a problem that I am having with the dtml-tree tag in the zope@zope.org -list and in the "Zope-Forum", unluckily without getting an y replies. Please stay on the list! ...
In the root folder there is a dtml-method called "show-tree" which does essentially this:
<dtml-tree expr="REQUEST.PARENTS[uplevel]" skip_unauthorized=1 branches_expr="objectValues(['Folder','File','DTML Method','DTML Document'])">
<a href="<dtml-var absolute_url>"> <dtml-var title_or_id> </a>
</dtml-tree>
This method is called from the "start folder" in essentially the followin g way (index, e.g.):
<dtml-var standard_html_header>
<dtml-unless uplevel> <dtml-call "REQUEST.set('uplevel' , 0)"></dtml-u nless>
<dtml-call "REQUEST.set('uplevel', _.int(uplevel))"> <dtml-call "REQUEST.set('uplevelp', uplevel+1)">
<a href="<dtml-var URL0>?uplevel=<dtml-var uplevelp>">Up</a> <dtml-var show_tree>
<dtml-var standard_html_footer>
This works OK. However, if - after having pushed up the tree-root by some levels - I wan t to expand or collapse one of the branches by using the +/- - icons, the tree is displayed with "start folder" as tree-root again, instead of the folder w here I tried to expand/collapse the branch.
How do I avoid this? I am almost sure that *I* replied to your question in the list!
Your problem is that the links for "expand/collapse" do not contain your "uplevel". Someone invented the "urlparam" attribute, but he did not think enough. In almost all cases, the parameter to extend the "expand/collapse" URL is not constant but an expression (as in your case). Your options: * search for the "urlparam_expr" patch someone donated to fix precisely this bad design. Unfortunately, the patch did not make it in the Zope core. * use a cookie to pass your "uplevel" around This is not nice but you need not to patch Zope code. It is this, what I do in my DocFinder product (for a similar purpose to yours). Dieter