[Zope] SubMenuTree

Stefan Mallepell Stefan Mallepell" <steve@syso.ch
Tue, 10 Apr 2001 11:16:49 +0200


Hi

It's again me. I'm sorry for that ...
Thanks a lot to this comunity of helping angels ;) Now to my new problem:
(might my description is to long, but I'm still desperate and are really
looking for some help ... the site should be online the 27 of april ... )

In my project (new release with new server [ZOPE ;-) ] of www.kisc.ch
Kandersteg International Scout Centre ) I need a vertical submenu (without
cookies - so dtml-tree isn't the right thing). I was also looking through
the product section of  www.zope.org .There are several Products which do
such things, but I couldn't find one which is suitable for me. So I tryed to
do it with DTML ... but somehow I'm stocked here too (you can find my code
at the end of this email) ...

Thanks in advance to anybody who can help!
Stefan Mallepell

*What do I need exacltly: *
A example of DTML Code to do this ... or help ... or a product which is
doing this ... *DTML Code is favorised* (I don't know python yet ...)

I will have a menu bar on the top of each page, this menu shows some icons
wich links to the main Parts (PartA, PartB, PartC ..) On one Side I would
like to have a vertical Submenu. This Submenu should be a tree structure of
the area. The layout of the structure should be organised through a Table
with details and colspan attributes.

Some Submenu examples: (SiteContainer and "Part"-Level of Pages is not
showed in Submenus!)
The Item order of one level is given by the PageMenuSequenceNo of the
PageObject, the Item itself gets its name from PageMenuItem of the
PageObject

#for PartA-Page
PageAA
PageAB
PageAC

#for PageAA
PageAA active
PageAB
PageAC

#for PageAB
PageAA
PageAB activ
  PageABA
  PageABB
  PagaABC
PageAC

#for PageABBC
PageAA
PageAB
  PageABA
  PageABB
    PageABBA
    PageABBB
    PageABBC active
    PageABBD
    PageABBE
  PagaABC
PageAC

*This is my Zope Structure: the metaTyp is in ()

/
siteContainer(kiscSite)
         index_html(DTML-Method)
         ... some other (DTML-Method)
         PartA(kiscPage)
                    .. someDtmlMethods (DTML-Method)
                    paragraph01(kiscParagraph)
                    paragraph02(kiscParagraph)
                    paragraph03(kiscParagraph)
                    paragraph04(kiscParagraph)
                    PageAA(kiscPage)
                    paragraph01(kiscParagraph)
                    ....
                    PageAB(kiscPage)
                              SubPageABA(kiscPage)
                              SubPageABB(kiscPage)
                                        SubSubPageABBA(kiscPage)
                                        SubSubPageABBB(kiscPage)
                                        SubSubPageABBC(kiscPage)

paragraph01(kiscParagraph)
                                                   .....
                                        SubSubPageABBD(kiscPage)
                                        SubSubPageABBE(kiscPage)
                              SubPageABC(kiscPage)
                    PageAC(kiscPage)
         PartB(kiscPage)
                    .. someDtmlMethods (DTML-Method)
                    PageBA(kiscPage)
                    PageBB(kiscPage)
         PartC(kiscPage)
                    .. someDtmlMethods (DTML-Method)
                    PageCA(kiscPage)
                    PageCB(kiscPage)
         PartD(kiscPage)
                    .. someDtmlMethods (DTML-Method)
                    PageDA(kiscPage)
                    PageDB(kiscPage)

Each 'kiscPage' Object can contain other 'kiscPage' Objects or
'kiscParagraph' Objects

*Properties of the Objects:
all defined in ZClass, all based on "ZObject, CatalogAwareBase,
ZObjectManager", the property typ is in ()

kiscSite:
  SiteName (string)
  SiteCopyright (string)
  SiteCredit (string)
  SiteWebmaster (string)
  SiteWebmasterEmail (string)
  SiteWwwParagraphStyle (lines)

kiscPage:
  PageTitle (string)
  PageCaption (string)
  PageAbstract (text)
  PageText (text)
  PageMenuItem (string)
  PageMenuSequenceNo (int)

kiscParagraph
  ParaCaption (string)
  ParaAbstract (text)
  ParaText (text)
  ParaSequenceNo (int)
  ParaWwwStyle (selection) (of SiteWwwwParagraphStyle - see kiscSite)

*My old code for the Menu:
<table width="90%" border="1" align="CENTER">
<dtml-let PageUrl="absolute_url()">
<!-- Menu vor Aktueller Page -->
<dtml-in PARENTS reverse>
  <dtml-if "meta_type=='kiscPage'">
    <dtml-let MaxMenuLevels=sequence-length
              LeafPageMenuSequenceNo="PageMenuSequenceNo"
              WorkingMenuLevel=sequence-index
              MaxDetails="MaxMenuLevels - 2"
              ColSpanNo="MaxDetails - (WorkingMenuLevel - 2)"
              LeadingEmptyDetails="MaxDetails - ColSpanNo">
      <dtml-in
"PARENTS[MaxMenuLevels-WorkingMenuLevel].objectValues(['kiscPage'])"
sort=PageMenuSequenceNo>
        <dtml-if expr="PageMenuSequenceNo <= LeafPageMenuSequenceNo">
          <dtml-if expr="absolute_url()==PageUrl">
<!-- Menu aktuelle Page -->
            <tr><dtml-var MakeEmptyMenuDetail>
              <td colspan="<dtml-var ColSpanNo>"><FONT SIZE="2" FACE="Arial,
Helvetica" COLOR="Black">
              <dtml-var PageMenuItem>
            </FONT></td></tr>
<!-- Menu SubPages von Aktueller Page -->
            <dtml-let ColSpanNo="ColSpanNo - 1">
              <dtml-in "objectValues(['kiscPage'])" sort=PageMenuSequenceNo>
                <tr><dtml-var MakeEmptyMenuDetail>
                  <td><FONT SIZE="2" FACE="Arial, Helvetica" COLOR="Black">
                  <a href="<dtml-var absolute_url>"><dtml-var
PageMenuItem></a>
                </FONT></td></tr>
              </dtml-in>
            </dtml-let>
          <dtml-else>
            <tr><dtml-var MakeEmptyMenuDetail>
              <td colspan="<dtml-var ColSpanNo>"><FONT SIZE="2" FACE="Arial,
Helvetica" COLOR="Black">
<!-- Menu vor aktueller Page -->
              <a href="<dtml-var absolute_url>"><dtml-var PageMenuItem></a>
            </FONT></td></tr>
          </dtml-if>
        </dtml-if>
      </dtml-in>
    </dtml-let>
  </dtml-if>
</dtml-in>
<!-- Menu nach Aktueller Page -->
<dtml-in PARENTS>
  <dtml-if "meta_type=='kiscPage'">
    <dtml-let MaxMenuLevels=sequence-length
              LeafPageMenuSequenceNo="PageMenuSequenceNo"
              WorkingMenuLevel=sequence-index
              MaxDetails="MaxMenuLevels - 2"
              ColSpanNo="WorkingMenuLevel + 1"
              LeadingEmptyDetails="MaxDetails - ColSpanNo">
      <dtml-in "PARENTS[LeafPageMenuSequenceNo].objectValues(['kiscPage'])"
sort=PageMenuSequenceNo>
        <dtml-if expr="PageMenuSequenceNo > LeafPageMenuSequenceNo">
          <tr><td><a href="<dtml-var absolute_url>"><dtml-var
PageMenuItem></a>
          </td></tr>
        </dtml-if>
      </dtml-in>
    </dtml-let>
  </dtml-if>
</dtml-in>
</dtml-let>
</table>