Ejemplo n.º 1
0
    def update(self):
        cm = ICommentsManager(self.context)
        self.comments = cm.getComments()
        self.attachable = cm.attachable()
        self.count = len(self.comments)

        mtool = getToolByName(self.context, 'portal_membership')
        username = mtool.getAuthenticatedMember().getUserName()
        mi = mtool.getMemberInfo(username)
        self.myname = mi and mi['fullname'] or username

        self.canPost = mtool.checkPermission('Reply to item', self.context)
Ejemplo n.º 2
0
    def update(self):
        cm = ICommentsManager(self.context)
        self.comments = cm.getComments()
        self.attachable = cm.attachable()
        self.count = len(self.comments)

        mtool = getToolByName(self.context, "portal_membership")
        username = mtool.getAuthenticatedMember().getUserName()
        mi = mtool.getMemberInfo(username)
        self.myname = mi and mi["fullname"] or username

        self.canPost = mtool.checkPermission("Reply to item", self.context)
Ejemplo n.º 3
0
    def addComment(self, text):
        core = self.getCommandSet('core')
        core.toggleClass('.waitIndicator', 'hideme')
        if not text.strip():
            return self.render()

        comment = self._addComment(text)
        the_macro = comments_template.macros['post']
        content = self.header_macros(the_macro=the_macro, comment=comment)
        # Always encoded as utf-8
        content = force_unicode(content, 'utf')

        core.insertHTMLBefore("#your_comment", content)
        ksszopen=self.getCommandSet('zopen')
        ksszopen.clear('#commentBody')

        cm = ICommentsManager(self.context)
        count = str(len(cm.getComments()))
        core.replaceInnerHTML('#comments_count span', count)

        return self.render()
Ejemplo n.º 4
0
    def addComment(self, text):
        core = self.getCommandSet("core")
        core.toggleClass(".waitIndicator", "hideme")
        if not text.strip():
            return self.render()

        comment = self._addComment(text)
        the_macro = comments_template.macros["post"]
        content = self.header_macros(the_macro=the_macro, comment=comment)
        # Always encoded as utf-8
        content = force_unicode(content, "utf")

        core.insertHTMLBefore("#your_comment", content)
        ksszopen = self.getCommandSet("zopen")
        ksszopen.clear("#commentBody")

        cm = ICommentsManager(self.context)
        count = str(len(cm.getComments()))
        core.replaceInnerHTML("#comments_count span", count)

        return self.render()