﻿ticket,summary,type,release,owner,status,created,modified,_description,_reporter
4823,AddCommentMacro version for Trac 0.12 with locale support,defect,0.12,Alec Thomas,new,2009-03-22T07:33:02+01:00,2010-09-10T16:14:38+02:00,"I've made simple and maybe hacky localization of module, see the attachment.",Alexey Kinyov
6911,AddCommentMacro does not work with trac 0.12,enhancement,0.12,Alec Thomas,new,2010-03-31T17:09:40+02:00,2010-03-31T17:09:40+02:00,"I am trying to use the comment macro on a trac 0.12 instance. The following patch seems to work fine to get it running (contains translations to german, as I needed that too).",benjamin@…
7528,Summit comment button hanging in  firefox 3,defect,0.12,osimons,new,2010-08-20T13:52:33+02:00,2010-08-20T13:59:47+02:00,"I seem to have an issues with using the AddCommentMacro plugin with trac 0.12 under Firefox. When I click on the AddComment button the page does not get refreshed and Firefox seems to be waiting for data. The problem just seems to be related to the page refresh since the comment does get added to the wiki. Using Internet explorer everything works as expected.

As a temporary fix I commented out the following code in macro.py...
{{{
# We can't redirect from macro as it will raise RequestDone
                    # which like other macro errors gets swallowed in the Formatter.
                    # We need to re-raise it in a post_process_request instead.
                    #try:
                    #    self.env.log.debug(
                    #        ""AddComment saved - redirecting to: %s"" % page_url)
                    #    req._outheaders = []
                    #    req.redirect(page_url)
                    #except RequestDone:
                    #    req.addcomment_raise = True
}}}
and inserted this below the above code...
{{{
                    the_preview = tag.div(heading,
                                format_to_html(self.env, context, comment),
                                class_=""wikipage"", id=""preview"")
                    the_message = tag.div(tag.strong(""Comment appended.""),class_=""system-message"")
                    comment=""""
}}}

Thanks",Peter
10093,"""Many content-Length headers"" error received when posting a comment",defect,0.12,osimons,new,2012-06-13T22:15:04+02:00,2013-03-22T14:10:26+01:00,"When submitting a comment Google Chrome show

{{{
Error 346 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH): many  ""Content-Length"" headers recerived. 
}}}

Chrome version: 19.0.1084.56 m

A very similar issue happens  with Firefox 12 (a Corrupt content message is displayed)",anonymous
9074,No way to add comment macro to all wiki pages,defect,0.12,Alec Thomas,new,2011-08-06T11:31:11+02:00,2011-08-13T04:15:52+02:00,"i know this is a macro, but is there a way to enable appendonly on all wiki pages, similar to how comments are on all tickets?  (if it's outside the scope of this hack, could you point me in the right direction?  thanks.)",anonymous
1286,[Patch] Improve permissions model,enhancement,0.11,Alec Thomas,new,2007-03-06T16:18:57+01:00,2017-08-03T13:15:49+02:00,"The !AddComment macro has an insufficient permissions model. On some sites, comments are welcome, but only by authenticated users. Wouldn't it be appropriate to add COMMENT_CREATE, COMMENT_MODIFY, COMMENT_DELETE, COMMENT_ADMIN permissions and let the existing permissions mechanism be used to decide who can add comments?",Jonathan S. Shapiro
2385,AddComment Improvements,enhancement,0.11,osimons,new,2008-01-12T21:18:09+01:00,2009-01-17T14:54:24+01:00,"I like this macro.

Nice if possible to:
 - enfasize the comment itself instead of the text ""Comment by..."" ie: don't use bold on this text or chage the color to grey (like the one appears on this page at ""Description Preview"" box)
 - change date format to YYYY-MM-DD hh:mm:ss (hh = 24 formated time)
 - presentation could it be one of this ways:
  - <user> commented this on YYYY-MM-DD hh:mm:ss
  - Comment added on YYYY-MM-DD hh:mm:ss by <user> (this I guess would be preferable)
 - an user option to expand / collapse comments

Documentation improvements
 - Add an Installation section (could it be like this)
  '''Note''': Instructions on how to install a plugin: [http://trac.edgewall.org/wiki/TracPlugins
  1. Install MacroPostPlugin
   1. Enable through WebAdmin panel (this line is because that other macro isn't clear)
   2. Restart server
  2. Install AddCommentMacro
   1. Enable through WebAdmin panel (this line is because this macro isn't also clear/explicit)
   2. Restart server  
 - Example:
{{{
[[AddComment]]
}}}
Renders this
{{{
Include here a screenshoot
}}}

Nice Work!!

P/S: 
 - That's my 2cents. Feel free to contact me in case of doubts (or if weren't clear :( ).
 - the ""clear/explicit"" issue is because beginers like me need more recipes to be more efficients. I think givin all the tips on the same place improves user satisfaction. But if the guideline is to be DRY, forget abbout this particular comment.
 - BTW I installed and it worked nicely.",adrian@…
6503,Error in validate_wiki_page (spamfilter),defect,0.11,Alec Thomas,new,2010-01-28T14:53:15+01:00,2010-01-28T14:53:15+01:00,"Running trac-0.11.7 with latest spamfilter and addcomment plugins gave me the following error:
{{{
2010-01-28 14:35:06,983 Trac[formatter] ERROR: Macro AddComment(None) failed:.
Traceback (most recent call last):
  File ""/usr/local/lib/python2.6/dist-packages/Trac-0.11.7stable_r0-py2.6.egg/trac/wiki/formatter.py"", line 484, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File ""/usr/local/lib/python2.6/dist-packages/Trac-0.11.7stable_r0-py2.6.egg/trac/wiki/formatter.py"", line 180, in process
    text = self.processor(text)
  File ""/usr/local/lib/python2.6/dist-packages/Trac-0.11.7stable_r0-py2.6.egg/trac/wiki/formatter.py"", line 167, in _macro_processor
    text)
  File ""build/bdist.linux-x86_64/egg/addcomment/macro.py"", line 125, in expand_macro
    for field, message in manipulator.validate_wiki_page(req, page):
  File ""build/bdist.linux-x86_64/egg/tracspamfilter/adapters.py"", line 88, in validate_wiki_page
    text = req.args['text']
KeyError: text
}}}
This occured only for non-admin users. Attached patch fixes this. Is this the right way to fix the problem?",Oliver Metz
6785,Include twice problem with TracWikiPrintPlugin,enhancement,0.11,Alec Thomas,new,2010-03-09T10:13:16+01:00,2010-03-09T10:13:16+01:00,"The macro is failing (detecting it's included twice) when converting more than one page to PDF using TracWikiPrintPlugin. 

More details are here:

http://trac-hacks.org/ticket/6784

I could make a dirty AddCommentMacro-specific fix, or try a better generic fix (restore ''req'' to previous state), but I'd also suggest making the change in AddComment macro to avoid it failing in other situations, when more than one wiki pages are rendered in the same request.",Álvaro Iradier
6945,use format_author to generate user name for comments,enhancement,0.11,Alec Thomas,new,2010-04-08T02:31:53+02:00,2010-04-08T02:31:53+02:00,"the macro currently uses authname as the attribution of the comment, since I'm using the openid plugin, this is an ugly URL. The attached patch uses format_author to generate a pretty version of the user name and uses that instead. 

Steve
",steve.cassidy@…
2546,Post does not work,defect,0.10,Alec Thomas,new,2008-02-10T00:32:44+01:00,2008-02-10T00:35:43+01:00,"Whenever I post a comment, i am presented with the ""create this page"" button on a blank version of the current wiki page.  There is nothing useful in the log.  I tried adding more logging to see if I could spot what was wrong, but it looks like the wiki processor is not even being invoked. As I dont get the log message that I added right up front (see below) or the one in the macro post handler.  I have enabled both the TracMacroPost and AddCommentMacro.  I tried installing MacroPostPlugin separately but that made trac entirely unstable.  I labeled it a blocker because the plugin is inoperable for me at the moment. (Sorry if I have missed something obvious).

{{{
#!python
def render_macro(self, req, name, content):
        self.log.debug('ADDComment Macro responding')
        return self.execute(req.hdf, content, self.env)
}}}

You help is greatly appreciated,

Russ",Russ Tyndall
3095,"after clicking on ""Add Comment"" only a white screen",defect,0.10,Alec Thomas,new,2008-05-28T18:32:54+02:00,2009-01-25T01:11:42+01:00,"Hi,

after i installed this macro i tried it. After clicking on ""Add Comment"" nothing happened. I see only a white screen (see the screenshot).

TracMacroPost 0.1 is also installed an enabled.

It would be nice if you can help me.

",benjamin-ruehl@…
4001,"Newest on top, option.  Not just newest on bottom like now.",enhancement,0.10,Alec Thomas,new,2008-10-28T18:03:31+01:00,2008-10-28T18:03:31+01:00,"'''I really like this macro!! '''

I would like to use it in one more context.  I would like to use it for release note type pages.  In these contexts I would like it to add the comment ''below'' the location of the macro not above.  Not sure if you can keep the default behavior the same and add a parameter when it should go the other way or if it needs to be a new macro name....  I am not strong on Trac or Trac Hack implementation.


But, newest on top would save me a lot of manual work.  Right now, on a few pages, after I add the comment I edit the page to move the macro call up-top again.''''''",DStrickler@…
4308,modified to add minutes...,enhancement,0.10,Alec Thomas,new,2008-12-18T20:57:57+01:00,2008-12-18T20:57:57+01:00,"I like this macro for recording minutes in a meeting...
I modified to remove the commenting and changed it to !AddMinuteMacro...

{{{
# vim: expandtab
import re, time
from StringIO import StringIO

from genshi.builder import tag

from trac.core import *
from trac.wiki.formatter import format_to_html
from trac.util import TracError
from trac.util.text import to_unicode
from trac.web.api import IRequestFilter, RequestDone
from trac.web.chrome import add_script
from trac.wiki.api import parse_args, IWikiMacroProvider
from trac.wiki.macros import WikiMacroBase
from trac.wiki.model import WikiPage
from trac.wiki.web_ui import WikiModule

from macropost.api import IMacroPoster

class AddMinuteMacro(WikiMacroBase):
    """"""A macro to add meeting minutes to a page more interactively. Usage:
    {{{
    [[AddMinute]]
    }}}
    The macro accepts one optional argument that allows appending
    to the wiki page even though user may not have modify permission:
    {{{
    [[AddMinute(appendonly)]]
    }}}
    """"""
    implements(IWikiMacroProvider, IRequestFilter, IMacroPoster)

    def expand_macro(self, formatter, name, content):
        
        args, kw = parse_args(content)
        req = formatter.req
        context = formatter.context
        
        # Prevent multiple inclusions - store a temp in req
        if hasattr(req, 'AddMinutemacro'):
            raise TracError('\'AddMinute\' macro cannot be included twice.')
        req.AddMinutemacro = True
        
        # Prevent it being used outside of wiki page context
        resource = context.resource
        if not resource.realm == 'wiki':
            raise TracError('\'AddMinute\' macro can only be used in Wiki pages.')
        
        # Setup info and defaults
        authname = req.authname
        page = WikiPage(self.env, resource)
        page_url = req.href.wiki(resource.id)
        wikipreview = req.args.get(""preview"", """")
        
        # Can this user add a minute to this page?
        appendonly = ('appendonly' in args)
        canminute = False
        if page.readonly:
            if 'WIKI_ADMIN' in req.perm(resource):
                canminute = True
        elif 'WIKI_MODIFY' in req.perm(resource):
            canminute = True
        elif appendonly and 'WIKI_VIEW' in req.perm(resource):
            canminute = True
        else:
            raise TracError('Error: Insufficient privileges to AddMinute')
        
        # Get the data from the POST
        minute = req.args.get(""AddMinute"", """")
        preview = req.args.get(""previewAddMinute"", """")
        cancel = req.args.get(""cancelAddMinute"", """")
        submit = req.args.get(""submitAddMinute"", """")
        if not cancel and req.authname == 'anonymous':
            authname = req.args.get(""authorAddMinute"", authname)
        
        # Ensure [[AddMinute]] is not present in minute, so that infinite
        # recursion does not occur.
        minute = to_unicode(re.sub('(^|[^!])(\[\[AddMinute)', '\\1!\\2', minute))
        
        the_preview = the_message = the_form = tag()

        # If we are submitting or previewing, inject minute as it should look
        if canminute and minute and (preview or submit):
            heading = tag.h4(""minute by "", authname, "" on "",
                        to_unicode(time.strftime('%c', time.localtime())),
                        id=""minutepreview"")
            if preview:
                the_preview = tag.div(heading,
                                format_to_html(self.env, context, minute),
                                class_=""wikipage"", id=""preview"")
        
        # Check the form_token
        form_ok = True
        if submit and req.args.get('__FORM_TOKEN','') != req.form_token:
            form_ok = False
            the_message = tag.div(tag.strong(""ERROR: ""),
                ""AddMinute received incorrect form token. ""
                ""Do you have cookies enabled?"",
                class_=""system-message"")
        
        # When submitting, inject minute before macro
        if minute and submit and canminute and form_ok:
            submitted = False
            newtext = """"
            for line in page.text.splitlines():
                if line.find('[[AddMinute') == 0:
                    newtext += ""%s\n"" % (minute)
                    submitted = True
                newtext += line+""\n""
            if submitted:
                page.text = newtext
                
                # Let the wiki page manipulators have a look at the
                # submission.
                valid = True
                req.args.setdefault('minute', 'Minute added.')
                try:
                    for manipulator in WikiModule(self.env).page_manipulators:
                        for field, message in manipulator.validate_wiki_page(req, page):
                            valid = False
                            if field:
                                the_message += tag.div(tag.strong(""invalid field '%s': "" % field),
                                                       message,
                                                       class_=""system-message"")
                            else:
                                the_message += tag.div(tag.strong(""invalid: ""),
                                                       message,
                                                       class_=""system-message"")

                # The TracSpamfilterPlugin does not generate messages,
                # but throws RejectContent.
                except TracError, s:
                    valid = False
                    the_message += tag.div(tag.strong(""ERROR: ""), s, class_=""system-message"")

                if valid:        
                    page.save(authname, req.args['minute'], req.environ['REMOTE_ADDR'])
                    # We can't redirect from macro as it will raise RequestDone
                    # which like other macro errors gets swallowed in the Formatter.
                    # We need to re-raise it in a post_process_request instead.
                    try:
                        self.env.log.debug(
                            ""AddMinute saved - redirecting to: %s"" % page_url)
                        req._outheaders = []
                        req.redirect(page_url)
                    except RequestDone:
                        req.AddMinute_raise = True
            else:
                the_message = tag.div(tag.strong(""ERROR: ""), ""[[AddMinute]] ""
                          ""macro call must be the only content on its line. ""
                          ""Could not add minute."",
                          class_=""system-message"")

        the_form = tag.form(
                    tag.fieldset(
                        tag.legend(""Add Minute""),
                        tag.div(
                            (wikipreview and ""Page preview..."" or None),
                            tag.textarea((not cancel and minute or """"),
                                        class_=""wikitext"",
                                        id=""AddMinute"",
                                        name=""AddMinute"",
                                        cols=80, rows=5,
                                    disabled=(not canminute and ""disabled"" or None)),
                            class_=""field""
                        ),
                        (req.authname == 'anonymous' and tag.div(
                            tag.label(""Your email or username:"",
                                    for_=""authorAddMinute""),
                            tag.input(id=""authorAddMinute"", type=""text"",
                                    size=30, value=authname)
                        ) or None),
                        tag.input(type=""hidden"", name=""__FORM_TOKEN"",
                                        value=req.form_token),
                        tag.div(
                            tag.input(value=""Add Minute"", type=""submit"",
                                    name=""submitAddMinute"", size=30,
                                    disabled=(not canminute and ""disabled"" or None)),
                            tag.input(value=""Preview Minute"", type=""submit"",
                                    name=""previewAddMinute"",
                                    disabled=(not canminute and ""disabled"" or None)),
                            tag.input(value=""Cancel"", type=""submit"",
                                    name=""cancelAddMinute"",
                                    disabled=(not canminute and ""disabled"" or None)),
                            class_=""buttons""
                        ),
                    ),
                    method=""post"",
                    action=page_url+""#minuteing"",
                )

        if not wikipreview:
            # Wiki edit preview already adds this javascript file
            add_script(req, 'common/js/wikitoolbar.js')
        
        return tag.div(the_preview, the_message, the_form, id=""minuteing"")
    
    # IMacroPoster method
    
    def process_macro_post(self, req):
        self.log.debug('AddMinuteMacro: Got a POST')

    # IRequestFilter methods

    def pre_process_request(self, req, handler):
        return handler

    def post_process_request(self, req, template, data, content_type):
        if hasattr(req, 'AddMinute_raise'):
            self.env.log.debug(""AddMinuteMacro: Re-raising RequestDone from redirect"")
            del(req.AddMinute_raise)
            raise RequestDone
        return template, data, content_type


}}}


",Mogga
