web/views/calendar.py
author Julien Cristau <julien.cristau@logilab.fr>
Wed, 21 Oct 2015 20:17:44 +0200
changeset 10856 b839167d99a4
parent 10666 7f6b5f023884
permissions -rw-r--r--
[dataimport] dict.iteritems() → dict.items()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8941
7b26fe71404f drop xhtml content-type support (closes #2065651)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8307
diff changeset
     1
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4582
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    18
"""html calendar views"""
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
1881
75540944ae18 fix dc_description format arg
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1802
diff changeset
    20
__docformat__ = "restructuredtext en"
10666
7f6b5f023884 [py3k] replace '_ = unicode' in global scope (closes #7589459)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 9256
diff changeset
    21
from cubicweb import _
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    23
import copy
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    24
from datetime import timedelta
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25
2312
af4d8f75c5db use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    26
from logilab.mtconverter import xml_escape
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    27
from logilab.common.date import todatetime
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    28
8153
e225e70239ed [views] calendar id in CalendarView must be unique (closes #2143864)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 7183
diff changeset
    29
from cubicweb.utils import json_dumps, make_uid
9256
697a8181ba30 remove 3.9 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8941
diff changeset
    30
from cubicweb.predicates import adaptable
697a8181ba30 remove 3.9 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8941
diff changeset
    31
from cubicweb.view import EntityView, EntityAdapter
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    32
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    33
# useful constants & functions ################################################
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    34
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    35
ONEDAY = timedelta(1)
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    36
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    37
WEEKDAYS = (_("monday"), _("tuesday"), _("wednesday"), _("thursday"),
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    38
            _("friday"), _("saturday"), _("sunday"))
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    39
MONTHNAMES = ( _('january'), _('february'), _('march'), _('april'), _('may'),
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    40
               _('june'), _('july'), _('august'), _('september'), _('october'),
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    41
               _('november'), _('december')
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    42
               )
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    43
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    44
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    45
class ICalendarableAdapter(EntityAdapter):
6864
ea95004494a2 [adapters] fix #1424467 caused by precedence of bw compat method while the adapter is concret for a given class
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5895
diff changeset
    46
    __needs_bw_compat__ = True
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    47
    __regid__ = 'ICalendarable'
9256
697a8181ba30 remove 3.9 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8941
diff changeset
    48
    __abstract__ = True
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    49
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    50
    @property
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    51
    def start(self):
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    52
        """return start date"""
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    53
        raise NotImplementedError
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    54
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    55
    @property
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    56
    def stop(self):
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
    57
        """return stop date"""
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    58
        raise NotImplementedError
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    59
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    60
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
    61
# Calendar views ##############################################################
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    62
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    63
try:
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    64
    from vobject import iCalendar
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    65
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    66
    class iCalView(EntityView):
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    67
        """A calendar view that generates a iCalendar file (RFC 2445)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    68
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    69
        Does apply to ICalendarable compatible entities
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    70
        """
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    71
        __select__ = adaptable('ICalendarable')
4244
2c3de1953d00 rename need_navigation into paginable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4212
diff changeset
    72
        paginable = False
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    73
        content_type = 'text/calendar'
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    74
        title = _('iCalendar')
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    75
        templatable = False
3377
dd9d292b6a6d use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    76
        __regid__ = 'ical'
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    77
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    78
        def call(self):
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    79
            ical = iCalendar()
3451
6b46d73823f5 [api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3377
diff changeset
    80
            for i in range(len(self.cw_rset.rows)):
3457
0924d0d08d60 [api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3451
diff changeset
    81
                task = self.cw_rset.complete_entity(i, 0)
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    82
                event = ical.add('vevent')
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    83
                event.add('summary').value = task.dc_title()
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    84
                event.add('description').value = task.dc_description()
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    85
                icalendarable = task.cw_adapt_to('ICalendarable')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    86
                if icalendarable.start:
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    87
                    event.add('dtstart').value = icalendarable.start
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    88
                if icalendarable.stop:
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    89
                    event.add('dtend').value = icalendarable.stop
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    90
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    91
            buff = ical.serialize()
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    92
            if not isinstance(buff, unicode):
3451
6b46d73823f5 [api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3377
diff changeset
    93
                buff = unicode(buff, self._cw.encoding)
1644
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    94
            self.w(buff)
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    95
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    96
except ImportError:
45bec81a9e1c makes vobject optional
sylvain.thenault@logilab.fr
parents: 1635
diff changeset
    97
    pass
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    98
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
class hCalView(EntityView):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   100
    """A calendar view that generates a hCalendar file
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   101
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   102
    Does apply to ICalendarable compatible entities
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   103
    """
3377
dd9d292b6a6d use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
   104
    __regid__ = 'hcal'
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   105
    __select__ = adaptable('ICalendarable')
4244
2c3de1953d00 rename need_navigation into paginable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4212
diff changeset
   106
    paginable = False
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   107
    title = _('hCalendar')
524
eee3983e29e9 hcal is a microformat and can be inserted in html
sylvain.thenault@logilab.fr
parents: 431
diff changeset
   108
    #templatable = False
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   109
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   110
    def call(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   111
        self.w(u'<div class="hcalendar">')
3451
6b46d73823f5 [api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3377
diff changeset
   112
        for i in range(len(self.cw_rset.rows)):
3457
0924d0d08d60 [api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3451
diff changeset
   113
            task = self.cw_rset.complete_entity(i, 0)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   114
            self.w(u'<div class="vevent">')
2312
af4d8f75c5db use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   115
            self.w(u'<h3 class="summary">%s</h3>' % xml_escape(task.dc_title()))
1881
75540944ae18 fix dc_description format arg
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1802
diff changeset
   116
            self.w(u'<div class="description">%s</div>'
75540944ae18 fix dc_description format arg
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1802
diff changeset
   117
                   % task.dc_description(format='text/html'))
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   118
            icalendarable = task.cw_adapt_to('ICalendarable')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   119
            if icalendarable.start:
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   120
                self.w(u'<abbr class="dtstart" title="%s">%s</abbr>'
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   121
                       % (icalendarable.start.isoformat(),
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   122
                          self._cw.format_date(icalendarable.start)))
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   123
            if icalendarable.stop:
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   124
                self.w(u'<abbr class="dtstop" title="%s">%s</abbr>'
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   125
                       % (icalendarable.stop.isoformat(),
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   126
                          self._cw.format_date(icalendarable.stop)))
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   127
            self.w(u'</div>')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   128
        self.w(u'</div>')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   129
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   130
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   131
class CalendarItemView(EntityView):
3377
dd9d292b6a6d use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
   132
    __regid__ = 'calendaritem'
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   133
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   134
    def cell_call(self, row, col, dates=False):
3457
0924d0d08d60 [api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3451
diff changeset
   135
        task = self.cw_rset.complete_entity(row, 0)
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   136
        task.view('oneline', w=self.w)
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   137
        if dates:
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   138
            icalendarable = task.cw_adapt_to('ICalendarable')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   139
            if icalendarable.start and icalendarable.stop:
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   140
                self.w('<br/> %s' % self._cw._('from %(date)s')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   141
                       % {'date': self._cw.format_date(icalendarable.start)})
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   142
                self.w('<br/> %s' % self._cw._('to %(date)s')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   143
                       % {'date': self._cw.format_date(icalendarable.stop)})
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   144
            else:
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   145
                self.w('<br/>%s'%self._cw.format_date(icalendarable.start
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   146
                                                      or icalendarable.stop))
1604
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   147
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   148
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   149
class _TaskEntry(object):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   150
    def __init__(self, task, color, index=0):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   151
        self.task = task
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   152
        self.color = color
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   153
        self.index = index
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   154
        self.length = 1
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   155
        icalendarable = task.cw_adapt_to('ICalendarable')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   156
        self.start = icalendarable.start
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   157
        self.stop = icalendarable.stop
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   158
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   159
    def in_working_hours(self):
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   160
        """predicate returning True is the task is in working hours"""
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   161
        if todatetime(self.start).hour > 7 and todatetime(self.stop).hour < 20:
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   162
            return True
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   163
        return False
1604
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   164
1025
aebf37f460c1 some datetime fixes
sylvain.thenault@logilab.fr
parents: 1016
diff changeset
   165
    def is_one_day_task(self):
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   166
        return self.start and self.stop and self.start.isocalendar() == self.stop.isocalendar()
1604
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   167
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   168
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   169
class CalendarView(EntityView):
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   170
    __regid__ = 'calendar'
5556
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   171
    __select__ = adaptable('ICalendarable')
9ab2b4c74baf [entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
   172
4244
2c3de1953d00 rename need_navigation into paginable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4212
diff changeset
   173
    paginable = False
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   174
    title = _('calendar')
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   175
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   176
    fullcalendar_options = {
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   177
        'firstDay': 1,
8287
2d660890d3e8 [js] translate calendar in french (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8153
diff changeset
   178
        'firstHour': 8,
2d660890d3e8 [js] translate calendar in french (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8153
diff changeset
   179
        'defaultView': 'month',
2d660890d3e8 [js] translate calendar in french (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8153
diff changeset
   180
        'editable': True,
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   181
        'header': {'left': 'prev,next today',
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   182
                   'center': 'title',
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   183
                   'right': 'month,agendaWeek,agendaDay',
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   184
                   },
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   185
        }
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   186
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   187
    def call(self):
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   188
        self._cw.add_css(('fullcalendar.css', 'cubicweb.calendar.css'))
8295
302dcb3c6858 [js] fix $.fullCalendar.regional call (closes #2232028)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8290
diff changeset
   189
        self._cw.add_js(('jquery.ui.js', 'fullcalendar.min.js', 'jquery.qtip.min.js', 'fullcalendar.locale.js'))
8153
e225e70239ed [views] calendar id in CalendarView must be unique (closes #2143864)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 7183
diff changeset
   190
        self.calendar_id = 'cal' + make_uid('uid')
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   191
        self.add_onload()
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   192
        # write calendar div to load jquery fullcalendar object
8153
e225e70239ed [views] calendar id in CalendarView must be unique (closes #2143864)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 7183
diff changeset
   193
        self.w(u'<div id="%s"></div>' % self.calendar_id)
1604
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   194
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   195
    def add_onload(self):
8290
d07dadd8f664 fix events display in calendar (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8287
diff changeset
   196
        fullcalendar_options = self.fullcalendar_options.copy()
d07dadd8f664 fix events display in calendar (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8287
diff changeset
   197
        fullcalendar_options['events'] = self.get_events()
8287
2d660890d3e8 [js] translate calendar in french (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8153
diff changeset
   198
        # i18n
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   199
        # js callback to add a tooltip and to put html in event's title
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   200
        js = """
8287
2d660890d3e8 [js] translate calendar in french (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8153
diff changeset
   201
        var options = $.fullCalendar.regional('%s', %s);
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   202
        options.eventRender = function(event, $element) {
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   203
          // add a tooltip for each event
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   204
          var div = '<div class="tooltip">'+ event.description+ '</div>';
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   205
          $element.append(div);
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   206
          // allow to have html tags in event's title
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   207
          $element.find('span.fc-event-title').html($element.find('span.fc-event-title').text());
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   208
        };
8153
e225e70239ed [views] calendar id in CalendarView must be unique (closes #2143864)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 7183
diff changeset
   209
        $("#%s").fullCalendar(options);
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   210
        """ #"
8290
d07dadd8f664 fix events display in calendar (closes #2167866)
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 8287
diff changeset
   211
        self._cw.add_onload(js % (self._cw.lang, json_dumps(fullcalendar_options), self.calendar_id))
1604
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   212
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   213
    def get_events(self):
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   214
        events = []
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   215
        for entity in self.cw_rset.entities():
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   216
            icalendarable = entity.cw_adapt_to('ICalendarable')
7183
5ea2bfd55399 [web] fix CalendarView : both icalendarable.start and icalendarable.stop dates can be None
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 6882
diff changeset
   217
            if not (icalendarable.start and icalendarable.stop):
5ea2bfd55399 [web] fix CalendarView : both icalendarable.start and icalendarable.stop dates can be None
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 6882
diff changeset
   218
                continue
5ea2bfd55399 [web] fix CalendarView : both icalendarable.start and icalendarable.stop dates can be None
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 6882
diff changeset
   219
            start_date = icalendarable.start or  icalendarable.stop
6736
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   220
            event = {'eid': entity.eid,
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   221
                     'title': entity.view('calendaritem'),
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   222
                     'url': xml_escape(entity.absolute_url()),
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   223
                     'className': 'calevent',
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   224
                     'description': entity.view('tooltip'),
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   225
                     }
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   226
            event['start'] = start_date.strftime('%Y-%m-%dT%H:%M')
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   227
            event['allDay'] = True
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   228
            if icalendarable.stop:
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   229
                event['end'] = icalendarable.stop.strftime('%Y-%m-%dT%H:%M')
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   230
                event['allDay'] = False
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   231
            events.append(event)
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   232
        return events
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   233
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   234
class OneMonthCal(CalendarView):
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   235
    __regid__ = 'onemonthcal'
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   236
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   237
    title = _('one month')
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   238
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   239
class OneWeekCal(CalendarView):
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   240
    __regid__ = 'oneweekcal'
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   241
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   242
    title = _('one week')
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   243
    fullcalendar_options = CalendarView.fullcalendar_options.copy()
36ed2bf7ad3d [#615712] replace calendar views with views using fullcalendar jquery plugin (remove old_calendar)
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents: 5895
diff changeset
   244
    fullcalendar_options['defaultView'] = 'agendaWeek'