Exemplo n.º 1
0
    def __init__(self, context, request, view, manager=None):
        maincontext = context

        site = getSite()
        if not IRootSpace.providedBy(site) or \
                IContentSpaceLayout.providedBy(site) and not site.showTabs:
            self.available = False
            super(PortalTabs, self).__init__(context, request, view, manager)
            return

        wsname = u''
        ws = None
        if ILayout.providedBy(view.view):
            context = view.view.mainview
        elif ILayout.providedBy(view):
            context = view.mainview

        while not IRootSpace.providedBy(context) \
                or IDraftedContent.providedBy(context):
            if IWorkspace.providedBy(context):
                ws = context
                wsname = context.__name__
            context = context.__parent__
            if context is None:
                break

        self.wsname = wsname
        self.workspace = ws

        super(PortalTabs, self).__init__(site, request, view, manager)
Exemplo n.º 2
0
    def listMembers(self):
        view = getattr(self.manager, 'view', None)
        if ILayout.providedBy(view):
            context = view.maincontext
        else:
            context = self.context

        while not ITopContributorsAware.providedBy(context):
            context = context.__parent__
            if context is None:
                return ()

        auth = getUtility(IAuthentication)
        contributors = ITopContributors(context)

        members = []
        for score, principal in contributors[:self.number]:
            try:
                principal = auth.getPrincipal(principal)
            except PrincipalLookupError:
                continue

            members.append(LocationProxy(principal, self))

        return members
Exemplo n.º 3
0
    def __init__(self, context, request, manager, view):
        if ILayout.providedBy(view):
            context = view.maincontext
            view = view.mainview

        context = IActionsContext(context, context)

        super(ActionsPortlet, self).__init__(context, request, manager, view)
Exemplo n.º 4
0
    def __init__(self, context, request, manager, view):
        view = getattr(manager, 'view', None)
        if ILayout.providedBy(view):
            context = view.maincontext

        context = context or getSite()

        super(ActivityPortlet, self).__init__(context, request, manager, view)
Exemplo n.º 5
0
 def isAvailable(self):
     if not self.propagate:
         if ILayout.providedBy(self.view):
             self.context, self.view.maincontext
             return self.context == self.view.maincontext
         elif self.view is not None:
             return self.context == self.view.context
         return self.context == self.manager.context
     return super(ContainerPortlet, self).isAvailable()