﻿ticket,summary,type,release,owner,status,created,modified,_description,_reporter
10804,Expand SortMilestoneVersion to cover Custom Query milestone field,enhancement,1.2,Franz,new,2013-01-16T23:13:20+01:00,2013-01-21T20:23:53+01:00,"Expand the plugin to cover the custom query milestone field as well.  Here are the changes to the SortMilestoneVersion class I made to get this to work:
{{{
#!python
class SortMilestoneVersion(Component):
    """"""Sorts drop-down lists of version and milestone regardless of the case and
make milestone a must field, when a default milestone is set.

Default behavior of Trac for sorting milestones is:
inbox, v1, v2, Inbox, V1, V2

This plugin sorts it as following:
inbox, Inbox, v1, V1, v2, V2
""""""
    implements (ITemplateStreamFilter)

    #ITemplateStreamFilter
    def filter_stream(self, req, method, filename, stream, data):
        if filename and (filename == 'ticket.html' or filename == 'newticket' or filename == 'query.html'):
#            print ""filename '%s' matches"" % filename
            if not data:
                return stream
            try:
                fields = data['fields']
                if not fields:
                    return stream
                version = self.get_field_list(fields, 'version')
                version['options'].sort(key=unicode.lower)

                milestones = self.get_field_list(fields, 'milestone')
                if self.config.get('ticket', 'default_milestone'):
                    milestones['optional'] = False

                for opt in milestones['optgroups']:
                    opt['options'].sort(key=unicode.lower)

            except Exception, e:
                self.log.error('error has occured by sorting: %s' % e)
        return stream

    def get_field_list(self, fields, fieldname):
        if not fields or not fieldname:
            return None
        for fld in fields:
            if isinstance(fld, dict):
                if fld['name'] == fieldname:
                    return fld
            elif isinstance(fld, str):
                if fields[fld]['name'] == fieldname:
                    return fields[fld]
            else:
                pass
        return None # return None if fieldname not found
}}}",joshua@…
8842,Request for a button to switch between wysiwyg and textarea,enhancement,0.11,Franz,new,2011-05-28T14:56:20+02:00,2011-05-28T14:56:20+02:00,"It would be cool if user can select the existing textarea (default) or wysiwyg. This way old ticket can be viewed as usual. Thanks for the plugin.
",anonymous
