47 __regid__ = '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.cw_rset.rows)): |
51 for i in range(len(self.cw_rset.rows)): |
52 task = self.complete_entity(i) |
52 task = self.cw_rset.complete_entity(i, 0) |
53 event = ical.add('vevent') |
53 event = ical.add('vevent') |
54 event.add('summary').value = task.dc_title() |
54 event.add('summary').value = task.dc_title() |
55 event.add('description').value = task.dc_description() |
55 event.add('description').value = task.dc_description() |
56 if task.start: |
56 if task.start: |
57 event.add('dtstart').value = task.start |
57 event.add('dtstart').value = task.start |
78 #templatable = False |
78 #templatable = False |
79 |
79 |
80 def call(self): |
80 def call(self): |
81 self.w(u'<div class="hcalendar">') |
81 self.w(u'<div class="hcalendar">') |
82 for i in range(len(self.cw_rset.rows)): |
82 for i in range(len(self.cw_rset.rows)): |
83 task = self.complete_entity(i) |
83 task = self.cw_rset.complete_entity(i, 0) |
84 self.w(u'<div class="vevent">') |
84 self.w(u'<div class="vevent">') |
85 self.w(u'<h3 class="summary">%s</h3>' % xml_escape(task.dc_title())) |
85 self.w(u'<h3 class="summary">%s</h3>' % xml_escape(task.dc_title())) |
86 self.w(u'<div class="description">%s</div>' |
86 self.w(u'<div class="description">%s</div>' |
87 % task.dc_description(format='text/html')) |
87 % task.dc_description(format='text/html')) |
88 if task.start: |
88 if task.start: |
89 self.w(u'<abbr class="dtstart" title="%s">%s</abbr>' % (task.start.isoformat(), self.format_date(task.start))) |
89 self.w(u'<abbr class="dtstart" title="%s">%s</abbr>' % (task.start.isoformat(), self._cw.format_date(task.start))) |
90 if task.stop: |
90 if task.stop: |
91 self.w(u'<abbr class="dtstop" title="%s">%s</abbr>' % (task.stop.isoformat(), self.format_date(task.stop))) |
91 self.w(u'<abbr class="dtstop" title="%s">%s</abbr>' % (task.stop.isoformat(), self._cw.format_date(task.stop))) |
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 __regid__ = '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.cw_rset.complete_entity(row, 0) |
101 task.view('oneline', w=self.w) |
101 task.view('oneline', w=self.w) |
102 if dates: |
102 if dates: |
103 if task.start and task.stop: |
103 if task.start and task.stop: |
104 self.w('<br/>' % self._cw._('from %(date)s' % {'date': self.format_date(task.start)})) |
104 self.w('<br/>' % self._cw._('from %(date)s' % {'date': self._cw.format_date(task.start)})) |
105 self.w('<br/>' % self._cw._('to %(date)s' % {'date': self.format_date(task.stop)})) |
105 self.w('<br/>' % self._cw._('to %(date)s' % {'date': self._cw.format_date(task.stop)})) |
106 self.w('<br/>to %s'%self.format_date(task.stop)) |
106 self.w('<br/>to %s'%self._cw.format_date(task.stop)) |
107 |
107 |
108 class CalendarLargeItemView(CalendarItemView): |
108 class CalendarLargeItemView(CalendarItemView): |
109 __regid__ = 'calendarlargeitem' |
109 __regid__ = 'calendarlargeitem' |
110 |
110 |
111 |
111 |
285 |
285 |
286 if len(self.cw_rset.column_types(0)) == 1: |
286 if len(self.cw_rset.column_types(0)) == 1: |
287 etype = list(self.cw_rset.column_types(0))[0] |
287 etype = list(self.cw_rset.column_types(0))[0] |
288 url = self.build_url(vid='creation', etype=etype, |
288 url = self.build_url(vid='creation', etype=etype, |
289 schedule=True, |
289 schedule=True, |
290 start=self.format_date(celldate), stop=self.format_date(celldate), |
290 start=self._cw.format_date(celldate), stop=self._cw.format_date(celldate), |
291 __redirectrql=self.cw_rset.printable_rql(), |
291 __redirectrql=self.cw_rset.printable_rql(), |
292 __redirectparams=self._cw.build_url_params(year=curdate.year, month=curmonth), |
292 __redirectparams=self._cw.build_url_params(year=curdate.year, month=curmonth), |
293 __redirectvid=self.__regid__ |
293 __redirectvid=self.__regid__ |
294 ) |
294 ) |
295 self.w(u'<div class="cmd"><a href="%s">%s</a></div>' % (xml_escape(url), self._cw._(u'add'))) |
295 self.w(u'<div class="cmd"><a href="%s">%s</a></div>' % (xml_escape(url), self._cw._(u'add'))) |
397 self.w(u'<th class="transparent"></th>') # column for hours |
397 self.w(u'<th class="transparent"></th>') # column for hours |
398 _today = date.today() |
398 _today = date.today() |
399 for i, day in enumerate(WEEKDAYS): |
399 for i, day in enumerate(WEEKDAYS): |
400 wdate = first_day_of_week + timedelta(i) |
400 wdate = first_day_of_week + timedelta(i) |
401 if wdate.isocalendar() == _today.isocalendar(): |
401 if wdate.isocalendar() == _today.isocalendar(): |
402 self.w(u'<th class="today">%s<br/>%s</th>' % (self._cw._(day), self.format_date(wdate))) |
402 self.w(u'<th class="today">%s<br/>%s</th>' % (self._cw._(day), self._cw.format_date(wdate))) |
403 else: |
403 else: |
404 self.w(u'<th>%s<br/>%s</th>' % (self._cw._(day), self.format_date(wdate))) |
404 self.w(u'<th>%s<br/>%s</th>' % (self._cw._(day), self._cw.format_date(wdate))) |
405 self.w(u'</tr>') |
405 self.w(u'</tr>') |
406 |
406 |
407 # build week calendar |
407 # build week calendar |
408 self.w(u'<tr>') |
408 self.w(u'<tr>') |
409 self.w(u'<td style="width:5em;">') # column for hours |
409 self.w(u'<td style="width:5em;">') # column for hours |