web/views/calendar.py
changeset 3377 dd9d292b6a6d
parent 2996 866a2c135c33
child 3451 6b46d73823f5
equal deleted inserted replaced
3376:f5c69485381f 3377:dd9d292b6a6d
    42         __select__ = implements(ICalendarable)
    42         __select__ = implements(ICalendarable)
    43         need_navigation = False
    43         need_navigation = False
    44         content_type = 'text/calendar'
    44         content_type = 'text/calendar'
    45         title = _('iCalendar')
    45         title = _('iCalendar')
    46         templatable = False
    46         templatable = False
    47         id = 'ical'
    47         __regid__ = 'ical'
    48 
    48 
    49         def call(self):
    49         def call(self):
    50             ical = iCalendar()
    50             ical = iCalendar()
    51             for i in range(len(self.rset.rows)):
    51             for i in range(len(self.rset.rows)):
    52                 task = self.complete_entity(i)
    52                 task = self.complete_entity(i)
    69 class hCalView(EntityView):
    69 class hCalView(EntityView):
    70     """A calendar view that generates a hCalendar file
    70     """A calendar view that generates a hCalendar file
    71 
    71 
    72     Does apply to ICalendarable compatible entities
    72     Does apply to ICalendarable compatible entities
    73     """
    73     """
    74     id = 'hcal'
    74     __regid__ = 'hcal'
    75     __select__ = implements(ICalendarable)
    75     __select__ = implements(ICalendarable)
    76     need_navigation = False
    76     need_navigation = False
    77     title = _('hCalendar')
    77     title = _('hCalendar')
    78     #templatable = False
    78     #templatable = False
    79 
    79 
    92             self.w(u'</div>')
    92             self.w(u'</div>')
    93         self.w(u'</div>')
    93         self.w(u'</div>')
    94 
    94 
    95 
    95 
    96 class CalendarItemView(EntityView):
    96 class CalendarItemView(EntityView):
    97     id = 'calendaritem'
    97     __regid__ = 'calendaritem'
    98 
    98 
    99     def cell_call(self, row, col, dates=False):
    99     def cell_call(self, row, col, dates=False):
   100         task = self.complete_entity(row)
   100         task = self.complete_entity(row)
   101         task.view('oneline', w=self.w)
   101         task.view('oneline', w=self.w)
   102         if dates:
   102         if dates:
   104                 self.w('<br/>' % self.req._('from %(date)s' % {'date': self.format_date(task.start)}))
   104                 self.w('<br/>' % self.req._('from %(date)s' % {'date': self.format_date(task.start)}))
   105                 self.w('<br/>' % self.req._('to %(date)s' % {'date': self.format_date(task.stop)}))
   105                 self.w('<br/>' % self.req._('to %(date)s' % {'date': self.format_date(task.stop)}))
   106                 self.w('<br/>to %s'%self.format_date(task.stop))
   106                 self.w('<br/>to %s'%self.format_date(task.stop))
   107 
   107 
   108 class CalendarLargeItemView(CalendarItemView):
   108 class CalendarLargeItemView(CalendarItemView):
   109     id = 'calendarlargeitem'
   109     __regid__ = 'calendarlargeitem'
   110 
   110 
   111 
   111 
   112 class _TaskEntry(object):
   112 class _TaskEntry(object):
   113     def __init__(self, task, color, index=0):
   113     def __init__(self, task, color, index=0):
   114         self.task = task
   114         self.task = task
   127         return task.start and task.stop and task.start.isocalendar() ==  task.stop.isocalendar()
   127         return task.start and task.stop and task.start.isocalendar() ==  task.stop.isocalendar()
   128 
   128 
   129 
   129 
   130 class OneMonthCal(EntityView):
   130 class OneMonthCal(EntityView):
   131     """At some point, this view will probably replace ampm calendars"""
   131     """At some point, this view will probably replace ampm calendars"""
   132     id = 'onemonthcal'
   132     __regid__ = 'onemonthcal'
   133     __select__ = implements(ICalendarable)
   133     __select__ = implements(ICalendarable)
   134     need_navigation = False
   134     need_navigation = False
   135     title = _('one month')
   135     title = _('one month')
   136 
   136 
   137     def call(self):
   137     def call(self):
   318         self.w(u'</td>')
   318         self.w(u'</td>')
   319 
   319 
   320 
   320 
   321 class OneWeekCal(EntityView):
   321 class OneWeekCal(EntityView):
   322     """At some point, this view will probably replace ampm calendars"""
   322     """At some point, this view will probably replace ampm calendars"""
   323     id = 'oneweekcal'
   323     __regid__ = 'oneweekcal'
   324     __select__ = implements(ICalendarable)
   324     __select__ = implements(ICalendarable)
   325     need_navigation = False
   325     need_navigation = False
   326     title = _('one week')
   326     title = _('one week')
   327 
   327 
   328     def call(self):
   328     def call(self):