6 | | This plugin allows for validating custom fields as dates in tickets. Just set up the field as a [http://trac.edgewall.org/wiki/TracTicketsCustomFields custom field], then use these extra options in the trac.ini file: |
7 | | ''fieldname''.date = true:: |
8 | | Enable extra date stuff on this field. |
9 | | ''fieldname''.date_empty = true:: |
10 | | Allow this field to be blank.(default value "due_date.value" must be empty) |
11 | | or use the CustomFieldAdminPlugin to create a date field: |
| 6 | This plugin allows for validating custom fields as dates in tickets and also for milestones `due_date` field (some restriction apply). |
| 7 | |
| 8 | Currently this will only validate that the given input looks like the specified date format (see below). Date range checking could be added if someone asks nicely enough. |
35 | | '''The following options are available since [7192]''' |
36 | | ''months = 1'':: |
37 | | How many months to show at once? |
38 | | ''milestone = false'':: |
39 | | Use datepicker for milestone due/complete? (format= must match your locale) |
40 | | ''weeknumbers = false'':: |
41 | | Show ISO8601 week numbers? |
42 | | ''panel = false'':: |
43 | | Show a button panel with "Today" and "Done" buttons (at bottom)? |
44 | | ''change_month = false'':: |
45 | | Show a dropdown with month selection? |
46 | | ''change_year = false'':: |
47 | | Show a dropdown with year selection? |
48 | | ''match_request = '':: |
49 | | Use datepicker on arbitrary request paths. Use text fields with class=datepick in your template, and configure the start of request path (in list format), like: ''match_request = /query,/other_path'' |
| 28 | 1. '''Install''' globally with: |
| 29 | {{{ |
| 30 | sudo easy_install https://trac-hacks.org/svn/datefieldplugin/0.11/ |
| 31 | }}} |
| 32 | 1. '''Enable''' the plugin by updating TracIni file (..../trac.ini) as follows: |
| 33 | {{{ |
| 34 | [components] |
| 35 | datefield.* = enabled |
| 36 | }}} |
| 37 | 1. '''Configure''' the project management support for the plugin in its own configuration section, placed into 'trac.ini' file as follows: |
| 38 | 1. To add a Due Date, just set up the field as a [http://trac.edgewall.org/wiki/TracTicketsCustomFields custom field], or use the CustomFieldAdminPlugin (image right) to create a date field: [[Image(customfields.jpg, right, 20%)]] |
| 39 | {{{ |
| 40 | [ticket-custom] |
| 41 | due_date = text |
| 42 | due_date.date = true |
| 43 | due_date.label = Due Date |
| 44 | due_date.value = MM-DD-YYYY |
| 45 | due_date.date_empty = true |
| 46 | }}} |
| 47 | 1. Site-wide defaults for macro arguments may be set at [datefield] section. More details about them see [#Arguments #Arguments section]. |
| 48 | {{{ |
| 49 | [datefield] |
| 50 | format = mdy |
| 51 | separator = - |
| 52 | first_day = 1 |
| 53 | }}} |
| 54 | 1. '''Restart''' web server on command line: |
| 55 | {{{ |
| 56 | #!sh |
| 57 | $ sudo /etc/init.d/apache2 restart |
| 58 | }}} |
53 | | If you have the AutoQueryPlugin installed, you'll need to patch the DateFieldPlugin to work with it, see [http://trac-hacks.org/ticket/6796#comment:4 comment:4:ticket:6796]. |
| 62 | This plugin can be controlled with a number of arguments, inside `[datefield]` section contained in `trac.ini` configuration file: |
| 63 | |
| 64 | ||'''Argument''' ||'''Version''' ||'''Description''' ||'''Default[[BR]]value''' |
| 65 | || `format`|| ||The format to use for dates. valid formats are `dmy`, `mdy`, and `ymd` || `dmy` || |
| 66 | || `separator`|| ||The separator character to use for dates. Possible values are `-` or `.` or `/` || `/` || |
| 67 | || `first_day`|| >= [6118] ||First day of the week (0=Sunday .. 6=Saturday) || `0` || |
| 68 | || `months`|| >= [7192] ||How many months to show at once? || `1` || |
| 69 | || `milestone`|| >= [7192] ||Use datepicker for milestone due/complete fields? (format= must match your locale) If you turn this on, you must use `MM/DD/YYYY` for the date format. Set format to `mdy` and separator to `/`. || `false` || |
| 70 | || `weeknumbers`|| >= [7192] ||Show ISO8601 week number in calendar? || `false` || |
| 71 | || `panel`|| >= [7192] ||Show panel with a "Today" and "Done" buttons (at bottom)? || `false` || |
| 72 | || `change_month`|| >= [7192] ||Show a dropdown with month selection? || `false` || |
| 73 | || `change_year`|| >= [7192] ||Show a dropdown with year selection? || `false` || |
| 74 | || `match_request`|| >= [7192] ||Use datepicker on arbitrary request paths. Use text fields with class=datepick in your template, and configure the start of request path (in list format), like: ''match_request = /query,/other_path'' || `` || |
| 75 | || `months`|| >= [7192] ||Number of months visible in datepicker || `1` || |
| 76 | |
| 77 | * There are many other options, but you need to modify the `datefield.html` template if you want to use them. See [http://docs.jquery.com/UI/Datepicker] |
71 | | Download the source zip and unzip it to a folder. |
72 | | |
73 | | From a command prompt, run 'setup.py bdist_egg'. This builds an 'egg' installation file to a new 'dist' directory. |
74 | | |
75 | | Got to your Trac Admin page, select Plugins, click Browse, select the egg file, then click install. |
76 | | |
77 | | == Source == |
78 | | |
79 | | The 0.11 version works with Trac 0.12. |
80 | | |
81 | | You can check out DateFieldPlugin from [http://trac-hacks.org/svn/datefieldplugin/0.11 here] using Subversion, or [source:datefieldplugin browse the source] with Trac. |
82 | | |
83 | | == Example == |
84 | | |
85 | | To enable: |
86 | | {{{ |
87 | | [components] |
88 | | datefield.* = enabled |
89 | | }}} |
90 | | |
91 | | To add a Due Date: |
92 | | {{{ |
93 | | [ticket-custom] |
94 | | due_date = text |
95 | | due_date.date = true |
96 | | due_date.label = Due Date |
97 | | due_date.value = MM-DD-YYYY |
98 | | due_date.date_empty = true |
99 | | }}} |
100 | | |
101 | | To configure: |
102 | | {{{ |
103 | | [datefield] |
104 | | format = mdy |
105 | | separator = - |
106 | | first_day = 1 |
107 | | }}} |
108 | | |
109 | | [[Image(DateFieldPlugin.png)]] |
| 94 | Download the zipped source from '''[download:datefieldplugin here]'''. |