Changeset 3976
- Timestamp:
- 07/06/08 16:30:19 (5 months ago)
- Files:
-
- datefieldplugin/0.11/datefield/filter.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
datefieldplugin/0.11/datefield/filter.py
r3974 r3976 8 8 import traceback 9 9 10 datedict= {'y':'1996', 'm':'01', 'd': '01',}11 12 10 class DateFieldModule(Component): 13 11 """A module providing a JS date picker for custom fields.""" 14 12 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.') 13 date_format = Option('datefield', 'format', default='dmy', 14 doc='The format to use for dates. Valid values are dmy, mdy, and ymd.') 15 first_day = Option('datefield', 'first_day', default='0', 16 doc='First day of the week. 0 == Sunday.') 23 17 date_sep = Option('datefield', 'separator', default='/', 24 doc='The separator character to use for dates.')18 doc='The separator character to use for dates.') 25 19 26 20 implements(IRequestFilter, IRequestHandler, ITemplateProvider, ITicketManipulator) … … 31 25 32 26 def process_request(self, req): 33 self.log.debug("in datefield process_request") 34 global datedict 27 format = { 'dmy': 'dd%smm%syy', 28 'mdy': 'mm%sdd%syy', 29 'ymd': 'yy%smm%sdd' 30 }[self.date_format]%(self.date_sep, self.date_sep) 31 32 print format 35 33 datefield = {} 36 34 datefield['calendar'] = req.href.chrome('datefield', 'calendar.png') 37 35 datefield['ids'] = list(self._date_fields()) 38 datefield['format'] = self.date_format 36 datefield['format'] = format 37 datefield['first_day'] = self.first_day 39 38 return 'datefield.html', {'datefield': datefield},'text/javascript' 40 39
