Back to index

plone3  3.1.7
calendar_day_view.py
Go to the documentation of this file.
00001 ##parameters=
00002 ##
00003 from Products.CMFCore.utils import getToolByName
00004 from Products.CMFDefault.utils import decode
00005 
00006 caltool = getToolByName(script, 'portal_calendar')
00007 
00008 options = {}
00009 base_url = script.absolute_url()
00010 thisDay = DateTime(context.REQUEST.get('date', DateTime().aCommon()[:12]))
00011 options['previous_url'] = '%s?date=%s' % (base_url, (thisDay-1).Date())
00012 options['date'] = thisDay.aCommon()[:12]
00013 options['next_url'] =  '%s?date=%s' % (base_url, (thisDay+1).Date())
00014 
00015 items = [ {'title': item.Title,
00016            'url': item.getURL(),
00017            'start': context.getStartAsString(thisDay, item),
00018            'stop': context.getEndAsString(thisDay, item)}
00019           for item in caltool.getEventsForThisDay(thisDay) ]
00020 
00021 options['listItemInfos'] = tuple(items)
00022 
00023 return context.calendar_day_view_template(**decode(options, script))