Ejemplo n.º 1
0
    def update(self):
        super(Topic, self).update()

        context = self.context
        request = self.request

        context = removeSecurityProxy(context)

        if not IDraftedContent.providedBy(context) and \
                checkPermission('zojax.forum.AddMessage', context):
            self.reply = getMultiAdapter((context, request), name='reply.html')

        info = {'replies': len(context)-1, 'next': None, 'prev': None}

        forum = context.__parent__

        if IForum.providedBy(IForum):
            topics = forum.topics

            next = topics.next(context)
            if next is not None:
                info['prev'] = {'name': next.__name__,
                                'title': next.title}

            prev = topics.previous(context)
            if prev is not None:
                info['next'] = {'name': prev.__name__,
                                'title': prev.title}

        self.topicInfo = info

        if self.reply is not None:
            self.reply.update()
            if self.reply.isRedirected:
                self.redirect()
Ejemplo n.º 2
0
    def __init__(self, context, default=None):
        self.value = default
        if IDraftedContent.providedBy(context):
            return

        _context = removeSecurityProxy(context)

        ct = IContentType(_context, None)
        if ct is None:
            return

        perms = {}
        for ct in ct.listContainedTypes(False):
            dct = queryUtility(IDraftContentType, ct.name)
            if dct is not None:
                # do not check permission
                if IDraftedContentType.providedBy(ct):
                    interface.noLongerProvides(ct, IDraftedContentType)
                ct.permission = None
                if not ct.isAvailable():
                    continue

                if dct.publish:
                    perms[dct.publish] = 1

        principals = {}
        for permission in perms.keys():
            principals.update(
                [(user, 1) for user in getAccessList(_context, permission)])

        if principals:
            self.value = principals.keys()
Ejemplo n.º 3
0
 def isAvailable(self):
     return (not IDraftedContent.providedBy(self.context)) and\
            ((checkPermission('zojax.AddTask', self.context) or
              checkPermission('zojax.SubmitTask', self.context)) and\
             'tasks' in self.context)
Ejemplo n.º 4
0
 def isAvailable(self):
     return (not IDraftedContent.providedBy(self.context)) and \
            checkPermission('zojax.AddMilestone', self.context) and \
         'milestones' in self.context