Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.browser.navtree.SitemapNavtreeStrategy Class Reference
Inheritance diagram for CMFPlone.browser.navtree.SitemapNavtreeStrategy:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.browser.navtree.SitemapNavtreeStrategy:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def nodeFilter
def subtreeFilter
def decoratorFactory
def showChildrenOf

Public Attributes

 context
 portal
 excludedIds
 parentTypesNQ
 viewActionTypes
 showAllParents
 rootPath
 memberId

Detailed Description

The navtree building strategy used by the sitemap, based on
navtree_properties

Definition at line 106 of file navtree.py.


Constructor & Destructor Documentation

def CMFPlone.browser.navtree.SitemapNavtreeStrategy.__init__ (   self,
  context,
  view = None 
)

Reimplemented in CMFPlone.browser.navtree.DefaultNavtreeStrategy.

Definition at line 113 of file navtree.py.

00113 
00114     def __init__(self, context, view=None):
00115         self.context = context
00116         
00117         portal_url = getToolByName(context, 'portal_url')
00118         self.portal = portal_url.getPortalObject()
00119         portal_properties = getToolByName(context, 'portal_properties')
00120         navtree_properties = getattr(portal_properties, 'navtree_properties')
00121         site_properties = getattr(portal_properties, 'site_properties')
00122         self.excludedIds = {}
00123         for id in navtree_properties.getProperty('idsNotToList', ()):
00124             self.excludedIds[id] = True
00125         self.parentTypesNQ = navtree_properties.getProperty('parentMetaTypesNotToQuery', ())
00126         self.viewActionTypes = site_properties.getProperty('typesUseViewActionInListings', ())
00127 
00128         self.showAllParents = navtree_properties.getProperty('showAllParents', True)
00129         self.rootPath = getNavigationRoot(context)
00130 
00131         membership = getToolByName(context, 'portal_membership')
00132         self.memberId = membership.getAuthenticatedMember().getId()


Member Function Documentation

Reimplemented from plone.app.layout.navigation.navtree.NavtreeStrategyBase.

Definition at line 149 of file navtree.py.

00149 
00150     def decoratorFactory(self, node):
00151         context = aq_inner(self.context)
00152         request = context.REQUEST
00153         
00154         newNode = node.copy()
00155         item = node['item']
00156 
00157         portalType = getattr(item, 'portal_type', None)
00158         itemUrl = item.getURL()
00159         if portalType is not None and portalType in self.viewActionTypes:
00160             itemUrl += '/view'
00161 
00162         isFolderish = getattr(item, 'is_folderish', None)
00163         showChildren = False
00164         if isFolderish and (portalType is None or portalType not in self.parentTypesNQ):
00165             showChildren = True
00166 
00167         ploneview = getMultiAdapter((context, request), name=u'plone')
00168 
00169         newNode['Title'] = utils.pretty_title_or_id(context, item)
00170         newNode['absolute_url'] = itemUrl
00171         newNode['getURL'] = itemUrl
00172         newNode['path'] = item.getPath()
00173         newNode['icon'] = getattr(item, 'getIcon', None) # Deprecated, use item_icon
00174         newNode['item_icon'] = ploneview.getIcon(item)
00175         newNode['Creator'] = getattr(item, 'Creator', None)
00176         newNode['creation_date'] = getattr(item, 'CreationDate', None)
00177         newNode['portal_type'] = portalType
00178         newNode['review_state'] = getattr(item, 'review_state', None)
00179         newNode['Description'] = getattr(item, 'Description', None)
00180         newNode['getRemoteUrl'] = getattr(item, 'getRemoteUrl', None)
00181         newNode['show_children'] = showChildren
00182         newNode['no_display'] = False # We sort this out with the nodeFilter
00183         newNode['link_remote'] = newNode['getRemoteUrl'] and newNode['Creator'] != self.memberId
00184 
00185         idnormalizer = queryUtility(IIDNormalizer)
00186         newNode['normalized_portal_type'] = idnormalizer.normalize(portalType)
00187         newNode['normalized_review_state'] = idnormalizer.normalize(newNode['review_state'])
00188 
00189         return newNode
        

Reimplemented from plone.app.layout.navigation.navtree.NavtreeStrategyBase.

Definition at line 133 of file navtree.py.

00133 
00134     def nodeFilter(self, node):
00135         item = node['item']
00136         if getattr(item, 'getId', None) in self.excludedIds:
00137             return False
00138         elif getattr(item, 'exclude_from_nav', False):
00139             return False
00140         else:
00141             return True

Reimplemented from plone.app.layout.navigation.navtree.NavtreeStrategyBase.

Definition at line 190 of file navtree.py.

00190 
00191     def showChildrenOf(self, object):
00192         getTypeInfo = getattr(object, 'getTypeInfo', None)
00193         if getTypeInfo is not None:
00194             portal_type = getTypeInfo().getId()
00195             if portal_type in self.parentTypesNQ:
00196                 return False
00197         return True

Reimplemented from plone.app.layout.navigation.navtree.NavtreeStrategyBase.

Reimplemented in CMFPlone.browser.navtree.DefaultNavtreeStrategy.

Definition at line 142 of file navtree.py.

00142 
00143     def subtreeFilter(self, node):
00144         portalType = getattr(node['item'], 'portal_type', None)
00145         if portalType is not None and portalType in self.parentTypesNQ:
00146             return False
00147         else:
00148             return True


Member Data Documentation

Definition at line 114 of file navtree.py.

Definition at line 121 of file navtree.py.

Definition at line 131 of file navtree.py.

Definition at line 124 of file navtree.py.

Definition at line 117 of file navtree.py.

Reimplemented from plone.app.layout.navigation.navtree.NavtreeStrategyBase.

Definition at line 127 of file navtree.py.

Definition at line 125 of file navtree.py.


The documentation for this class was generated from the following file: