def _add_folder(self, uids, folder): for content in folder.values(): if IFolder.providedBy(content): self._add_folder(uids, content) else: uids.append({'uid': IUUID(content)}) return uids
def find_endpoint(self, obj, lang, types_to_list): if not (IFolder.providedBy(obj) or IPloneSiteRoot.providedBy(obj)): return obj contents = obj.contentIds() # TODO: make list reversable for cid in contents: child = obj[cid] # try to get translation if LinguaPlone is installed, child # is translatable and child language does not match lang if LINGUA_PLONE_INSTALLED: if ITranslatable.providedBy(child): child_lang = child.Language() # child lang can be empty string, only try to # translate if explicit lang if child_lang and child_lang != lang: translation = child.getTranslation(lang) if not translation: continue # ...with next obj in folder child = translation # only traverse to allowed objects allowed = self.permitted(context=child, permission=VIEW_PERMISSION) if not allowed: continue # only traverse to objects listed in typesToList if child.portal_type not in types_to_list: continue # we've found a published object, which can be used as # possible endpoint, except it has 'traverse_view' enabled obj = child if child.defaultView() == "traverse_view": obj = self.find_endpoint(child, lang, types_to_list) break return obj
def __init__(self, context): permissions = [VIEW_ORDERS_PERMISSION] super(ShopPortletBookingsInContextLink, self).__init__( context, view_permissions=permissions) # check if authenticated user is vendor if self.display and not get_vendors_for(): self.display = False # Go to appropriate context if not IBuyable.providedBy(context) \ and not IFolder.providedBy(context) \ and not IPloneSiteRoot.providedBy(context): context = context.aq_inner.aq_parent self.url = '%s/@@bookings' % context.absolute_url() self.title = _('bookings_in_context', default=u'Bookings in Context') self.order = 22 self.cssclass = 'bookings'
def __init__(self, context): permissions = [VIEW_ORDERS_PERMISSION] super(ShopPortletOrdersInContextLink, self).__init__(context, view_permissions=permissions) # check if authenticated user is vendor if self.display and not get_vendors_for(): self.display = False # Go to appropriate context if ( not IBuyable.providedBy(context) and not IFolder.providedBy(context) and not IPloneSiteRoot.providedBy(context) ): context = context.aq_inner.aq_parent self.url = "%s/@@orders" % context.absolute_url() self.title = _("orders_in_context", default=u"Orders in Context") self.order = 11 self.cssclass = "orders"
def find_endpoint(obj, lang): if not IFolder.providedBy(obj) and\ not IPloneSiteRoot.providedBy(obj): return obj contents = obj.contentIds() # TODO: make list reversable for id in contents: child = obj[id] # try to get translation if LinguaPlone is installed, child # is translatable and child language does not match lang if LINGUA_PLONE_INSTALLED: if ITranslatable.providedBy(child): child_lang = child.Language() # child lang can be empty string, only try to # translate if explicit lang if child_lang and child_lang != lang: translation = child.getTranslation(lang) if not translation: continue # ...with next obj in folder child = translation # only traverse to published objects try: state = wft.getInfoFor(child, 'review_state') except: state = None if not state == 'published': continue # only traverse to objects listed in typesToList if child.portal_type not in types: continue # we've found a published object, which can be used as # possible endpoint, except it has 'traverse_view' enabled obj = child if child.defaultView() == 'traverse_view': obj = find_endpoint(child, lang) break return obj
def available(self): return IFolder.providedBy(self.context)
def available(self): """True, if the context can become a slideshow folder. """ return IFolder.providedBy(self.context)
def available(self): """True, if the context can become a lineage subsite. """ return IFolder.providedBy(self.context)