当前位置: 首页>>代码示例>>Python>>正文


Python navtree.SitemapNavtreeStrategy类代码示例

本文整理汇总了Python中Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy的典型用法代码示例。如果您正苦于以下问题:Python SitemapNavtreeStrategy类的具体用法?Python SitemapNavtreeStrategy怎么用?Python SitemapNavtreeStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SitemapNavtreeStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: siteNavStrategy

 def siteNavStrategy(self):
     context = aq_inner(self.context)
     selected_tab = self.selected_portal_tab
     obj = api.portal.get()[selected_tab]
     path = {'query': '/'.join(obj.getPhysicalPath()),
             'navtree': 1,
             'navtree_start': 2,
             'depth': 2}
     query = {
         'path': path,
         'review_state': 'published',
         'portal_type': ('hph.sitecontent.mainsection',
                         'hph.sitecontent.contentpage',
                         'hph.lectures.coursefolder')
     }
     strategy = SitemapNavtreeStrategy(obj)
     strategy.rootPath = '/'.join(obj.getPhysicalPath())
     strategy.showAllParents = True
     strategy.bottomLevel = 999
     tree = buildFolderTree(context, obj, query, strategy)
     items = []
     for c in tree['children']:
         item = {}
         item['item'] = c['item']
         item['children'] = c.get('children', '')
         item['itemid'] = c['normalized_id']
         item_id = c['normalized_id']
         if item_id == context.getId():
             item['class'] = 'active'
         else:
             item['class'] = ''
         item['parent'] = self.compute_parent_marker(item_id)
         items.append(item)
     return items
开发者ID:a25kk,项目名称:hfph,代码行数:34,代码来源:navbar.py

示例2: update

 def update(self):
     query = self.request.get('q', None)
     self.tab = self.request.get('tab', None)
     uids = None
     if self.tab == 'recent':
         pass
     elif self.tab == 'clipboard':
         brains = list(self.search(''))[:2]
         uids = [b.UID for b in brains]
     result = self.search(query, uids=uids)
     strategy = SitemapNavtreeStrategy(self.context)
     result = [strategy.decoratorFactory({'item': node}) for node in result]
     if self.tab == 'content-tree':
         portal_state = getMultiAdapter((self.context, self.request),
                                           name=u'plone_portal_state')
         portal = portal_state.portal()
         query_tree = {'sort_on': 'getObjPositionInParent',
                       'sort_order': 'asc',
                       'is_default_page': False}
         strategy.rootPath = '/Plone'
         data = buildFolderTree(portal,
                            obj=portal,
                            query=query_tree,
                            strategy=strategy)
         result = data.get('children', [])
     self.level = 1
     self.children = result
开发者ID:cintiacinquini,项目名称:collective.cover,代码行数:27,代码来源:screenlets.py

示例3: update

    def update(self):
        query = self.request.get('q', None)
        self.tab = self.request.get('tab', None)
        b_size = 10
        page = int(self.request.get('page', 0))
        strategy = SitemapNavtreeStrategy(self.context)

        uids = None
        if self.tab == 'content-tree':
            # XXX: not implemented
            pass
#            portal_state = getMultiAdapter((self.context, self.request),
#                                           name=u'plone_portal_state')
#            portal = portal_state.portal()
#            query_tree = {'sort_on': 'getObjPositionInParent',
#                          'sort_order': 'asc',
#                          'is_default_page': False}
#            strategy.rootPath = portal.absolute_url_path()
#            data = buildFolderTree(portal,
#                                   obj=portal,
#                                   query=query_tree,
#                                   strategy=strategy)
#            result = data.get('children', [])
        else:
            if self.tab == 'clipboard':
                # XXX: not implemented
                pass
#                brains = list(self.search(''))[:2]
#                uids = [b.UID for b in brains]
            result = self.search(query, uids=uids,
                                 b_start=page * b_size,
                                 b_size=b_size)
            result = [strategy.decoratorFactory({'item': node}) for node in result]
        self.level = 1
        self.children = result
开发者ID:digitalnatif,项目名称:collective.cover,代码行数:35,代码来源:screenlets.py

示例4: __init__

 def __init__(self, context, portlet):
     SitemapNavtreeStrategy.__init__(self, context, portlet)
     self.bottomLevel = 0
     currentFolderOnly = True
     topLevel = 0
     root = getattr(portlet, 'root', uuidToObject(portlet.root_uid))
     self.rootPath = getRootPath(context, currentFolderOnly, topLevel, root)
