Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
ATContentTypes.lib.calendarsupport.CalendarSupportMixin Class Reference

List of all members.

Public Member Functions

def getICal
def ics_view
def getVCal
def vcs_view

Static Public Attributes

tuple security = ClassSecurityInfo()
tuple actions

Static Private Attributes

tuple __implements__ = (ICalendarSupport, )
tuple _at_action_icons

Detailed Description

Mixin class for iCal/vCal support

Definition at line 105 of file calendarsupport.py.


Member Function Documentation

get iCal data

Definition at line 146 of file calendarsupport.py.

00146 
00147     def getICal(self):
00148         """get iCal data
00149         """
00150         out = StringIO()
00151         map = {
00152             'dtstamp'   : rfc2445dt(DateTime()),
00153             'created'   : rfc2445dt(DateTime(self.CreationDate())),
00154             'uid'       : self.UID(),
00155             'modified'  : rfc2445dt(DateTime(self.ModificationDate())),
00156             'summary'   : vformat(self.Title()),
00157             'startdate' : rfc2445dt(self.start()),
00158             'enddate'   : rfc2445dt(self.end()),
00159             }
00160         out.write(ICS_EVENT_START % map)
00161         
00162         description = self.Description()
00163         if description:
00164             out.write(foldLine('DESCRIPTION:%s\n' % vformat(description)))
00165 
00166         location = self.getLocation()
00167         if location:
00168             out.write('LOCATION:%s\n' % vformat(location))
00169 
00170         eventType = self.getEventType()
00171         if eventType:
00172             out.write('CATEGORIES:%s\n' % ','.join(eventType))
00173 
00174         # TODO  -- NO! see the RFC; ORGANIZER field is not to be used for non-group-scheduled entities
00175         #ORGANIZER;CN=%(name):MAILTO=%(email)
00176         #ATTENDEE;CN=%(name);ROLE=REQ-PARTICIPANT:mailto:%(email)
00177 
00178         cn = []
00179         contact = self.contact_name()
00180         if contact:
00181             cn.append(contact)
00182         phone = self.contact_phone()
00183         if phone:
00184             cn.append(phone)
00185         email = self.contact_email()
00186         if email:
00187             cn.append(email)
00188         if cn:
00189             out.write('CONTACT:%s\n' % vformat(', '.join(cn)))
00190 
00191         url = self.event_url()
00192         if url:
00193             out.write('URL:%s\n' % url)
00194 
00195         out.write(ICS_EVENT_END)
00196         return out.getvalue()
00197 

Here is the caller graph for this function:

get vCal data

Definition at line 211 of file calendarsupport.py.

00211 
00212     def getVCal(self):
00213         """get vCal data
00214         """
00215         out = StringIO()
00216         map = {
00217             'dtstamp'   : rfc2445dt(DateTime()),
00218             'created'   : rfc2445dt(DateTime(self.CreationDate())),
00219             'uid'       : self.UID(),
00220             'modified'  : rfc2445dt(DateTime(self.ModificationDate())),
00221             'summary'   : vformat(self.Title()),
00222             'startdate' : rfc2445dt(self.start()),
00223             'enddate'   : rfc2445dt(self.end()),
00224             }
00225         out.write(VCS_EVENT_START % map)
00226         description = self.Description()
00227         if description:
00228             out.write(foldLine('DESCRIPTION:%s\n' % vformat(description)))
00229         location = self.getLocation()
00230         if location:
00231             out.write('LOCATION:%s\n' % vformat(location))
00232         out.write(VCS_EVENT_END)
00233         # TODO
00234         # Insert missing code here :]
00235         return out.getvalue()

Here is the caller graph for this function:

def ATContentTypes.lib.calendarsupport.CalendarSupportMixin.ics_view (   self,
  REQUEST,
  RESPONSE 
)
iCalendar output

Definition at line 199 of file calendarsupport.py.

00199 
00200     def ics_view(self, REQUEST, RESPONSE):
00201         """iCalendar output
00202         """
00203         RESPONSE.setHeader('Content-Type', 'text/calendar')
00204         RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.ics"' % self.getId())
00205         out = StringIO()
00206         out.write(ICS_HEADER % { 'prodid' : PRODID, })
00207         out.write(self.getICal())
00208         out.write(ICS_FOOTER)
00209         return n2rn(out.getvalue())

def ATContentTypes.lib.calendarsupport.CalendarSupportMixin.vcs_view (   self,
  REQUEST,
  RESPONSE 
)
vCalendar output

Definition at line 237 of file calendarsupport.py.

00237 
00238     def vcs_view(self, REQUEST, RESPONSE):
00239         """vCalendar output
00240         """
00241         RESPONSE.setHeader('Content-Type', 'text/x-vCalendar')
00242         RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.vcs"' % self.getId())
00243         out = StringIO()
00244         out.write(VCS_HEADER % { 'prodid' : PRODID, })
00245         out.write(self.getVCal())
00246         out.write(VCS_FOOTER)
00247         return n2rn(out.getvalue())
00248 
00249 InitializeClass(CalendarSupportMixin)


Member Data Documentation

tuple ATContentTypes.lib.calendarsupport.CalendarSupportMixin.__implements__ = (ICalendarSupport, ) [static, private]

Definition at line 109 of file calendarsupport.py.

Initial value:
({
        'category'  : 'plone',
        'action_id' : 'ics',
        'icon_expr' : 'ical_icon.gif',
        'title'     : 'iCalendar export',
        'priority'  : 0,
        },
        {
        'category'  : 'plone',
        'action_id' : 'vcs',
        'icon_expr' : 'vcal_icon.gif',
        'title'     : 'vCalendar export',
        'priority'  : 0,
        },
        )

Definition at line 129 of file calendarsupport.py.

Initial value:
({
        'id'          : 'ics',
        'name'        : 'iCalendar',
        'action'      : 'string:${object_url}/ics_view',
        'permissions' : (View, ),
        'category'    : 'document_actions',
         },
         {
        'id'          : 'vcs',
        'name'        : 'vCalendar',
        'action'      : 'string:${object_url}/vcs_view',
        'permissions' : (View, ),
        'category'    : 'document_actions',
         },
    )

Definition at line 113 of file calendarsupport.py.

Definition at line 111 of file calendarsupport.py.


The documentation for this class was generated from the following file: