Logo Search packages:      
Sourcecode: zope-cmfplone version File versions

def zope-cmfplone-2.0.4::StatelessTreeNav::StatelessTreeBuilder::buildMenuStructure (   self  ) 

builds a menu structure :) 

Definition at line 147 of file StatelessTreeNav.py.

00147                                  :
        """ builds a menu structure :) """
        res=[]
        itemcount=0
        path=self.getParentObjects()

        count=0
        p=None

        for p in path:
            r={'object':p,'level':None,'siblings':[],'title':p.title_or_id(),'url':p.absolute_url()}

            try:
                r['level']=self.getLevel(p)
            except ConflictError:
                raise
            except:
                pass

            if self.listSiblings == 1:
                r['siblings']=self.getChildObjects(p.aq_parent,self.showFolderishSiblingsOnly)
                r['siblingtitles']=map(lambda x:x.title_or_id(),r['siblings'])

            if p not in r['siblings'] and (p.isPrincipiaFolderish or not self.showFolderishSiblingsOnly) and (p != path[0] or self.includeTop):
                r['siblings'].append(p)

            res.append(r)
            itemcount=itemcount+1

            if len(r['siblings']):
                itemcount=itemcount+len(r['siblings'])-1

            count=count+1

        if p:
            o=self.object
            level=r['level']+1
        else:
            o=self.object
            level=self.getLevel(self.object)+1

        addItself=None

        if not o.isPrincipiaFolderish:
            if self.showFolderishChildrenOnly and self.showNonFolderishObject:
                addItself=o

            o=o.aq_parent

        siblings=self.getChildObjects(o,folderishOnly=self.showFolderishChildrenOnly)
        if addItself:
            siblings.append(addItself)

        res.append({'object':None,'siblings':siblings,'level':level,'siblingtitles':map(lambda x:x.title_or_id(),siblings)})
        itemcount=itemcount+len(siblings)

        return res,itemcount


    security.declarePublic('buildFlatMenuStructure')
    def buildFlatMenuStructure (self, batchSize=65535, batchStart=None ):


Generated by  Doxygen 1.6.0   Back to index