[Zope] Navigation with index_html

Egon Frerich e.frerich@nord-com.net
Sun, 24 Feb 2002 10:31:52 +0100


Hello,
I'm looking for a better solution and ask the list for some advice.

What I want to do:
I want to show the content of a folder in a structure.
- group1
     + document/folder abc
     + document/folder bcd
     + document/folder cde
- group2
     + document/folder aaa
     + document/folder bbb
     + document/folder ccc
- group3
...
The titles of the documents and folder should be ordered.

What I have done:
Every document and every folder has got a property (in german: 
"Anzeigetyp") with a group id (in german: "Anzeigen", "Anlegen", 
etc). My code follows:
  <ul>
    <li>Statusanzeige</li> ### This is the group name for the group 
id 'Anzeigen'
       <ul>
         <dtml-in expr="objectValues(('Folder', 'DTML Document'))" 
sort=title_or_id>
            <dtml-let Inhalt=sequence-item>
            <dtml-if expr="hasProperty('Anzeigetyp')">
               <dtml-if expr="Anzeigetyp == 'Anzeigen'">
                  <li><a href="&dtml-absolute_url;">
                      <dtml-var title_or_id></a><br></li>
               </dtml-if>
            </dtml-if>
            </dtml-let>
         </dtml-in>
       </ul>
    <li>Anlegen</li>
       <ul>
         <dtml-in expr="objectValues(('Folder', 'DTML Document'))" 
sort=title_or_id>
            <dtml-let Inhalt=sequence-item>
            <dtml-if expr="hasProperty('Anzeigetyp')">
               <dtml-if expr="Anzeigetyp == 'Anlegen'">
                  <li><a href="&dtml-absolute_url;">
                     <dtml-var title_or_id></a><br></li>
               </dtml-if>
            </dtml-if>
            </dtml-let>
         </dtml-in>
       </ul>
    <li>Bearbeitung</li>
       <ul>
         <dtml-in expr="objectValues(('Folder', 'DTML Document'))" 
sort=title_or_id>
            <dtml-let Inhalt=sequence-item>
            <dtml-if expr="hasProperty('Anzeigetyp')">
               <dtml-if expr="Anzeigetyp == 'Bearbeiten'">
                  <li><a href="&dtml-absolute_url;">
                      <dtml-var title_or_id></a><br></li>
               </dtml-if>
            </dtml-if>
            </dtml-let>
         </dtml-in>
       </ul>
    <li>Sonstiges</li>
       <ul>
         <dtml-in expr="objectValues(('Folder', 'DTML Document'))" 
sort=title_or_id>
            <dtml-let Inhalt=sequence-item>
            <dtml-if expr="hasProperty('Anzeigetyp')">
               <dtml-if expr="Anzeigetyp <> 'Anzeigen'
                        and   Anzeigetyp <> 'Anlegen'
                        and   Anzeigetyp <> 'Bearbeiten'">
                  <li><a href="&dtml-absolute_url;">
                      <dtml-var title_or_id></a><br></li>
               </dtml-if>
            <dtml-else>
                  <li><a href="&dtml-absolute_url;">
                      <dtml-var title_or_id></a><br></li>
            </dtml-if>
            </dtml-let>
         </dtml-in>
       </ul>
  </ul>
 
This is a very time consuming solution because for every group 
there is a loop. (And I've the suspicion Zope not only gets the titles 
from the objects but executes the objects in some way). So I ask 
me if there is the possibility to order the objects into groups 
according to the property and within the property according to the 
title. With this ordering and only one loop Zope should give the 
results quicker.

Thanks,

Egon Frerich