Re: yadtp (yet another dtml-tree problem)
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
On Friday 02 August 2002 21:18, you wrote:
Werner Fabian writes:
I posted a problem that I am having with the dtml-tree tag ... ... 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 ... ... * 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).
Thank You very much for Your advice, I'll try that. Do You know the NFGnav-Tool, mentioned in the book "Zope ..." by Brockmann et al. (SAMS)? Might this be an alternative to the tree-tag or does it contain the same bug? Thanks, Werner
Werner Fabian writes:
... Do You know the NFGnav-Tool, mentioned in the book "Zope ..." by Brockman n et al. (SAMS)? Might this be an alternative to the tree-tag or does it conta in the same bug? I do not know "NFGnav-Tool".
I do not think the missing "urlparam_expr" is a bug in "dtml-tree" but a (sadly) missing feature. Dieter
Hi Dieter,
* 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).
I found the two lines of code in Your DocFinder that were the remedy to my problem. Maybe this will cure me of my cookie-phobia. Thanks a lot! Werner
participants (2)
-
Dieter Maurer -
Werner.Fabian@t-online.de