1 """html calendar views |
1 """html calendar views |
2 |
2 |
3 :organization: Logilab |
3 :organization: Logilab |
4 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 """ |
6 """ |
7 |
7 |
8 from mx.DateTime import DateTime, RelativeDateTime, Date, Time, today, Sunday |
8 from mx.DateTime import DateTime, RelativeDateTime, Date, Time, today, Sunday |
9 |
9 |
10 from logilab.mtconverter import html_escape |
10 from logilab.mtconverter import html_escape |
11 |
11 |
12 from cubicweb.interfaces import ICalendarViews |
12 from cubicweb.interfaces import ICalendarViews |
13 from cubicweb.common.utils import date_range |
13 from cubicweb.common.utils import date_range |
14 from cubicweb.common.selectors import implement_interface |
14 from cubicweb.selectors import implements |
15 from cubicweb.common.registerers import priority_registerer |
15 from cubicweb.common.registerers import priority_registerer |
16 from cubicweb.common.view import EntityView |
16 from cubicweb.common.view import EntityView |
17 |
17 |
18 # Define some useful constants |
18 # Define some useful constants |
19 ONE_MONTH = RelativeDateTime(months=1) |
19 ONE_MONTH = RelativeDateTime(months=1) |
31 ] |
31 ] |
32 |
32 |
33 class _CalendarView(EntityView): |
33 class _CalendarView(EntityView): |
34 """base calendar view containing helpful methods to build calendar views""" |
34 """base calendar view containing helpful methods to build calendar views""" |
35 __registerer__ = priority_registerer |
35 __registerer__ = priority_registerer |
36 __selectors__ = (implement_interface,) |
36 __selectors__ = implements(ICalendarViews) |
37 accepts_interfaces = (ICalendarViews,) |
|
38 need_navigation = False |
37 need_navigation = False |
39 |
38 |
40 # Navigation building methods / views #################################### |
39 # Navigation building methods / views #################################### |
41 |
40 |
42 PREV = u'<a href="%s"><<</a> <a href="%s"><</a>' |
41 PREV = u'<a href="%s"><<</a> <a href="%s"><</a>' |