| 1 | = Custom Ticket Fields = |
| 2 | Trac support adding custom, user-defined, fields to the ticket module. Using custom fields, you can add typed, site-specific, properties to tickets. |
| 3 | |
| 4 | '''Note: In Trac 0.8, this feature is still experimental.''' |
| 5 | |
| 6 | == Configuriation == |
| 7 | Configuring custom ticket fields is done in the TracIni config file. |
| 8 | |
| 9 | All field definitions should be under a section named [ticket-custom] in the ini-file. |
| 10 | |
| 11 | The syntax of each field definition is: |
| 12 | {{{ |
| 13 | FIELD_NAME = TYPE |
| 14 | (FIELD_NAME.OPTION = VALUE) |
| 15 | ... |
| 16 | }}} |
| 17 | Looking at the example below should help explain the syntax. |
| 18 | |
| 19 | === Available Field Types and Options === |
| 20 | * '''text''': A simple (one line) text field. |
| 21 | * label: Descriptive label. |
| 22 | * value: Default value. |
| 23 | * order: Sort order placement. (Determines relative placement in forms.) |
| 24 | * '''checkbox''': A boolean value check box. |
| 25 | * label: Descriptive label. |
| 26 | * value: Default value (0 or 1). |
| 27 | * order: Sort order placement. |
| 28 | * '''select''': Drop-down select box. Uses a list of values. |
| 29 | * options: List of values, separated by '''|''' (vertical pipe). |
| 30 | * value: Default value (Item #, starting at 0). |
| 31 | * order: Sort order placement. |
| 32 | * '''radio''': Radio buttons. Essentially the same as '''select'''. |
| 33 | * label: Descriptive label. |
| 34 | * options: List of values, separated by '''|''' (vertical pipe). |
| 35 | * value: Default value (Item #, starting at 0). |
| 36 | * order: Sort order placement. |
| 37 | * '''textarea''': Multi-line text area. |
| 38 | * label: Descriptive label. |
| 39 | * value: Default text. |
| 40 | * width: Width in columns. |
| 41 | * height: Height in lines. |
| 42 | * order: Sort order placement. |
| 43 | |
| 44 | === Sample Config === |
| 45 | {{{ |
| 46 | [ticket-custom] |
| 47 | test_one = text |
| 48 | test_one.label = Just a text box |
| 49 | |
| 50 | test_two = text |
| 51 | test_two.label = Another text-box |
| 52 | test_two.value = Just a default value |
| 53 | |
| 54 | test_three = checkbox |
| 55 | test_three.label = Some checkbox |
| 56 | test_three.value = 1 |
| 57 | |
| 58 | test_four = select |
| 59 | test_four.label = My selectbox |
| 60 | test_four.options = one|two|third option|four |
| 61 | test_four.value = 2 |
| 62 | |
| 63 | test_five = radio |
| 64 | test_five.label = Radio buttons are fun |
| 65 | test_five.options = uno|dos|tres|cuatro|cinco |
| 66 | test_five.value = 1 |
| 67 | |
| 68 | test_six = textarea |
| 69 | test_six.label = This is a large textarea |
| 70 | test_six.value = Default text |
| 71 | test_six.width = 60 |
| 72 | test_six.height = 30 |
| 73 | }}} |
| 74 | |
| 75 | ---- |
| 76 | See also: TracTickets, TracIni |