Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.browser.navigation.CatalogNavigationTabs Class Reference
Inheritance diagram for CMFPlone.browser.navigation.CatalogNavigationTabs:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.browser.navigation.CatalogNavigationTabs:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def topLevelTabs

Detailed Description

Definition at line 122 of file navigation.py.


Member Function Documentation

def CMFPlone.browser.navigation.CatalogNavigationTabs.topLevelTabs (   self,
  actions = None,
  category = 'portal_tabs' 
)

Definition at line 125 of file navigation.py.

00125 
00126     def topLevelTabs(self, actions=None, category='portal_tabs'):
00127         context = aq_inner(self.context)
00128 
00129         portal_catalog = getToolByName(context, 'portal_catalog')
00130         portal_properties = getToolByName(context, 'portal_properties')
00131         navtree_properties = getattr(portal_properties, 'navtree_properties')
00132         site_properties = getattr(portal_properties, 'site_properties')
00133 
00134         # Build result dict
00135         result = []
00136         # first the actions
00137         if actions is not None:
00138             for actionInfo in actions.get(category, []):
00139                 data = actionInfo.copy()
00140                 data['name'] = data['title']
00141                 result.append(data)
00142 
00143         # check whether we only want actions
00144         if site_properties.getProperty('disable_folder_sections', False):
00145             return result
00146 
00147         customQuery = getattr(context, 'getCustomNavQuery', False)
00148         if customQuery is not None and utils.safe_callable(customQuery):
00149             query = customQuery()
00150         else:
00151             query = {}
00152 
00153         rootPath = getNavigationRoot(context)
00154         query['path'] = {'query' : rootPath, 'depth' : 1}
00155 
00156         query['portal_type'] = utils.typesToList(context)
00157 
00158         sortAttribute = navtree_properties.getProperty('sortAttribute', None)
00159         if sortAttribute is not None:
00160             query['sort_on'] = sortAttribute
00161 
00162             sortOrder = navtree_properties.getProperty('sortOrder', None)
00163             if sortOrder is not None:
00164                 query['sort_order'] = sortOrder
00165 
00166         if navtree_properties.getProperty('enable_wf_state_filtering', False):
00167             query['review_state'] = navtree_properties.getProperty('wf_states_to_show', [])
00168 
00169         query['is_default_page'] = False
00170         
00171         if site_properties.getProperty('disable_nonfolderish_sections', False):
00172             query['is_folderish'] = True
00173 
00174         # Get ids not to list and make a dict to make the search fast
00175         idsNotToList = navtree_properties.getProperty('idsNotToList', ())
00176         excludedIds = {}
00177         for id in idsNotToList:
00178             excludedIds[id]=1
00179 
00180         rawresult = portal_catalog.searchResults(**query)
00181 
00182         # now add the content to results
00183         for item in rawresult:
00184             if not (excludedIds.has_key(item.getId) or item.exclude_from_nav):
00185                 id, item_url = get_view_url(item)
00186                 data = {'name'      : utils.pretty_title_or_id(context, item),
00187                         'id'         : id,
00188                         'url'        : item_url,
00189                         'description': item.Description}
00190                 result.append(data)
00191         return result
00192 

Here is the call graph for this function:


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