comparison MPIWGHelper.py @ 191:90d44df497a6

updated breadcrumb handling, works for members now.
author casties
date Wed, 19 Jun 2013 11:52:48 +0200
parents 47392bf3fcba
children 938add25f81b
comparison
equal deleted inserted replaced
190:9a09156eee7c 191:90d44df497a6
100 # 100 #
101 # navigation methods (should better be a mixin class) 101 # navigation methods (should better be a mixin class)
102 # 102 #
103 def getBreadcrumbs(self): 103 def getBreadcrumbs(self):
104 """return list of breadcrumbs from here to the root""" 104 """return list of breadcrumbs from here to the root"""
105 crumbs = [(self.title, self.absolute_url(), self)] 105 #logging.debug("getBreadcrumbs of %s"%repr(self))
106 crumbs = [{'text':self.title, 'url':self.absolute_url(), 'object':self}]
106 parent = self.aq_parent 107 parent = self.aq_parent
107 if hasattr(parent, 'getBreadcrumbs'): 108 if hasattr(parent, 'getBreadcrumbs'):
108 if self.title: 109 if self.title:
109 return parent.getBreadcrumbs() + crumbs 110 return parent.getBreadcrumbs() + crumbs
110 else: 111 else:
116 117
117 def getSection(self, crumbs=None): 118 def getSection(self, crumbs=None):
118 """returns the current section name""" 119 """returns the current section name"""
119 # use breadcrumbs if available 120 # use breadcrumbs if available
120 if crumbs is not None and len(crumbs) > 0: 121 if crumbs is not None and len(crumbs) > 0:
121 return crumbs[0][2].getId() 122 return crumbs[0]['object'].getId()
122 123
123 p = self 124 p = self
124 sec = None 125 sec = None
125 # descend parents to the root (and remember the last id) 126 # descend parents to the root (and remember the last id)
126 while p is not None and p.meta_type != 'MPIWGRoot': 127 while p is not None and p.meta_type != 'MPIWGRoot':
131 132
132 def getSubSection(self, crumbs=None): 133 def getSubSection(self, crumbs=None):
133 """returns the current subsection name""" 134 """returns the current subsection name"""
134 # use breadcrumbs if available 135 # use breadcrumbs if available
135 if crumbs is not None and len(crumbs) > 1: 136 if crumbs is not None and len(crumbs) > 1:
136 return crumbs[1][2].getId() 137 return crumbs[1]['object'].getId()
137 138
138 p = self 139 p = self
139 sec = None 140 sec = None
140 subsec = None 141 subsec = None
141 # descend parents to the root (and remember the last id) 142 # descend parents to the root (and remember the last id)