开发者ID:collective,项目名称:Solgema.NavigationPortlet,代码行数:7,代码来源:navigation.py

示例5: __init__

    def __init__(self, context, portlet):
        SitemapNavtreeStrategy.__init__(self, context, portlet)

        # XXX: We can't do this with a 'depth' query to EPI...
        self.bottomLevel = portlet.bottomLevel or 0

        self.rootPath = getRootPath(context,
                                    portlet.currentFolderOnly,
                                    portlet.topLevel,
                                    portlet.root_uid)
开发者ID:SyZn,项目名称:plone.app.portlets,代码行数:10,代码来源:navigation.py

示例6: __init__

    def __init__(self, context, portlet):
        SitemapNavtreeStrategy.__init__(self, context, portlet)
        portal_properties = getToolByName(context, 'portal_properties')
        navtree_properties = getattr(portal_properties, 'navtree_properties')
        
        # XXX: We can't do this with a 'depth' query to EPI...
        self.bottomLevel = portlet.bottomLevel or navtree_properties.getProperty('bottomLevel', 0)

        currentFolderOnly = portlet.currentFolderOnly or navtree_properties.getProperty('currentFolderOnlyInNavtree', False)
        topLevel = portlet.topLevel or navtree_properties.getProperty('topLevel', 0)
        self.rootPath = getRootPath(context, currentFolderOnly, topLevel, portlet.root)
开发者ID:uwosh,项目名称:uwosh.portlet.expandingnav,代码行数:11,代码来源:expandingnavigation.py

示例7: update

    def update(self):
        self.query = self.request.get("q", None)
        self.tab = self.request.get("tab", None)
        b_size = int(self.request.get("b_size", 10))
        page = int(self.request.get("page", 1))
        strategy = SitemapNavtreeStrategy(self.context)

        uids = None
        result = self.search(self.query, uids=uids, page=page, b_size=b_size)
        self.has_next = result.has_next
        self.nextpage = result.nextpage
        result = [strategy.decoratorFactory({"item": node}) for node in result]
        self.level = 1
        self.children = result
开发者ID:jsbueno,项目名称:collective.cover,代码行数:14,代码来源:contentchooser.py

示例8: update

    def update(self):
        self.query = self.request.get('q', None)
        self.tab = self.request.get('tab', None)
        page = int(self.request.get('page', 1))
        strategy = SitemapNavtreeStrategy(self.context)

        uids = None
        result = self.search(
            self.query, uids=uids,
            page=page
        )
        self.has_next = result.next is not None
        self.nextpage = result.pagenumber + 1
        children = [strategy.decoratorFactory({'item': node}) for node in result]
        self.level = 1
        self.children = children
开发者ID:jean,项目名称:collective.cover,代码行数:16,代码来源:contentchooser.py

示例9: subtreeFilter

 def subtreeFilter(self, node):
     sitemapDecision = SitemapNavtreeStrategy.subtreeFilter(self, node)
     if not sitemapDecision:
         return False
     depth = node.get('depth', 0)
     return not (
         depth > 0 and self.bottomLevel > 0 and depth >= self.bottomLevel
     )
开发者ID:plone,项目名称:plone.app.standardtiles,代码行数:8,代码来源:navigation.py

示例10: __init__

    def __init__(self, context, tile):
        SitemapNavtreeStrategy.__init__(self, context, tile)
        portal_properties = getToolByName(context, 'portal_properties')
        navtree_properties = getattr(portal_properties, 'navtree_properties')

        # XXX: We can't do this with a 'depth' query to EPI...
        self.bottomLevel = tile.data.get('bottomLevel') or \
                           navtree_properties.getProperty('bottomLevel', 0)

        currentFolderOnly = tile.data.get('currentFolderOnly') or \
                            navtree_properties.getProperty(
                                    'currentFolderOnlyInNavtree', False)
        topLevel = tile.data.get('topLevel') or \
                   navtree_properties.getProperty('topLevel', 0)
        tileRoot = uuidToFolderishPath(context, tile.data.get('root'))
        self.rootPath = getRootPath(context, currentFolderOnly,
                                    topLevel, tileRoot)
开发者ID:hatchddigital,项目名称:plone.app.standardtiles,代码行数:17,代码来源:navigation.py

