On Thu, Mar 16, 2006 at 09:47:36AM +1100, Alec Thomas wrote:
> On Wed, Mar 15, 2006 at 06:53:06PM +0100, Christian Boos wrote:
> > Alec Thomas wrote:
> > >...
> > >All of this is in the top part of the WorkFlow page [1]. Please take a
> > >look and reply with any comments/criticisms. In particular use cases
> > >that could not be handled by the proposed system would be good.
> > >  
> > 
> > I know that there is explicit support for ''hidden'' fields,
> > but would it be possible to easily implement
> > http://projects.edgewall.com/trac/ticket/1580
> > ?
> 
> You could definitely implement it as an ITicketManipulator plugin, which
> might be better than having it as core functionality? It seems to be a
> bit of a judgement call as to what goes in as core functionality and
> what stays as plugins :)

This would do it. Nice and simple.

class HideConfusingFields(Component):
    implements(ITicketManipulator)

    def prepare_ticket_for_render(self, req, ticket, fields, actions):
        confusing_fields = self.env.config.get('ticket', 'confusing_fields', '')
        hide_fields = [f.strip() for f in 
                       confusing_fields.split(',') if f.strip()]
        for field in fields:
            if field['name'] in hide_fields:
                field['hidden'] = True
                field['editable'] = False

    def validate_ticket(self, req, ticket):
        pass

-- 
Evolution: Taking care of those too stupid to take care of themselves.
_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to