| 13 | | date_format = Option('datefield', 'format', default='dmy', |
|---|
| 14 | | doc='The format to use for dates. Valid values are dmy, mdy, and ymd.') |
|---|
| | 15 | date_format = Option('datefield', 'format', default='dd/mm/yy', |
|---|
| | 16 | doc='The format to use for dates. d - day of month (no ' + |
|---|
| | 17 | 'leading zero), dd - day of month (two digits), m - month ' + |
|---|
| | 18 | '(no leading zero), mm - month (two digits), y - year (two ' + |
|---|
| | 19 | 'digits), yy - year (four digits), D - name of day (short), DD ' + |
|---|
| | 20 | '- name of day (long), M - name of month (short), MM - name of ' + |
|---|
| | 21 | 'month (long) "..." - literal text \'\' - single quote, ' + |
|---|
| | 22 | 'anything else - literal text.') |
|---|
| 25 | | req.hdf['datefield.ids'] = list(self._date_fields()) |
|---|
| 26 | | req.hdf['datefield.calendar'] = req.href.chrome('datefield', 'calendar.png') |
|---|
| 27 | | req.hdf['datefield.format'] = self.date_format |
|---|
| 28 | | req.hdf['datefield.sep'] = self.date_sep |
|---|
| 29 | | |
|---|
| 30 | | return 'datefield.cs', 'text/javascript' |
|---|
| | 33 | self.log.debug("in datefield process_request") |
|---|
| | 34 | global datedict |
|---|
| | 35 | datefield = {} |
|---|
| | 36 | datefield['calendar'] = req.href.chrome('datefield', 'calendar.png') |
|---|
| | 37 | datefield['ids'] = list(self._date_fields()) |
|---|
| | 38 | datefield['format'] = self.date_format |
|---|
| | 39 | return 'datefield.html', {'datefield': datefield},'text/javascript' |
|---|
| 38 | | add_script(req, 'datefield/jquery.pack.js') |
|---|
| 39 | | add_script(req, 'datefield/jquery.datePicker.js') |
|---|
| 40 | | add_stylesheet(req, 'datefield/datePicker.css') |
|---|
| 41 | | |
|---|
| 42 | | # Add my dynamic JS junk |
|---|
| 43 | | idx = 0 |
|---|
| 44 | | while req.hdf.get('chrome.scripts.%i.href'%idx): |
|---|
| 45 | | idx += 1 |
|---|
| 46 | | req.hdf['chrome.scripts.%s'%idx] = {'href': req.href.datefield('datefield.js'), 'type': 'text/javascript'} |
|---|
| 47 | | return template, content_type |
|---|
| | 47 | add_script(req, 'datefield/jquery-ui.js') |
|---|
| | 48 | #add_stylesheet(req, 'datefield/jquery-ui.css') |
|---|
| | 49 | |
|---|
| | 50 | req.chrome['scripts'].append({'href': req.href.datefield('datefield.js'), 'type': 'text/javascript'}) |
|---|
| | 51 | return template, data, content_type |
|---|