[Zope] How to create "Locked" folder tree?

Chip Vanek chip@upcast.com
Wed, 16 Feb 2000 16:56:17 -0800


Thanks Cornelis,

I ended up with something similar to your tip and of 
course stumbled across more problem.  Here is the code
that I will endup using as an interim to keep some
momentum going on this project.

Thanks for your help again,

Chip

If anyone is interested this is the resulting
 (very ugly and inefficient) code.

This climbs up the folder tree and creates two
lists.  One in forward order the other in reverse.
The reverse list is displayed as a navigator and
the forward list is converted to string and used
to query the catalog for items.  If anyone has
improvements ;)

<dtml-call "REQUEST.set('tkeysreverse', [])">
<dtml-call "REQUEST.set('tkeysforward', [])">
<dtml-call "REQUEST.set('Topic', '')">
<dtml-in PARENTS skip_unauthorized reverse>
  <dtml-unless sequence-start>
  <dtml-unless "id == 'PortalRoot' or id == 'Pub'">
    <span class="ItemBack">
      <dtml-with sequence-item>
        <dtml-call "tkeysreverse.insert(0, id)">
        <dtml-call "tkeysforward.append(id)">
         <a href="<dtml-var absolute_url>/showTopics">
           <dtml-var id></a>
      </dtml-with>
      <dtml-unless sequence-end>
         &nbsp;&gt;&nbsp;
      </dtml-unless>
     </span>
  </dtml-unless>
  </dtml-unless>
</dtml-in>

>-----Original Message-----
>From: Cornelis J. de Brabander [mailto:brabander@fsw.LeidenUniv.nl]
>Sent: Wednesday, February 16, 2000 12:41 AM
>To: Chip Vanek; zope@zope.org
>Subject: RE: [Zope] How to create "Locked" folder tree?
>
>
>
>
>> -----Original Message-----
>> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On 
>Behalf Of Chip
>> Vanek
>> Sent: dinsdag 15 februari 2000 22:26
>> To: zope@zope.org
>> Subject: RE: [Zope] How to create "Locked" folder tree?
>>
>>
>> Hi,
>>
>> Does anyone know how to "lock" the namespace (dtml-with or dtml-let)
>> inside dtml to ensure that the dtml-tree tag always displays the same
>> tree?
>>
>> Or alternatly what is the ideal syntax to create an dtml-if that
>> can check if the present method is below the tree tag.  I am using
>> the code below but, it only works if I am in the Pub folder not in
>> any of the children folders of Pub.
>>
>>    <dtml-if "_.getattr(PARENTS[0], 'id') == 'Pub'">
>>           <dtml-tree .......>
>>    </dtml-if>
>>
>My solution reads:
> <dtml-call "REQUEST.set('authorized', 0)">
> <dtml-in PARENTS>
>  <dtml-if "id=='Pub'">
>    <dtml-call "REQUEST.set('authorized', 1)">
>  </dtml-if>
> </dtml-in>
> <dtml-if authorized>
>  <dtml-tree ...>
> </dtml-if>
>
>cb
>
>
>