Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Attributes
CMFPlone.browser.portlets.calendar.CalendarPortlet Class Reference
Inheritance diagram for CMFPlone.browser.portlets.calendar.CalendarPortlet:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.browser.portlets.calendar.CalendarPortlet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getYearAndMonthToDisplay
def getPreviousMonth
def getNextMonth
def getWeekdays
def getEnglishMonthName
def getMonthName
def isToday

Public Attributes

 context
 request
 yearmonth
 DateTime
 current
 current_day
 nextYearMax
 prevYearMin
 year
 month
 prevMonthTime
 nextMonthTime
 weeks
 daynumbers
 showStates
 showPrevMonth
 showNextMonth

Private Attributes

 _translation_service

Detailed Description

Definition at line 13 of file calendar.py.


Constructor & Destructor Documentation

def CMFPlone.browser.portlets.calendar.CalendarPortlet.__init__ (   self,
  context,
  request 
)

Definition at line 16 of file calendar.py.

00016 
00017     def __init__(self, context, request):
00018         self.context = context
00019         self.request = request
00020         self.yearmonth = self.getYearAndMonthToDisplay()
00021         self.DateTime = DateTime
00022         self.current = DateTime()
00023         self.current_day = self.current.day()
00024         self.nextYearMax = self.current + 365
00025         self.prevYearMin = self.current - 365
00026         self.year = self.yearmonth[0]
00027         self.month = self.yearmonth[1]
00028         self.prevMonthTime = self.getPreviousMonth(self.month, self.year)
00029         self.nextMonthTime = self.getNextMonth(self.month, self.year)
00030         calendar = getToolByName(context, 'portal_calendar')
00031         self.weeks = calendar.getEventsForCalendar(self.month, self.year)
00032         self.daynumbers = calendar.getDayNumbers()
00033         self._translation_service = getToolByName(context, 'translation_service')
00034         self.showStates = calendar.getCalendarStates()
00035         self.showPrevMonth = self.yearmonth > (self.prevYearMin.year(), self.prevYearMin.month())
00036         self.showNextMonth = self.yearmonth < (self.nextYearMax.year(), self.nextYearMax.month())


Member Function Documentation

Returns the current English month name.

Definition at line 110 of file calendar.py.

00110 
00111     def getEnglishMonthName(self):
00112         """Returns the current English month name."""
00113         return self._translation_service.month_english(self.month)

Returns the current month name as a Message.

Definition at line 114 of file calendar.py.

00114 
00115     def getMonthName(self):
00116         """Returns the current month name as a Message."""
00117         msgid   = self._translation_service.month_msgid(self.month)
00118         english = self._translation_service.month_english(self.month)
00119         return PLMF(msgid, default=english)

Definition at line 86 of file calendar.py.

00086 
00087     def getNextMonth(self, month, year):
00088 
00089         month=int(month)
00090         year=int(year)
00091 
00092         if month==12:
00093             month, year = 1, year + 1
00094         else:
00095             month+=1
00096 
00097         return DateTime(year, month, 1)

Definition at line 74 of file calendar.py.

00074 
00075     def getPreviousMonth(self, month, year):
00076 
00077         month=int(month)
00078         year=int(year)
00079 
00080         if month==0 or month==1:
00081             month, year = 12, year - 1
00082         else:
00083             month-=1
00084 
00085         return DateTime(year, month, 1)

Returns a list of Messages for the weekday names.

Definition at line 98 of file calendar.py.

00098 
00099     def getWeekdays(self):
00100         """Returns a list of Messages for the weekday names."""
00101 
00102         weekdays = []
00103         # list of ordered weekdays as numbers
00104         for day in self.daynumbers:
00105             msgid   = self._translation_service.day_msgid(day, format='s')
00106             english = self._translation_service.weekday_english(day, format='a')
00107             weekdays.append(PLMF(msgid, default=english))
00108 
00109         return weekdays

from skins/plone_scripts/getYearAndMonthToDisplay.py 

Definition at line 37 of file calendar.py.

00037 
00038     def getYearAndMonthToDisplay(self):
00039         """ from skins/plone_scripts/getYearAndMonthToDisplay.py """
00040 
00041         current = DateTime()
00042         context = aq_inner(self.context)
00043         request = self.request
00044         session = None
00045 
00046         # First priority goes to the data in the REQUEST
00047         year = request.get('year', None)
00048         month = request.get('month', None)
00049 
00050         # Next get the data from the SESSION
00051         if context.portal_calendar.getUseSession():
00052             session = request.get('SESSION', None)
00053             if session:
00054                 if not year:
00055                     year = session.get('calendar_year', None)
00056                 if not month:
00057                     month = session.get('calendar_month', None)
00058 
00059         # Last resort to today
00060         if not year:
00061             year = current.year()
00062         if not month:
00063             month = current.month()
00064 
00065         year, month = int(year), int(month)
00066 
00067         # Store the results in the session for next time
00068         if session:
00069             session.set('calendar_year', year)
00070             session.set('calendar_month', month)
00071 
00072         # Finally return the results
00073         return year, month

Returns True if the given day and the current month and year equals
   today, otherwise False.

Definition at line 120 of file calendar.py.

00120 
00121     def isToday(self, day):
00122         """Returns True if the given day and the current month and year equals
00123            today, otherwise False.
00124         """
00125         return self.current_day==day and self.current.month()==self.month and \
00126                self.current.year()==self.year
00127 
zope.deprecation.deprecated(

Member Data Documentation

Definition at line 32 of file calendar.py.

Definition at line 17 of file calendar.py.

Definition at line 21 of file calendar.py.

Definition at line 22 of file calendar.py.

Definition at line 20 of file calendar.py.

Definition at line 31 of file calendar.py.

Definition at line 26 of file calendar.py.

Definition at line 28 of file calendar.py.

Definition at line 23 of file calendar.py.

Definition at line 27 of file calendar.py.

Definition at line 24 of file calendar.py.

Definition at line 18 of file calendar.py.

Definition at line 35 of file calendar.py.

Definition at line 34 of file calendar.py.

Definition at line 33 of file calendar.py.

Definition at line 30 of file calendar.py.

Definition at line 25 of file calendar.py.

Definition at line 19 of file calendar.py.


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