[CMF-checkins] CVS: Products/CMFCalendar - CalendarTool.py:1.15

Stefan H. Holek stefan at epy.co.at
Wed Aug 4 19:05:00 EDT 2004


Update of /cvs-repository/Products/CMFCalendar
In directory cvs.zope.org:/tmp/cvs-serv20119/CMFCalendar

Modified Files:
	CalendarTool.py 
Log Message:
Implemented parts of #110 by making workflow states configurable TTW.


=== Products/CMFCalendar/CalendarTool.py 1.14 => 1.15 ===
--- Products/CMFCalendar/CalendarTool.py:1.14	Tue Aug  3 06:07:17 2004
+++ Products/CMFCalendar/CalendarTool.py	Wed Aug  4 19:04:30 2004
@@ -34,6 +34,10 @@
     meta_type= 'CMF Calendar Tool'
     security = ClassSecurityInfo()
 
+    calendar_types = ('Event',)
+    calendar_states = ('published',)
+    use_session = ''
+
     manage_options = ( ({ 'label' : 'Overview', 'action' : 'manage_overview' }
                      ,  { 'label' : 'Configure', 'action' : 'manage_configure' }
                      ,
@@ -51,14 +55,11 @@
     manage_configure = PageTemplateFile('www/configureCalendarTool', globals(),
                                    __name__='manage_configure')
 
-    def __init__(self):
-        self.calendar_types = ['Event']
-        self.use_session = ""
-
     security.declareProtected( ManagePortal, 'edit_configuration' )
-    def edit_configuration(self, show_types, use_session):
+    def edit_configuration(self, show_types, use_session, show_states):
         """ Change the configuration of the calendar tool """
-        self.calendar_types = show_types
+        self.calendar_types = tuple(show_types)
+        self.calendar_states = tuple(show_states)
         self.use_session = use_session
         if hasattr(self.REQUEST, 'RESPONSE'):
             self.REQUEST.RESPONSE.redirect('manage_configure')
@@ -68,6 +69,11 @@
         """ Returns a list of type that will show in the calendar """
         return self.calendar_types
 
+    security.declarePublic('getCalendarStates')
+    def getCalendarStates(self):
+        """ Returns a list of workflow states that will show in the calendar """
+        return self.calendar_states
+
     security.declarePublic('getUseSession')
     def getUseSession(self):
         """ Returns the Use_Session option """
@@ -135,8 +141,8 @@
         last_date=self.getBeginAndEndTimes(last_day, month, year)[1]
 
         query = self.portal_catalog(
-                        portal_type=self.calendar_types,
-                        review_state='published',
+                        portal_type=self.getCalendarTypes(),
+                        review_state=self.getCalendarStates(),
                         start={'query': last_date, 'range': 'max'},
                         end={'query': first_date, 'range': 'min'},
                         sort_on='start' )
@@ -207,22 +213,22 @@
 
         # Get all events that Start on this day
         query = self.portal_catalog(
-                        portal_type=self.calendar_types,
-                        review_state='published',
+                        portal_type=self.getCalendarTypes(),
+                        review_state=self.getCalendarStates(),
                         start={'query': (first_date, last_date),
                                'range': 'minmax'} )
 
         # Get all events that End on this day
         query += self.portal_catalog(
-                         portal_type=self.calendar_types,
-                         review_state='published',
+                         portal_type=self.getCalendarTypes(),
+                         review_state=self.getCalendarStates(),
                          end={'query': (first_date, last_date),
                               'range': 'minmax'} )
 
         # Get all events that Start before this day AND End after this day
         query += self.portal_catalog(
-                         portal_type=self.calendar_types,
-                         review_state='published',
+                         portal_type=self.getCalendarTypes(),
+                         review_state=self.getCalendarStates(),
                          start={'query': first_date, 'range': 'max'},
                          end={'query': last_date, 'range': 'min'} )
 



More information about the CMF-checkins mailing list