web/views/old_calendar.py
changeset 3396 fb261afd49cd
parent 3377 dd9d292b6a6d
child 3451 6b46d73823f5
equal deleted inserted replaced
3395:405f393bcac0 3396:fb261afd49cd
   160         return am_content, pm_content
   160         return am_content, pm_content
   161 
   161 
   162 
   162 
   163 
   163 
   164 class YearCalendarView(_CalendarView):
   164 class YearCalendarView(_CalendarView):
   165     id = 'calendaryear'
   165     __regid__ = 'calendaryear'
   166     title = _('calendar (year)')
   166     title = _('calendar (year)')
   167 
   167 
   168     def call(self, year=None, month=None):
   168     def call(self, year=None, month=None):
   169         """this view renders a 3x3 calendars' table"""
   169         """this view renders a 3x3 calendars' table"""
   170         year = year or int(self.req.form.get('year', date.today().year))
   170         year = year or int(self.req.form.get('year', date.today().year))
   179 
   179 
   180 class SemesterCalendarView(_CalendarView):
   180 class SemesterCalendarView(_CalendarView):
   181     """this view renders three semesters as three rows of six columns,
   181     """this view renders three semesters as three rows of six columns,
   182     one column per month
   182     one column per month
   183     """
   183     """
   184     id = 'calendarsemester'
   184     __regid__ = 'calendarsemester'
   185     title = _('calendar (semester)')
   185     title = _('calendar (semester)')
   186 
   186 
   187     def call(self, year=None, month=None):
   187     def call(self, year=None, month=None):
   188         year = year or int(self.req.form.get('year', date.today().year))
   188         year = year or int(self.req.form.get('year', date.today().year))
   189         month = month or int(self.req.form.get('month', date.today().month))
   189         month = month or int(self.req.form.get('month', date.today().month))
   227             self.w(WEEK_EMPTY_CELL)
   227             self.w(WEEK_EMPTY_CELL)
   228 
   228 
   229 
   229 
   230 class MonthCalendarView(_CalendarView):
   230 class MonthCalendarView(_CalendarView):
   231     """this view renders a 3x1 calendars' table"""
   231     """this view renders a 3x1 calendars' table"""
   232     id = 'calendarmonth'
   232     __regid__ = 'calendarmonth'
   233     title = _('calendar (month)')
   233     title = _('calendar (month)')
   234 
   234 
   235     def call(self, year=None, month=None):
   235     def call(self, year=None, month=None):
   236         year = year or int(self.req.form.get('year', date.today().year))
   236         year = year or int(self.req.form.get('year', date.today().year))
   237         month = month or int(self.req.form.get('month', date.today().month))
   237         month = month or int(self.req.form.get('month', date.today().month))
   244         self.w(self.nav_header(center_date, 1, 3))
   244         self.w(self.nav_header(center_date, 1, 3))
   245 
   245 
   246 
   246 
   247 class WeekCalendarView(_CalendarView):
   247 class WeekCalendarView(_CalendarView):
   248     """this view renders a calendar for week events"""
   248     """this view renders a calendar for week events"""
   249     id = 'calendarweek'
   249     __regid__ = 'calendarweek'
   250     title = _('calendar (week)')
   250     title = _('calendar (week)')
   251 
   251 
   252     def call(self, year=None, week=None):
   252     def call(self, year=None, week=None):
   253         year = year or int(self.req.form.get('year', date.today().year))
   253         year = year or int(self.req.form.get('year', date.today().year))
   254         week = week or int(self.req.form.get('week', date.today().isocalendar()[1]))
   254         week = week or int(self.req.form.get('week', date.today().isocalendar()[1]))
   301             xml_escape(self.build_url(rql=rql, vid=self.id, year=next2.year, week=next2.isocalendar()[1])))
   301             xml_escape(self.build_url(rql=rql, vid=self.id, year=next2.year, week=next2.isocalendar()[1])))
   302 
   302 
   303 
   303 
   304 
   304 
   305 class AMPMYearCalendarView(YearCalendarView):
   305 class AMPMYearCalendarView(YearCalendarView):
   306     id = 'ampmcalendaryear'
   306     __regid__ = 'ampmcalendaryear'
   307     title = _('am/pm calendar (year)')
   307     title = _('am/pm calendar (year)')
   308 
   308 
   309     def build_calendar(self, schedule, first_day):
   309     def build_calendar(self, schedule, first_day):
   310         """method responsible for building *one* HTML calendar"""
   310         """method responsible for building *one* HTML calendar"""
   311         umonth = self.format_date(first_day, '%B %Y') # localized month name
   311         umonth = self.format_date(first_day, '%B %Y') # localized month name
   355 
   355 
   356 
   356 
   357 
   357 
   358 class AMPMSemesterCalendarView(SemesterCalendarView):
   358 class AMPMSemesterCalendarView(SemesterCalendarView):
   359     """this view renders a 3x1 calendars' table"""
   359     """this view renders a 3x1 calendars' table"""
   360     id = 'ampmcalendarsemester'
   360     __regid__ = 'ampmcalendarsemester'
   361     title = _('am/pm calendar (semester)')
   361     title = _('am/pm calendar (semester)')
   362 
   362 
   363     def build_calendars(self, schedule, begin, end):
   363     def build_calendars(self, schedule, begin, end):
   364         self.w(u'<tr>')
   364         self.w(u'<tr>')
   365         rql = self.rset.printable_rql()
   365         rql = self.rset.printable_rql()
   392                               AMPM_EMPTY % ("pmCell", "pm")))
   392                               AMPM_EMPTY % ("pmCell", "pm")))
   393 
   393 
   394 
   394 
   395 class AMPMMonthCalendarView(MonthCalendarView):
   395 class AMPMMonthCalendarView(MonthCalendarView):
   396     """this view renders a 3x1 calendars' table"""
   396     """this view renders a 3x1 calendars' table"""
   397     id = 'ampmcalendarmonth'
   397     __regid__ = 'ampmcalendarmonth'
   398     title = _('am/pm calendar (month)')
   398     title = _('am/pm calendar (month)')
   399 
   399 
   400     def build_calendar(self, schedule, first_day):
   400     def build_calendar(self, schedule, first_day):
   401         """method responsible for building *one* HTML calendar"""
   401         """method responsible for building *one* HTML calendar"""
   402         umonth = self.format_date(first_day, '%B %Y') # localized month name
   402         umonth = self.format_date(first_day, '%B %Y') # localized month name
   448 
   448 
   449 
   449 
   450 
   450 
   451 class AMPMWeekCalendarView(WeekCalendarView):
   451 class AMPMWeekCalendarView(WeekCalendarView):
   452     """this view renders a 3x1 calendars' table"""
   452     """this view renders a 3x1 calendars' table"""
   453     id = 'ampmcalendarweek'
   453     __regid__ = 'ampmcalendarweek'
   454     title = _('am/pm calendar (week)')
   454     title = _('am/pm calendar (week)')
   455 
   455 
   456     def build_calendar(self, schedule, weeks):
   456     def build_calendar(self, schedule, weeks):
   457         rql = self.rset.printable_rql()
   457         rql = self.rset.printable_rql()
   458         w = self.w
   458         w = self.w