示例#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()
示例#2
0
def forumMsgCacheHandler(ob, ev):
    forum = ob.__parent__.__parent__
    if IForum.providedBy(forum):
        ForumTag.update(forum)

    topic = ob.__parent__
    if ITopic.providedBy(topic):
        TopicTag.update(topic)
示例#3
0
    def initDataset(self):
        order = IOrder(self.context)

        forums = []

        for key, forum in order.items():
            if IForum.providedBy(forum) and checkPermission('zope.View', forum):
                forum = removeSecurityProxy(forum)
                forums.append(forum)

        self.dataset = forums
示例#4
0
def forumTopicCacheHandler(ob, ev):
    forum = ob.__parent__
    if IForum.providedBy(forum):
        ForumTag.update(forum)