[Zope-CMF] Again: Proposal for CMF Calendar

Rainer Thaden Rainer Thaden <thadi@gmx.de>
Thu, 3 Jul 2003 14:04:09 +0200


Hi,

hm, either everyone's in holidays or nobody is interested. Once again
a proposal for CMFCalendar to show not only events with review state =
published but all events which the user is allowed to view:

In CalendarTool.py:

    security.declarePublic('catalog_getevents')
    def catalog_getevents(self, year, month):

        last_date=first_date + last_day    
        
        query=self.portal_catalog(portal_type=self.calendar_types,
# remove this line                review_state='published'
                                  start=(first_date, last_date),
                                  start_usage='range:min:max',
                                  sort_on='start')

        query+=self.portal_catalog(portal_type=self.calendar_types,
# remove this line                review_state='published'
                                   end=(first_date, last_date),
                                   end_usage='range:min:max',
                                   sort_on='end')
        
#add next line
        query = ZTUtils.LazyFilter(query, skip='View')


    security.declarePublic('getEventsForThisDay')
    def getEventsForThisDay(self, thisDay):
        catalog = self.portal_catalog
        
        first_date, last_date = self.getBeginAndEndTimes(thisDay.day(), thisDay.month(), thisDay.year())
        query=self.portal_catalog(portal_type=self.calendar_types,
# remove this line                review_state='published'
                                  start=(first_date,last_date),
                                  start_usage='range:min:max')
        
        query+=self.portal_catalog(portal_type=self.calendar_types,
# remove this line                review_state='published'
                                  end=(first_date,last_date),
                                  end_usage='range:min:max')

        query+=self.portal_catalog(portal_type=self.calendar_types,
# remove this line                review_state='published'
                                  start=first_date,
                                  start_usage='range:max',
                                  end=last_date,
                                  end_usage='range:min')
#add next line
        query = ZTUtils.LazyFilter(query, skip='View')

Comments?

-- 
Regards,
 Rainer                          mailto:thadi@gmx.de