# HG changeset patch # User Paul Boddie # Date 1237755887 -3600 # Node ID ea08c522646befd0b0002f01c611886c8bb662c0 # Parent a2bbbfca36ff54617d4a071eec1a3b5b84d2baec Added empty days for weeks without events. diff -r a2bbbfca36ff -r ea08c522646b css/event-aggregator.css --- a/css/event-aggregator.css Sun Mar 22 21:49:44 2009 +0100 +++ b/css/event-aggregator.css Sun Mar 22 22:04:47 2009 +0100 @@ -69,7 +69,7 @@ .event-day-empty { background-color: #ffffff; - padding-bottom: 2em; + padding-bottom: 1em; } .event-day-busy { diff -r a2bbbfca36ff -r ea08c522646b macros/EventAggregator.py --- a/macros/EventAggregator.py Sun Mar 22 21:49:44 2009 +0100 +++ b/macros/EventAggregator.py Sun Mar 22 22:04:47 2009 +0100 @@ -418,82 +418,105 @@ output.append(fmt.table_row(on=0)) - # Visit each set of scheduled events. - - for coverage, events in week_events: + # Either generate empty days... - # Output each set. - + if not week_events: output.append(fmt.table_row(on=1)) - # Then, output day details. - for weekday in range(0, 7): day = first_day + weekday date = (year, month, day) - # Skip out-of-month days. + # Output out-of-month days. if day < 1 or day > number_of_days: output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-excluded"})) output.append(fmt.table_cell(on=0)) - continue - # Output the day. + # Output empty days. - if date in coverage: - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-busy"})) else: output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-empty"})) - # Get event details for the current day. + output.append(fmt.table_row(on=0)) + + # Or visit each set of scheduled events... + + else: + for coverage, events in week_events: + + # Output each set. + + output.append(fmt.table_row(on=1)) - for event_page, event_details in events: - if not (event_details["start"] <= date <= event_details["end"]): + # Then, output day details. + + for weekday in range(0, 7): + day = first_day + weekday + date = (year, month, day) + + # Skip out-of-month days. + + if day < 1 or day > number_of_days: + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-excluded"})) + output.append(fmt.table_cell(on=0)) continue - # Get a pretty version of the page name. - - pretty_pagename = getPrettyPageName(event_page) + # Output the day. - # Generate a colour for the event. + if date in coverage: + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-busy"})) + else: + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-empty"})) - bg = getColour(event_page.page_name) - fg = getBlackOrWhite(bg) + # Get event details for the current day. - css_classes = ["event-summary"] + for event_page, event_details in events: + if not (event_details["start"] <= date <= event_details["end"]): + continue + + # Get a pretty version of the page name. - if event_details["start"] == date: - css_classes.append("event-starts") - start_of_event = 1 - else: - start_of_event = 0 + pretty_pagename = getPrettyPageName(event_page) + + # Generate a colour for the event. - if event_details["end"] == date: - css_classes.append("event-ends") + bg = getColour(event_page.page_name) + fg = getBlackOrWhite(bg) + + css_classes = ["event-summary"] - # Output the event. + if event_details["start"] == date: + css_classes.append("event-starts") + start_of_event = 1 + else: + start_of_event = 0 - if name_usage == "daily" or start_of_event or weekday == 0 or day == 1: - hide_text = 0 - else: - hide_text = 1 + if event_details["end"] == date: + css_classes.append("event-ends") + + # Output the event. - output.append(fmt.div(on=1, css_class=(" ".join(css_classes)), - style=("background-color: rgb(%d, %d, %d); color: rgb(%d, %d, %d);" % (bg + fg)))) + if name_usage == "daily" or start_of_event or weekday == 0 or day == 1: + hide_text = 0 + else: + hide_text = 1 - if not hide_text: - output.append(event_page.link_to_raw(request, wikiutil.escape(pretty_pagename))) + output.append(fmt.div(on=1, css_class=(" ".join(css_classes)), + style=("background-color: rgb(%d, %d, %d); color: rgb(%d, %d, %d);" % (bg + fg)))) - output.append(fmt.div(on=0)) + if not hide_text: + output.append(event_page.link_to_raw(request, wikiutil.escape(pretty_pagename))) + + output.append(fmt.div(on=0)) - # End of day. + # End of day. - output.append(fmt.table_cell(on=0)) + output.append(fmt.table_cell(on=0)) - # End of set. + # End of set. - output.append(fmt.table_row(on=0)) + output.append(fmt.table_row(on=0)) # Process the next week...