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)
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)
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()
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()