示例11: subtreeFilter

 def subtreeFilter(self, node):
     sitemapDecision = SitemapNavtreeStrategy.subtreeFilter(self, node)
     if sitemapDecision == False:
         return False
     depth = node.get('depth', 0)
     if depth > 0 and self.bottomLevel > 0 and depth >= self.bottomLevel:
         return False
     else:
         return True
开发者ID:uwosh,项目名称:uwosh.portlet.expandingnav,代码行数:9,代码来源:expandingnavigation.py

示例12: __init__

    def __init__(self, context, portlet):
        
        SitemapNavtreeStrategy.__init__(self, context, portlet)
        portal_properties = getToolByName(context, 'portal_properties')
        navtree_properties = getattr(portal_properties, 'navtree_properties')

        # XXX: We can't do this with a 'depth' query to EPI...
        self.bottomLevel = portlet.bottomLevel or navtree_properties.getProperty('bottomLevel', 0)

        currentFolderOnly = portlet.currentFolderOnly or navtree_properties.getProperty('currentFolderOnlyInNavtree', False)
        topLevel = portlet.topLevel or navtree_properties.getProperty('topLevel', 0)
        #custom implementation starts here
        currentObject = self.context
        parentList = currentObject.aq_chain
        parentspace = None
        found = 0

        try:
            for type in parentList:
                if type.portal_type == 'Space' and type.meta_type == 'Space':
                    parentspace = type
                    found = 1
                if found == 1:
                    break
        except AttributeError:
                pass

        rootObject = self.context.portal_url.getPortalObject()

        objNavtree = 1

        isMemberFolder = False
        members = rootObject.Members
        if parentspace is None:
            if members in parentList:
                isMemberFolder = True
        
        if parentspace <> None:
            self.rootPath = '/'.join(parentspace.getPhysicalPath())                
        else:
            topLevel = portlet.topLevel or navtree_properties.getProperty('topLevel', 0)
            self.rootPath = getRootPath(context, currentFolderOnly, topLevel, portlet.root)
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:42,代码来源:navigation.py

示例13: __init__

    def __init__(self, context, portlet):
        SitemapNavtreeStrategy.__init__(self, context, portlet)
        portal_properties = getToolByName(context, 'portal_properties')
        navtree_properties = getattr(portal_properties, 'navtree_properties')
        portal_languages = getToolByName(context, 'portal_languages')

        # XXX: We can't do this with a 'depth' query to EPI...
        self.bottomLevel = portlet.bottomLevel or navtree_properties.getProperty('bottomLevel', 0)

        currentFolderOnly = portlet.currentFolderOnly or navtree_properties.getProperty('currentFolderOnlyInNavtree', False)
        topLevel = portlet.topLevel or navtree_properties.getProperty('topLevel', 0)
        #self.rootPath = getRootPath(context, currentFolderOnly, topLevel, portlet.root)
        #self.rootPath = "%s/%s" % ( getRootPath(context, currentFolderOnly, topLevel, portlet.root), portal_languages.getPreferredLanguage())
        portal_url = getToolByName(context, 'portal_url')
        portal_root = portal_url.getPortalPath()

        self.rootPath = "%s/%s" % ( portal_root, portal_languages.getPreferredLanguage())
        if "//" in self.rootPath:
            self.rootPath = self.rootPath.replace("//","/")
        self.showAllParents = False
开发者ID:EU-OSHA,项目名称:osha.theme,代码行数:20,代码来源:adapter.py

示例14: subtreeFilter

 def subtreeFilter(self, node):
     sitemapDecision = SitemapNavtreeStrategy.subtreeFilter(self, node)
     if sitemapDecision == False:
         return False
     if getattr(self.context.aq_base, 'hide_subnavigation', False):
         if "/".join(self.context.getPhysicalPath()) == node['path']:
             return False
     depth = node.get('depth', 0)
     if depth > 0 and self.bottomLevel > 0 and depth >= self.bottomLevel:
         return False
     else:
         return True
开发者ID:tsimkins,项目名称:agsci.UniversalExtender,代码行数:12,代码来源:adapters.py

示例15: __init__

 def __init__(self, context, view=None):
     SitemapNavtreeStrategy.__init__(self, context, view)
     self.rootPath = '/'.join(context.getPhysicalPath())
     self.bottomLevel = 65535
开发者ID:Tamosauskas,项目名称:Products.CMFContentPanels,代码行数:4,代码来源:subnavtree.py


注:本文中的Products.CMFPlone.browser.navtree.SitemapNavtreeStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。