def makeCommentHeading(self, page, subject, username, time, message_id=None,in_reply_to=None): """ Generate HTML markup for a comment heading in a HTML page. Note that we just work on the comment heading here. The content of the comment is left as is, not certain what to do with it. Users likely expect to be able to write comments like on every other page type (e.g. with two newlines to format paragraphs) - but what kind of markup would be expected on a html page? XXX """ heading = '\n\n<p class="commentheading"> ' heading += '<strong>%s</strong> --' % (subject or '...') if username: heading = heading + '%s, ' % (username) heading += time or '' heading += ' <a class="reference" href="%s?subject=%s%s#bottom">%s</a>' % ( page.pageUrl(), quote(subject or ''), ((message_id and '&in_reply_to='+quote(message_id)) or ''), _("reply"), ) heading += '\n\n</p>' return heading
def makeCommentHeading(self, page, subject, username, time, message_id=None,in_reply_to=None): """ Generate restructured text markup for a comment heading in a RST page. Our traditional comment layout - body immediately following heading with no blank line between - is possible in RST only if we had the comment body to play with, or by the solution used here: setting the class of the heading and first paragraph and using CSS to remove the margins. XXX NB this doesn't support complete styling as subsequent paragraphs don't have the class. Things need to change so that comments are rendered from a template and can be fully customized using HTML+CSS, not the text markup rules. """ heading = '\n\n.. class:: commentheading\n\n' heading += '**%s** --' % (subject or '...') if username: heading = heading + '%s, ' % (username) heading += time heading += ' `%s <%s?subject=%s%s#bottom>`_' % ( _("reply"), page.pageUrl(), quote(subject or ''), ((message_id and '&in_reply_to='+quote(message_id)) or '') ) heading += '\n\n.. class:: commentbody\n\n' return heading
def discussionSeparator(self,page): # we want to customize the heading style in the stylesheet.. # but also have it look ok by default in plone, which has it's own.. # without preventing it being overridden - perhaps b outside the span # will work return '\n\n<a name="comments"><br /><b><span class="commentsheader">%(comments)s:</span></b></a>\n\n' % \ { "comments":_("comments") }
def changeIssueProperties(self, name=None, category=None, severity=None, status=None, log=None, text='', REQUEST=None): """ Change an issue page's properties and redirect back there. Also, add a comment to the page describing what was done. Optionally a comment subject and body can be set. name is the issue name excluding the issue number. Changing this will trigger a page rename, which may be slow. Security: allows modification of some properties (title/category/severity/status) with zwiki edit permission rather than zope Manage properties permission. Upgrade issue: calling this before upgrading an issue to a 0.17-style page id will mess up the id/title. """ if not self.checkSufficientId(REQUEST): return self.denied( _("Sorry, this wiki doesn't allow anonymous edits. Please configure a username in options first.")) comment = '' if name: if name != self.issueName(): newpagename = self.pageNameFromIssueNumberAndName( self.issueNumber(), name) comment += "Name: '%s' => '%s' \n" % (self.pageName(), newpagename) if not self.checkPermission(Permissions.Rename, self): raise 'Unauthorized', (_('You are not authorized to rename this ZWiki Page.')) self.rename(newpagename, updatebacklinks=1, sendmail=0, REQUEST=REQUEST) if category: old = getattr(self,'category','') if category != old: comment += "Category: %s => %s \n" % (old,category) if not self.checkPermission(Permissions.Edit, self): raise 'Unauthorized', (_('You are not authorized to edit this ZWiki Page.')) self.manage_changeProperties(category=category) if severity: old = getattr(self,'severity','') if severity != old: comment += "Severity: %s => %s \n" % (old,severity) if not self.checkPermission(Permissions.Edit, self): raise 'Unauthorized', (_('You are not authorized to edit this ZWiki Page.')) self.manage_changeProperties(severity=severity) if status: old = getattr(self,'status','') if status != old: comment += "Status: %s => %s \n" % (old,status) if not self.checkPermission(Permissions.Edit, self): raise 'Unauthorized', (_('You are not authorized to edit this ZWiki Page.')) self.manage_changeProperties(status=status) if text: comment += '\n' + text if comment: if not self.checkPermission(Permissions.Comment, self): raise 'Unauthorized', (_('You are not authorized to comment on this ZWiki Page.')) # there was a change, note it on the page and via mail # fine detail: don't say (property change) if there wasn't subject = '' if log: subject += log #if '=>' in comment: subject += ' (%s)' % _('property change') self.comment( text=comment, subject_heading=subject, REQUEST=REQUEST) # comment takes care of this I believe #self.setLastEditor(REQUEST) #self.reindex_object() if REQUEST: REQUEST.RESPONSE.redirect(self.pageUrl())