def __init__(self, context, request):
     self.context = context
     self.request = request
     portal_props = api.portal.get_tool(name=u'portal_properties')
     self.properties = portal_props.navtree_properties
     self.portal_state = getMultiAdapter((context, request),
                                         name=u'plone_portal_state')
     self.portal = self.portal_state.portal()
     portal_path = '/'.join(self.portal.getPhysicalPath())
     navroot_path = getNavigationRoot(context)
     if portal_path != navroot_path:
         self.portal = self.portal.restrictedTraverse(navroot_path)
     if api.env.plone_version() < '5':
         self.data = Assignment(root=navroot_path)
     else:
         self.data = Assignment(root_uid=None)
예제 #2
0
 def update(self):
     common.ViewletBase.update(self)  # Get portal_state and portal_url
     super(DropdownMenuViewlet, self).update()
     context = aq_inner(self.context)
     portal_props = getToolByName(context, 'portal_properties')
     self.properties = portal_props.navtree_properties
     self.navroot_path = getNavigationRoot(context)
     self.data = Assignment(root=self.navroot_path)
예제 #3
0
 def update(self):
     common.ViewletBase.update(self)  # Get portal_state and portal_url
     super(DropdownMenuViewlet, self).update()
     context = aq_inner(self.context)
     portal_props = getToolByName(context, 'portal_properties')
     self.properties = portal_props.navtree_properties
     self.enable_caching = api.portal.get_registry_record('webcouturier.dropdownmenu.browser.interfaces.IDropdownConfiguration.enable_caching')
     self.enable_parent_clickable = api.portal.get_registry_record('webcouturier.dropdownmenu.browser.interfaces.IDropdownConfiguration.enable_parent_clickable')
     self.navroot_path = getNavigationRoot(context)
     uid = api.content.get_uuid(obj=context) if IContentish.providedBy(context) else None
     self.data = Assignment(root_uid=uid)
예제 #4
0
 def update(self):
     common.ViewletBase.update(self)  # Get portal_state and portal_url
     super(DropdownMenuViewlet, self).update()
     portal_props = getToolByName(self.context, 'portal_properties')
     self.properties = portal_props.navtree_properties
     self.dropdown_properties = portal_props.dropdown_properties
     self.enable_caching = self.dropdown_properties.getProperty(
         'enable_caching', False)
     self.enable_parent_clickable = self.dropdown_properties.getProperty(
         'enable_parent_clickable', True)
     self.navroot_path = getNavigationRoot(self.context)
     self.data = Assignment(root=self.navroot_path)
예제 #5
0
 def update(self):
     common.ViewletBase.update(self)  # Get portal_state and portal_url
     super(MegamenuViewlet, self).update()
     context = aq_inner(self.context)
     portal_props = plone.api.portal.get_tool('portal_properties')
     self.properties = portal_props.navtree_properties
     self.navroot_path = getNavigationRoot(context)
     self.navroot_path = getNavigationRoot(context)
     try:
         if IContentish.providedBy(context):
             uid = plone.api.content.get_uuid(obj=context)
         else:
             uid = None
     except TypeError:
         # ArcheTypes (such as PFG FormFolder) have no UID yet when the
         # factory gets called.
         uid = None
     self.data = Assignment(root_uid=uid)