# HG changeset patch # User Paul Boddie # Date 1304289037 -7200 # Node ID fd5d97bf07c8ccdc910e2c759d5c2c419d58775e # Parent 31694e4f43261010a3cc98b52ffd70478922614d Added event periods to the map view pop-up descriptions. Simplified and generalised _getCalendarPeriod by not testing for the calendar end when working out if the start and end of the period are different. diff -r 31694e4f4326 -r fd5d97bf07c8 css/event-aggregator.css --- a/css/event-aggregator.css Fri Apr 29 00:23:34 2011 +0200 +++ b/css/event-aggregator.css Mon May 02 00:30:37 2011 +0200 @@ -463,5 +463,10 @@ padding: 0.25em 0 0.25em 0; } +.event-map-period { + display: block; + font-size: smaller; +} + /* vim: tabstop=4 expandtab shiftwidth=4 */ diff -r 31694e4f4326 -r fd5d97bf07c8 macros/EventAggregator.py --- a/macros/EventAggregator.py Fri Apr 29 00:23:34 2011 +0200 +++ b/macros/EventAggregator.py Mon May 02 00:30:37 2011 +0200 @@ -167,7 +167,7 @@ output = [] if start_label: output.append(start_label) - if self.calendar_end and start_label != end_label: + if end_label and start_label != end_label: if output: output.append(" - ") output.append(end_label) @@ -1174,6 +1174,45 @@ return "".join(output) + def writeMapEventSummaries(self, events): + page = self.page + fmt = page.formatter + request = page.request + + output = [] + output.append(fmt.bullet_list(on=1, attr={"class" : "event-map-description-events"})) + + for event in events: + + # Get the event details. + + event_page = event.getPage() + event_summary = event.getSummary(self.parent_name) + start, end = event.as_limits() + event_period = self._getCalendarPeriod( + start and self.getFullDateLabel(start), + end and self.getFullDateLabel(end), + "") + + output.append(fmt.listitem(on=1)) + + # Link to the page using the summary. + + output.append(event_page.linkToPage(request, event_summary)) + + # Add the event period. + + output.append(fmt.text(" ")) + output.append(fmt.span(on=1, css_class="event-map-period")) + output.append(fmt.text(event_period)) + output.append(fmt.span(on=0)) + + output.append(fmt.listitem(on=0)) + + output.append(fmt.bullet_list(on=0)) + + return "".join(output) + # HTML-related functions. def getColour(s): @@ -1588,19 +1627,7 @@ output.append(fmt.text(location)) output.append(fmt.paragraph(on=0)) - output.append(fmt.bullet_list(on=1, attr={"class" : "event-map-description-events"})) - - for event in events: - event_page = event.getPage() - event_summary = event.getSummary(parent_name) - - # Link to the page using the summary. - - output.append(fmt.listitem(on=1)) - output.append(event_page.linkToPage(request, event_summary)) - output.append(fmt.listitem(on=0)) - - output.append(fmt.bullet_list(on=0)) + output.append(view.writeMapEventSummaries(events)) output.append(fmt.div(on=0)) output.append(fmt.div(on=0))