1.1 --- a/css/event-aggregator.css Sat Apr 04 03:49:02 2009 +0200
1.2 +++ b/css/event-aggregator.css Sat Apr 04 20:49:48 2009 +0200
1.3 @@ -52,12 +52,36 @@
1.4 border: 1px solid #dddddd;
1.5 }
1.6
1.7 +/* Day types: days with content (busy), unused days (excluded or empty). */
1.8 +
1.9 +.event-day-busy {
1.10 + background-color: #ffffff;
1.11 +}
1.12 +
1.13 +.event-day-excluded {
1.14 + background-color: #dddddd;
1.15 + border-left: 1px solid #dddddd;
1.16 + border-right: 1px solid #dddddd;
1.17 +}
1.18 +
1.19 +.event-day-empty {
1.20 + background-color: #ffffff;
1.21 + border-left: 1px solid #dddddd;
1.22 + border-right: 1px solid #dddddd;
1.23 +}
1.24 +
1.25 +.event-day-content.event-day-empty {
1.26 + padding-bottom: 2em;
1.27 +}
1.28 +
1.29 +/* Day headings and numbers. */
1.30 +
1.31 .event-day-heading {
1.32 - background-color: #ffffff;
1.33 width: 14%;
1.34 vertical-align: top;
1.35 padding-top: 0;
1.36 padding-left: 0;
1.37 + padding-bottom: 0.5em;
1.38 border-top: 1px solid #dddddd;
1.39 border-bottom: 0;
1.40 border-left: 1px solid #dddddd;
1.41 @@ -77,61 +101,70 @@
1.42 padding: 0.25em;
1.43 }
1.44
1.45 -.event-day {
1.46 +/* Day content. */
1.47 +
1.48 +.event-day-content {
1.49 width: 14%;
1.50 vertical-align: top;
1.51 - padding-left: 0;
1.52 - padding-right: 0;
1.53 + padding: 0;
1.54 border-top: 0;
1.55 border-bottom: 0;
1.56 +}
1.57 +
1.58 +.event-day-starting {
1.59 + border-left: 0;
1.60 + border-right: 1px solid #dddddd;
1.61 +}
1.62 +
1.63 +.event-day-ending {
1.64 + border-left: 1px solid #dddddd;
1.65 + border-right: 0;
1.66 +}
1.67 +
1.68 +.event-day-full,
1.69 +.event-day-single,
1.70 +.event-day-multiple {
1.71 border-left: 1px solid #dddddd;
1.72 border-right: 1px solid #dddddd;
1.73 }
1.74
1.75 -.event-day-empty {
1.76 - background-color: #ffffff;
1.77 -}
1.78 -
1.79 -.event-day.event-day-empty {
1.80 - padding-bottom: 2em;
1.81 +.event-day-start-gap {
1.82 + width: 2%;
1.83 + border-top: 0;
1.84 + border-bottom: 0;
1.85 + border-left: 1px solid #dddddd;
1.86 + border-right: 0;
1.87 }
1.88
1.89 -.event-day-busy {
1.90 - background-color: #ffffff;
1.91 +.event-day-end-gap {
1.92 + width: 2%;
1.93 + border-top: 0;
1.94 + border-bottom: 0;
1.95 + border-left: 0;
1.96 + border-right: 1px solid #dddddd;
1.97 }
1.98
1.99 -.event-day-excluded {
1.100 - background-color: #dddddd;
1.101 -}
1.102 +/* Event details. */
1.103
1.104 .event-summary-box {
1.105 position: relative;
1.106 }
1.107
1.108 -.event-summary-box a:link,
1.109 -.event-summary-box a:hover,
1.110 -.event-summary-box a:visited {
1.111 +.event-day-content a:link,
1.112 +.event-day-content a:hover,
1.113 +.event-day-content a:visited {
1.114 color: inherit !important;
1.115 }
1.116
1.117 .event-summary {
1.118 - padding: 0.25em 0.75em 0.25em 0.75em;
1.119 - margin-bottom: 0.25em;
1.120 - min-height: 2em;
1.121 + padding: 0.5em;
1.122 margin-left: 0;
1.123 margin-right: 0;
1.124 overflow: hidden;
1.125 }
1.126
1.127 -.event-summary.event-starts {
1.128 - padding-left: 0.25em;
1.129 - padding-right: 0.75em;
1.130 +.event-day-single .event-summary {
1.131 margin-left: 0.5em;
1.132 -}
1.133 -
1.134 -.event-summary.event-ends {
1.135 - padding-left: 0.75em;
1.136 - padding-right: 0.25em;
1.137 margin-right: 0.5em;
1.138 }
1.139
1.140 @@ -142,14 +175,23 @@
1.141 left: 0;
1.142 top: 0;
1.143 z-index: 2;
1.144 - padding: 0.25em 0.75em 0.25em 0.75em;
1.145 - min-height: 2em;
1.146 + padding: 0.5em;
1.147 }
1.148
1.149 .event-summary-box:hover > .event-summary-popup {
1.150 display: block;
1.151 }
1.152
1.153 +/* Day spacers. */
1.154 +
1.155 +.event-day-spacer {
1.156 + min-height: 0.5em;
1.157 + border-top: 0;
1.158 + border-bottom: 0;
1.159 + border-left: 1px solid #dddddd;
1.160 + border-right: 1px solid #dddddd;
1.161 +}
1.162 +
1.163 /* List/summary view. */
1.164
1.165 .event-listings {
2.1 --- a/macros/EventAggregator.py Sat Apr 04 03:49:02 2009 +0200
2.2 +++ b/macros/EventAggregator.py Sat Apr 04 20:49:48 2009 +0200
2.3 @@ -96,7 +96,7 @@
2.4 calendar_start = None
2.5 calendar_end = None
2.6 mode = "calendar"
2.7 - name_usage = "daily"
2.8 + name_usage = "weekly"
2.9 calendar_name = None
2.10
2.11 for arg in parsed_args:
2.12 @@ -198,7 +198,7 @@
2.13 output.append(fmt.table(on=1, attrs={"tableclass" : "event-month"}))
2.14
2.15 output.append(fmt.table_row(on=1))
2.16 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-month-heading", "colspan" : "7"}))
2.17 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-month-heading", "colspan" : "21"}))
2.18
2.19 # Either write a month heading or produce a link for navigable
2.20 # calendars.
2.21 @@ -271,7 +271,7 @@
2.22 output.append(fmt.table_row(on=1))
2.23
2.24 for weekday in range(0, 7):
2.25 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-weekday-heading"}))
2.26 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-weekday-heading", "colspan" : "3"}))
2.27 output.append(fmt.text(_(EventAggregatorSupport.getDayLabel(weekday))))
2.28 output.append(fmt.table_cell(on=0))
2.29
2.30 @@ -310,16 +310,16 @@
2.31 # Output out-of-month days.
2.32
2.33 if day < 1 or day > number_of_days:
2.34 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-heading event-day-excluded"}))
2.35 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-heading event-day-excluded", "colspan" : "3"}))
2.36 output.append(fmt.table_cell(on=0))
2.37
2.38 # Output normal days.
2.39
2.40 else:
2.41 if date in week_coverage:
2.42 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-heading event-day-busy"}))
2.43 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-heading event-day-busy", "colspan" : "3"}))
2.44 else:
2.45 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-heading event-day-empty"}))
2.46 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-heading event-day-empty", "colspan" : "3"}))
2.47
2.48 output.append(fmt.div(on=1))
2.49 output.append(fmt.span(on=1, css_class="event-day-number"))
2.50 @@ -347,13 +347,15 @@
2.51 # Output out-of-month days.
2.52
2.53 if day < 1 or day > number_of_days:
2.54 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-excluded"}))
2.55 + output.append(fmt.table_cell(on=1,
2.56 + attrs={"class" : "event-day-content event-day-excluded", "colspan" : "3"}))
2.57 output.append(fmt.table_cell(on=0))
2.58
2.59 # Output empty days.
2.60
2.61 else:
2.62 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-empty"}))
2.63 + output.append(fmt.table_cell(on=1,
2.64 + attrs={"class" : "event-day-content event-day-empty", "colspan" : "3"}))
2.65
2.66 output.append(fmt.table_row(on=0))
2.67
2.68 @@ -375,16 +377,16 @@
2.69 # Skip out-of-month days.
2.70
2.71 if day < 1 or day > number_of_days:
2.72 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-excluded"}))
2.73 + output.append(fmt.table_cell(on=1,
2.74 + attrs={"class" : "event-day-content event-day-excluded", "colspan" : "3"}))
2.75 output.append(fmt.table_cell(on=0))
2.76 continue
2.77
2.78 # Output the day.
2.79
2.80 - if date in coverage:
2.81 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-busy"}))
2.82 - else:
2.83 - output.append(fmt.table_cell(on=1, attrs={"class" : "event-day event-day-empty"}))
2.84 + if date not in coverage:
2.85 + output.append(fmt.table_cell(on=1,
2.86 + attrs={"class" : "event-day-content event-day-empty", "colspan" : "3"}))
2.87
2.88 # Get event details for the current day.
2.89
2.90 @@ -392,6 +394,10 @@
2.91 if not (event_details["start"] <= date <= event_details["end"]):
2.92 continue
2.93
2.94 + # Get basic properties of the event.
2.95 +
2.96 + starts_today = event_details["start"] == date
2.97 + ends_today = event_details["end"] == date
2.98 event_summary = EventAggregatorSupport.getEventSummary(event_page, event_details)
2.99
2.100 # Generate a colour for the event.
2.101 @@ -401,43 +407,143 @@
2.102 style = ("background-color: rgb(%d, %d, %d); color: rgb(%d, %d, %d);" % (bg + fg))
2.103 hidden_style = ("background-color: rgb(%d, %d, %d); color: rgb(%d, %d, %d);" % (bg + bg))
2.104
2.105 - css_classes = ["event-summary"]
2.106 + # Determine if the event name should be shown.
2.107
2.108 - if event_details["start"] == date:
2.109 - css_classes.append("event-starts")
2.110 - start_of_event = 1
2.111 - else:
2.112 - start_of_event = 0
2.113 + start_of_period = starts_today or weekday == 0 or day == 1
2.114
2.115 - if event_details["end"] == date:
2.116 - css_classes.append("event-ends")
2.117 -
2.118 - # Output the event.
2.119 -
2.120 - if name_usage == "daily" or start_of_event or weekday == 0 or day == 1:
2.121 + if name_usage == "daily" or start_of_period:
2.122 hide_text = 0
2.123 else:
2.124 hide_text = 1
2.125
2.126 - output.append(fmt.div(on=1, css_class="event-summary-box"))
2.127 + # Output start of day gap and determine whether
2.128 + # any event content should be explicitly output
2.129 + # for this day.
2.130 +
2.131 + if starts_today:
2.132 +
2.133 + # Single day events...
2.134 +
2.135 + if ends_today:
2.136 + colspan = 3
2.137 + event_day_type = "event-day-single"
2.138 +
2.139 + # Events starting today...
2.140 +
2.141 + else:
2.142 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-start-gap"}))
2.143 + output.append(fmt.table_cell(on=0))
2.144 +
2.145 + # Calculate the span of this cell.
2.146 + # Events whose names appear on every day...
2.147 +
2.148 + if name_usage == "daily":
2.149 + colspan = 2
2.150 + event_day_type = "event-day-starting"
2.151 +
2.152 + # Events whose names appear once per week...
2.153 +
2.154 + else:
2.155 + if event_details["end"] <= week_end:
2.156 + event_length = event_details["end"][2] - day + 1
2.157 + colspan = (event_length - 2) * 3 + 4
2.158 + else:
2.159 + event_length = week_end[2] - day + 1
2.160 + colspan = (event_length - 1) * 3 + 2
2.161 +
2.162 + event_day_type = "event-day-multiple"
2.163 +
2.164 + # Events continuing from a previous week...
2.165 +
2.166 + elif start_of_period:
2.167 +
2.168 + # End of continuing event...
2.169 +
2.170 + if ends_today:
2.171 + colspan = 2
2.172 + event_day_type = "event-day-ending"
2.173 +
2.174 + # Events continuing for at least one more day...
2.175 +
2.176 + else:
2.177 +
2.178 + # Calculate the span of this cell.
2.179 + # Events whose names appear on every day...
2.180 +
2.181 + if name_usage == "daily":
2.182 + colspan = 3
2.183 + event_day_type = "event-day-full"
2.184 +
2.185 + # Events whose names appear once per week...
2.186
2.187 - if not hide_text:
2.188 - output.append(fmt.div(on=1, css_class=(" ".join(css_classes)), style=style))
2.189 - output.append(linkToPage(request, event_page, event_summary))
2.190 + else:
2.191 + if event_details["end"] <= week_end:
2.192 + event_length = event_details["end"][2] - day + 1
2.193 + colspan = (event_length - 1) * 3 + 2
2.194 + else:
2.195 + event_length = week_end[2] - day + 1
2.196 + colspan = event_length * 3
2.197 +
2.198 + event_day_type = "event-day-multiple"
2.199 +
2.200 + # Continuing events whose names appear on every day...
2.201 +
2.202 + elif name_usage == "daily":
2.203 + if ends_today:
2.204 + colspan = 2
2.205 + event_day_type = "event-day-ending"
2.206 + else:
2.207 + colspan = 3
2.208 + event_day_type = "event-day-full"
2.209 +
2.210 + # Continuing events whose names appear once per week...
2.211 +
2.212 + else:
2.213 + colspan = None
2.214 +
2.215 + # Output the main content only if it is not
2.216 + # continuing from a previous day.
2.217 +
2.218 + if colspan is not None:
2.219 +
2.220 + # Colour the cell for continuing events.
2.221 +
2.222 + attrs={
2.223 + "class" : "event-day-content event-day-busy %s" % event_day_type,
2.224 + "colspan" : str(colspan)
2.225 + }
2.226 +
2.227 + if not (starts_today and ends_today):
2.228 + attrs["style"] = hide_text and hidden_style or style
2.229 +
2.230 + output.append(fmt.table_cell(on=1, attrs=attrs))
2.231 +
2.232 + # Output the event.
2.233 +
2.234 + if starts_today and ends_today or not hide_text:
2.235 +
2.236 + output.append(fmt.div(on=1, css_class="event-summary-box"))
2.237 + output.append(fmt.div(on=1, css_class="event-summary", style=style))
2.238 + output.append(linkToPage(request, event_page, event_summary))
2.239 + output.append(fmt.div(on=0))
2.240 +
2.241 + # Add a pop-up element for long summaries.
2.242 +
2.243 + output.append(fmt.div(on=1, css_class="event-summary-popup", style=style))
2.244 + output.append(linkToPage(request, event_page, event_summary))
2.245 + output.append(fmt.div(on=0))
2.246 +
2.247 + output.append(fmt.div(on=0))
2.248 +
2.249 + # Output end of day content.
2.250 +
2.251 output.append(fmt.div(on=0))
2.252
2.253 - # Add a pop-up element for long summaries.
2.254 -
2.255 - output.append(fmt.div(on=1, css_class="event-summary-popup", style=style))
2.256 - output.append(linkToPage(request, event_page, event_summary))
2.257 - output.append(fmt.div(on=0))
2.258 + # Output end of day gap.
2.259
2.260 - else:
2.261 - output.append(fmt.div(on=1, css_class=(" ".join(css_classes)), style=hidden_style))
2.262 - output.append(fmt.text(event_summary))
2.263 - output.append(fmt.div(on=0))
2.264 -
2.265 - output.append(fmt.div(on=0))
2.266 + if ends_today and not starts_today:
2.267 + output.append(fmt.table_cell(on=1, attrs={"class" : "event-day-end-gap"}))
2.268 + output.append(fmt.table_cell(on=0))
2.269
2.270 # End of day.
2.271
2.272 @@ -447,6 +553,24 @@
2.273
2.274 output.append(fmt.table_row(on=0))
2.275
2.276 + # Add a spacer.
2.277 +
2.278 + output.append(fmt.table_row(on=1))
2.279 +
2.280 + for weekday in range(0, 7):
2.281 + day = first_day + weekday
2.282 + css_classes = "event-day-spacer"
2.283 +
2.284 + # Skip out-of-month days.
2.285 +
2.286 + if day < 1 or day > number_of_days:
2.287 + css_classes += " event-day-excluded"
2.288 +
2.289 + output.append(fmt.table_cell(on=1, attrs={"class" : css_classes, "colspan" : "3"}))
2.290 + output.append(fmt.table_cell(on=0))
2.291 +
2.292 + output.append(fmt.table_row(on=0))
2.293 +
2.294 # Process the next week...
2.295
2.296 first_day += 7
3.1 --- a/pages/HelpOnEventAggregator Sat Apr 04 03:49:02 2009 +0200
3.2 +++ b/pages/HelpOnEventAggregator Sat Apr 04 20:49:48 2009 +0200
3.3 @@ -90,6 +90,28 @@
3.4 <<EventAggregator(CategoryEvents,start=yearstart-1,end=yearend+1)>>
3.5 }}}
3.6
3.7 +=== Event Naming ===
3.8 +
3.9 +The default calendar view shows event names once per week. However, you can choose to show an event name on each day an event occurs:
3.10 +
3.11 +{{{
3.12 +## Show the name on every day.
3.13 +<<EventAggregator(CategoryEvents,names=daily)>>
3.14 +## Show the name once per week.
3.15 +<<EventAggregator(CategoryEvents,names=weekly)>>
3.16 +}}}
3.17 +
3.18 +=== Navigation Controls ===
3.19 +
3.20 +The above examples have all provided fixed views of known events. However, a set of controls can be added to a calendar in order to let users navigate different time periods. This is done by providing a `calendar` parameter, indicating the name of the calendar, and by specifying a period of time:
3.21 +
3.22 +{{{
3.23 +## Provide a navigable calendar.
3.24 +<<EventAggregator(CategoryEvents,start=current,end=current,calendar=monthly)>>
3.25 +}}}
3.26 +
3.27 +Without any time period, the calendar would show all events, and there would be no real need to provide navigation, since there would be no events outside the displayed period to navigate to. It is possible to omit either the `start` or the `end` parameter and still provide navigation, however.
3.28 +
3.29 == Showing Event Lists ==
3.30
3.31 A more plain view of events can be displayed by specifying the `mode` parameter as follows: