ANN: CondFieldsGenshiPlugin

26 views
Skip to first unread message

Reinhard Wobst

unread,
Jun 1, 2012, 5:30:05 AM6/1/12
to Trac Users
Hi all,

based on the CondFieldsPlugin
http://trac-hacks.org/wiki/CondFieldsPlugin and the patch
"blackmagic-conditionalfields.patch" in
http://trac-hacks.org/ticket/2486
which did not match with newer releases of Trac 0.11, I created a new
ticket:

http://trac-hacks.org/wiki/CondFieldsGenshiPlugin

With the help of this Trac plugin you can hide or show fields when
creating or viewing a ticket, depending on the ticket type. Only the
presentation changes, not the contents of the ticket.

This plugin is completely based on Genshi now instead of using
Javascript. Moreover, you can select whether selected fields are
hidden
or shown by default.

It runs stable under Trac 0.12 (Trac 0.11 was not tested yet but it
should run there - either I will test it soon, or somebody from this
group). A bugfix was done for the "type" field:

When the ticket type is given as an URL parameter only:

.../newticket?type=task

and the ticket type field is disabled, this plugin works
nevertheless.
The type field label is extended by "(Fixed)" in this case now.


*Comparison with DynamicFieldsPlugin*

The DynamicFieldsPlugin (http://trac-hacks.org/wiki/
DynamicFieldsPlugin)
has similar and more powerful features than CondFieldsGenshi but it
can
change the field contents: When the user changes the type and some
fields vanish, the values in these fields are lost and will not appear
again even if the former type is restored. A rule
"(fieldname).clear_on_hide = false" avoids this but then the fields
are
shown anyway.

There are other problems reported about the DynamicFieldsPlugin:

- Very slow performance for a larger number of custom fields are
obviously caused by javascript in the DynamicFieldsPlugin.
CondFieldsGenshi is based on Genshi and thus does filtering on the
server
side with higher performance.

- Problems when sorting the fields as reported in [4] are also due to
some bug in the javascript and should not happen for
CondFieldsGenshi.


*Possible Extensions*

It should be easy to display or even change fields dependend on other
parameters but I leave this up to user's wishes :-)

Reinhard Wobst

Reinhard Wobst

unread,
Jun 4, 2012, 12:35:48 PM6/4/12
to Trac Users
Addenda: meanwhile I tested the plugin under Trac 0.11, too - it runs.

Reinhard Wobst

unread,
Jan 14, 2013, 11:18:09 AM1/14/13
to trac-...@googlegroups.com
Now I upgraded to version 0.2: Patterns can also be negated, i.e.

default = disable
field3.type_cond = !task,enhancement

means that field3 only if the ticket type is neither "task" nor "enhancement".

Reinhard
Reply all
Reply to author
Forward
0 new messages