web/views/calendar.py
branchstable
changeset 1881 75540944ae18
parent 1802 d628defebc17
child 1977 606923dff11b
equal deleted inserted replaced
1880:293fe4b49e28 1881:75540944ae18
     2 
     2 
     3 :organization: Logilab
     3 :organization: Logilab
     4 :copyright: 2001-2009 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 __docformat__ = "restructuredtext en"
       
     8 _ = unicode
     7 
     9 
     8 from datetime import datetime, date, timedelta
    10 from datetime import datetime, date, timedelta
     9 
    11 
    10 from logilab.mtconverter import html_escape
    12 from logilab.mtconverter import html_escape
    11 
    13 
    12 from cubicweb.interfaces import ICalendarable
    14 from cubicweb.interfaces import ICalendarable
    13 from cubicweb.selectors import implements
    15 from cubicweb.selectors import implements
    14 from cubicweb.utils import strptime, date_range, todate, todatetime
    16 from cubicweb.utils import strptime, date_range, todate, todatetime
    15 from cubicweb.view import EntityView
    17 from cubicweb.view import EntityView
    16 
    18 
    17 _ = unicode
       
    18 
    19 
    19 # useful constants & functions ################################################
    20 # useful constants & functions ################################################
    20 
    21 
    21 ONEDAY = timedelta(1)
    22 ONEDAY = timedelta(1)
    22 
    23 
    79         self.w(u'<div class="hcalendar">')
    80         self.w(u'<div class="hcalendar">')
    80         for i in range(len(self.rset.rows)):
    81         for i in range(len(self.rset.rows)):
    81             task = self.complete_entity(i)
    82             task = self.complete_entity(i)
    82             self.w(u'<div class="vevent">')
    83             self.w(u'<div class="vevent">')
    83             self.w(u'<h3 class="summary">%s</h3>' % html_escape(task.dc_title()))
    84             self.w(u'<h3 class="summary">%s</h3>' % html_escape(task.dc_title()))
    84             self.w(u'<div class="description">%s</div>' % html_escape(task.dc_description()))
    85             self.w(u'<div class="description">%s</div>'
       
    86                    % task.dc_description(format='text/html'))
    85             if task.start:
    87             if task.start:
    86                 self.w(u'<abbr class="dtstart" title="%s">%s</abbr>' % (task.start.isoformat(), self.format_date(task.start)))
    88                 self.w(u'<abbr class="dtstart" title="%s">%s</abbr>' % (task.start.isoformat(), self.format_date(task.start)))
    87             if task.stop:
    89             if task.stop:
    88                 self.w(u'<abbr class="dtstop" title="%s">%s</abbr>' % (task.stop.isoformat(), self.format_date(task.stop)))
    90                 self.w(u'<abbr class="dtstop" title="%s">%s</abbr>' % (task.stop.isoformat(), self.format_date(task.stop)))
    89             self.w(u'</div>')
    91             self.w(u'</div>')