# HG changeset patch # User Paul Boddie # Date 1371743835 -7200 # Node ID dc66d8907c26206f29024a78bcd81508e051e4a2 # Parent 9ddbfa060025070ce97b2c07380fc897cfd4f50e Moved the calendar navigation out of the caption. Introduced proper day number header cells and made event cells reference these cells. Changed the pop-up menus to use different anchors from those used by the day cells themselves. Introduced day name header cells with scope declarations and name abbreviation expansions. diff -r 9ddbfa060025 -r dc66d8907c26 EventAggregatorSupport/View.py --- a/EventAggregatorSupport/View.py Tue Jun 18 00:51:26 2013 +0200 +++ b/EventAggregatorSupport/View.py Thu Jun 20 17:57:15 2013 +0200 @@ -731,13 +731,9 @@ end_date = date.update(self.duration - 1) return self._writeCalendarHeading(full_date_label, date, end_date) - def _writeCalendarHeading(self, label, start, end): - - """ - Write a calendar heading providing links permitting navigation to other - periods, using the given 'label' along with the 'start' and 'end' dates - to provide a link to a particular period. - """ + def writeCalendarNavigation(self): + + "Return navigation links for a calendar." page = self.page request = page.request @@ -747,8 +743,6 @@ output = [] append = output.append - # Prepare navigation links. - if self.calendar_name: calendar_name = self.calendar_name @@ -784,10 +778,7 @@ self.next_start, self.next_end ) - # A link leading to this date being at the top of the calendar. - - date_link = self.getNavigationLink(start, end) - date_update_link = self.getUpdateLink(start, end) + append(fmt.div(on=1, css_class="event-calendar-navigation")) append(fmt.span(on=1, css_class="previous")) append(linkToPage(request, page, "<<", previous_set_link, onclick=previous_set_update_link, title=_("Previous set"))) @@ -801,12 +792,37 @@ append(linkToPage(request, page, ">>", next_set_link, onclick=next_set_update_link, title=_("Next set"))) append(fmt.span(on=0)) + append(fmt.div(on=0)) + + return "".join(output) + + def _writeCalendarHeading(self, label, start, end): + + """ + Write a calendar heading providing links permitting navigation to other + periods, using the given 'label' along with the 'start' and 'end' dates + to provide a link to a particular period. + """ + + page = self.page + request = page.request + fmt = request.formatter + _ = request.getText + + output = [] + append = output.append + + if self.calendar_name: + + # A link leading to this date being at the top of the calendar. + + date_link = self.getNavigationLink(start, end) + date_update_link = self.getUpdateLink(start, end) + append(linkToPage(request, page, label, date_link, onclick=date_update_link, title=_("Show this period first"))) else: - append(fmt.span(on=1)) append(fmt.text(label)) - append(fmt.span(on=0)) return "".join(output) @@ -834,21 +850,19 @@ day_view_link = self.getNavigationLink(date, date, "day", "date", self.calendar_start, self.calendar_end) day_view_update_link = self.getUpdateLink(date, date, "day", "date", self.calendar_start, self.calendar_end) - # Output the heading class. + # Output the heading. + + day_target = "%s-day-%d" % (self.getIdentifier(), day) + day_menu_target = "%s-menu" % day_target today_attr = date == getCurrentDate() and "event-day-current" or "" - append( - fmt.table_cell(on=1, attrs={ - "class" : "event-day-heading event-day-%s %s" % (busy and "busy" or "empty", today_attr), - "colspan" : "3" - })) + append(fmt.rawHTML("" % ( + busy and "busy" or "empty", escattr(today_attr), escattr(day_target)))) # Output the number and pop-up menu. - day_target = "%s-day-%d" % (self.getIdentifier(), day) - - append(fmt.div(on=1, css_class="event-day-box", id=day_target)) + append(fmt.div(on=1, css_class="event-day-box", id=day_menu_target)) append(fmt.span(on=1, css_class="event-day-number-popup")) append(fmt.span(on=1, css_class="event-day-number-link")) @@ -862,14 +876,14 @@ # Link the number to the day view. append(fmt.span(on=1, css_class="event-day-number")) - append(linkToPage(request, page, unicode(day), anchor=day_target, title=_("View day options"))) + append(linkToPage(request, page, unicode(day), anchor=day_menu_target, title=_("View day options"))) append(fmt.span(on=0)) append(fmt.div(on=0)) # End of heading. - append(fmt.table_cell(on=0)) + append(fmt.rawHTML("")) return "".join(output) @@ -955,9 +969,10 @@ append(fmt.table_row(on=1)) for weekday in range(0, 7): - append(fmt.table_cell(on=1, attrs={"class" : "event-weekday-heading", "colspan" : "3"})) + append(fmt.rawHTML(u"" % + escattr(_(getVerboseDayLabel(weekday))))) append(fmt.text(_(getDayLabel(weekday)))) - append(fmt.table_cell(on=0)) + append(fmt.rawHTML("")) append(fmt.table_row(on=0)) return "".join(output) @@ -1080,11 +1095,12 @@ # Otherwise, multiple cells are used to provide space before, during # and after events. + day_target = "%s-day-%d" % (self.getIdentifier(), day) today_attr = date == getCurrentDate() and "event-day-current" or "" if date not in events: - append(fmt.table_cell(on=1, - attrs={"class" : "event-day-content event-day-empty %s" % today_attr, "colspan" : "3"})) + append(fmt.rawHTML(u"" % ( + escattr(today_attr), escattr(day_target)))) # Get event details for the current day. @@ -1126,7 +1142,8 @@ # Events starting today... else: - append(fmt.table_cell(on=1, attrs={"class" : "event-day-start-gap %s" % today_attr})) + append(fmt.rawHTML(u"" % ( + escattr(today_attr), escattr(day_target)))) append(fmt.table_cell(on=0)) # Calculate the span of this cell. @@ -1204,14 +1221,15 @@ # Colour the cell for continuing events. attrs={ - "class" : "event-day-content event-day-busy %s %s" % (event_day_type, today_attr), - "colspan" : str(colspan) + "class" : escattr("event-day-content event-day-busy %s %s" % (event_day_type, today_attr)), + "colspan" : str(colspan), + "headers" : escattr(day_target), } if not (starts_today and ends_today): attrs["style"] = style - append(fmt.table_cell(on=1, attrs=attrs)) + append(fmt.rawHTML(u"" % attrs)) # Output the event. @@ -1223,7 +1241,7 @@ # Output end of day gap. if ends_today and not starts_today: - append(fmt.table_cell(on=1, attrs={"class" : "event-day-end-gap %s" % today_attr})) + append(fmt.rawHTML("" % (escattr(today_attr), escattr(day_target)))) append(fmt.table_cell(on=0)) # End of set. @@ -1869,6 +1887,8 @@ map_identifier = "map-%s" % self.getIdentifier() append(fmt.div(on=1, css_class="event-map", id=map_identifier)) + append(self.writeCalendarNavigation()) + append(fmt.table(on=1, attrs={"summary" : _("A map showing events")})) append(self.writeMapTableHeading()) @@ -2058,6 +2078,9 @@ for month in self.first.months_until(self.last): + append(fmt.div(on=1, css_class="event-calendar")) + append(self.writeCalendarNavigation()) + # Output a month. append(fmt.table(on=1, attrs={"tableclass" : "event-month", "summary" : _("A table showing a calendar month")})) @@ -2121,6 +2144,7 @@ # NOTE: Moin closes a "tbody" element in the table method. append(fmt.table(on=0)) + append(fmt.div(on=0)) # Output a day view. @@ -2130,6 +2154,9 @@ for date in self.first.days_until(self.last): + append(fmt.div(on=1, css_class="event-calendar")) + append(self.writeCalendarNavigation()) + append(fmt.table(on=1, attrs={"tableclass" : "event-calendar-day", "summary" : _("A table showing a calendar day")})) full_coverage, day_slots = getCoverage( @@ -2155,6 +2182,7 @@ # End of day. append(fmt.table(on=0)) + append(fmt.div(on=0)) # Output view controls. diff -r 9ddbfa060025 -r dc66d8907c26 css/event-aggregator.css --- a/css/event-aggregator.css Tue Jun 18 00:51:26 2013 +0200 +++ b/css/event-aggregator.css Thu Jun 20 17:57:15 2013 +0200 @@ -148,6 +148,25 @@ /* Calendar view. */ +.event-calendar { + position: relative; +} + +.event-calendar-navigation .next, +.event-calendar-navigation .previous { + position: absolute; + top: 1em; + z-index: 2; +} + +.event-calendar-navigation .previous { + left: 1em; +} + +.event-calendar-navigation .next { + right: 1em; +} + .event-month { width: 98%; border-bottom: 1px solid #dddddd; @@ -161,16 +180,27 @@ caption-side: top; } +.event-calendar-navigation .next, +.event-calendar-navigation .previous, .event-map-heading, .event-month-heading, .event-full-day-heading { background-color: #777777; color: #ffffff; + font-weight: bold; +} + +.event-map-heading, +.event-month-heading, +.event-full-day-heading { text-align: center; - font-weight: bold; border: 0; } +.event-calendar-navigation a:link, +.event-calendar-navigation a:hover, +.event-calendar-navigation a:focus, +.event-calendar-navigation a:visited, .event-map-heading a:link, .event-map-heading a:hover, .event-map-heading a:focus, @@ -186,20 +216,6 @@ color: inherit !important; } -.event-map-heading .previous, -.event-month-heading .previous, -.event-full-day-heading .previous, -.event-listings-heading .previous { - float: left; -} - -.event-map-heading .next, -.event-month-heading .next, -.event-full-day-heading .next, -.event-listings-heading .next { - float: right; -} - .event-weekday-heading { background-color: #999999; color: #ffffff; @@ -248,6 +264,8 @@ } .event-day-heading { + font-weight: normal; + text-align: left; width: 14%; vertical-align: top; padding-top: 0;