control ticket submission policy based on field information
Description
The TicketSubmitPolicyPlugin allows control of ticket submission based on fields and their values. Actions are configurable via an extension point, ITicketSubmitPolicy. Javascript is used to enforce the policy without leaving the page.
Each policy has a condition, which controls when the policy is applied, and actions that are applied when the condition is met.
The condition is in the form of "field" "comparitor" "field value". The field is a field of the ticket (e.g. 'type'), the field value is its value (e.g. 'defect'), the comparitor is some rule that is applied to the field and its value (e.g. 'is not').
The following comparitors have been implemented:
- is
- is not
- is in : the field is one of a list
- is not in
This should probably become an extension point so that these are easily pluggable.
"is in" and 'is not in' have NOT been tested are PROBABLY CONTAIN BUGS! only use these if you want to test them or can contribute debugging data regarding them
Policy actions are an ExtensionPoint? of components fulfilling the ITicketSubmitPolicy interface. Bundled with the TicketSubmitPolicyPlugin are two such actions:
* requires : require fields before allowing form submission
* excludes : exclude fields from form display and submission
Each of these, and currently actions in general, take multiple arguments in the form of ticket fields.
Example
The following section in trac.ini excludes the version field excludes the version field if the type is not a defect and requires a version that is not blank if the type is a defect:
[ticket-submit-policy] policy1.condition = type is not defect policy1.excludes = version policy2.condition = type is defect policy2.requires = version
&&s may be used to join multiple conditions together, and multiple arguments may be supplied to requires and excludes as well:
[ticket-submit-policy] policy1.condition = type is defect && component is not component2 policy1.requires = version, milestone policy2.condition = type is not defect policy2.excludes = version, priority
The webadmin interface, available at /admin/ticket/submit, may also be used to configure the plugin:
Bugs/Feature Requests
Existing bugs and feature requests for TicketSubmitPolicyPlugin are here.
If you have any issues, create a new ticket.
Getting TicketSubmitPolicyPlugin
TicketSubmitPolicyPlugin requires python version 2.4 or greater.
Download the zipped source from here.
or
You can check out TicketSubmitPolicyPlugin from here using Subversion, or browse the source with Trac.
Recent Changes
[4842] by k0s on 11/18/08 20:08:29
hopefully fix some scoping problems
[4548] by k0s on 10/20/08 22:36:20
write current configuration to trac-admin panel, fixes #3383
[4547] by k0s on 10/20/08 21:57:11
(slightly) more intelligent handling of different types of comparitors; fixes #3949
[4546] by k0s on 10/20/08 21:17:59
display the list for "is in" and "is not in"; refs #3949
Author/Contributors
Originally developed at The Open Planning Project
Author: k0s
Contributors:
Attachments
- ticketsubmitadminUI.png (59.9 kB) -
the webamin interface for the TicketSubmitPolicyPlugin
, added by k0s on 07/09/08 20:39:43.