1.1 --- a/imip_manager.py Tue Feb 03 16:57:36 2015 +0100
1.2 +++ b/imip_manager.py Tue Feb 03 17:43:44 2015 +0100
1.3 @@ -910,6 +910,8 @@
1.4 partitioned_group_types.append(group_type)
1.5 partitioned_group_sources.append(group_source)
1.6
1.7 + self.show_calendar_day_controls(days)
1.8 +
1.9 page.table(cellspacing=5, cellpadding=5, class_="calendar")
1.10 self.show_calendar_participant_headings(partitioned_group_types, partitioned_group_sources, group_columns)
1.11 self.show_calendar_days(days, partitioned_groups, partitioned_group_types, group_columns)
1.12 @@ -919,6 +921,36 @@
1.13
1.14 page.form.close()
1.15
1.16 + def show_calendar_day_controls(self, days):
1.17 +
1.18 + "Show controls for the given 'days' in the calendar."
1.19 +
1.20 + page = self.page
1.21 + slots = self.env.get_args().get("slot", [])
1.22 +
1.23 + for day in days:
1.24 + value, identifier = self._day_value_and_identifier(day)
1.25 + self._slot_selector(value, identifier, slots)
1.26 +
1.27 + # Generate a dynamic stylesheet to allow day selections to colour
1.28 + # specific days.
1.29 + # NOTE: The style details need to be coordinated with the static
1.30 + # NOTE: stylesheet.
1.31 +
1.32 + page.style(type="text/css")
1.33 +
1.34 + for day in days:
1.35 + daystr = format_datetime(day)
1.36 + page.add("""\
1.37 +input.newevent#day-%s-:checked ~ table label.day.day-%s,
1.38 +input.newevent#day-%s-:checked ~ table label.timepoint.day-%s {
1.39 + background-color: #5f4;
1.40 + text-decoration: underline;
1.41 +}
1.42 +""" % (daystr, daystr, daystr, daystr))
1.43 +
1.44 + page.style.close()
1.45 +
1.46 def show_calendar_participant_headings(self, group_types, group_sources, group_columns):
1.47
1.48 """
1.49 @@ -972,7 +1004,7 @@
1.50 for day, intervals in all_days:
1.51 page.thead()
1.52 page.tr()
1.53 - page.th(class_="dayheading", colspan=all_columns+1)
1.54 + page.th(class_="dayheading container", colspan=all_columns+1)
1.55 self._day_heading(day)
1.56 page.th.close()
1.57 page.tr.close()
1.58 @@ -1097,18 +1129,34 @@
1.59 page.tr.close()
1.60
1.61 def _day_heading(self, day):
1.62 +
1.63 + """
1.64 + Generate a heading for 'day' of the following form:
1.65 +
1.66 + <label class="day day-20150203" for="day-20150203">Tuesday, 3 February 2015</label>
1.67 + """
1.68 +
1.69 page = self.page
1.70 + daystr = format_datetime(day)
1.71 value, identifier = self._day_value_and_identifier(day)
1.72 - slots = self.env.get_args().get("slot", [])
1.73 - self._slot_selector(value, identifier, slots)
1.74 - page.label(self.format_date(day, "full"), class_="day", for_=identifier)
1.75 + page.label(self.format_date(day, "full"), class_="day day-%s" % daystr, for_=identifier)
1.76
1.77 def _time_point(self, point, endpoint):
1.78 +
1.79 + """
1.80 + Generate headings for the 'point' to 'endpoint' period of the following
1.81 + form:
1.82 +
1.83 + <label class="timepoint day-20150203" for="slot-20150203T090000-20150203T100000">09:00:00 CET</label>
1.84 + <span class="endpoint">10:00:00 CET</span>
1.85 + """
1.86 +
1.87 page = self.page
1.88 + daystr = format_datetime(point.date())
1.89 value, identifier = self._slot_value_and_identifier(point, endpoint)
1.90 slots = self.env.get_args().get("slot", [])
1.91 self._slot_selector(value, identifier, slots)
1.92 - page.label(self.format_time(point, "long"), class_="timepoint", for_=identifier)
1.93 + page.label(self.format_time(point, "long"), class_="timepoint day-%s" % daystr, for_=identifier)
1.94 page.span(self.format_time(endpoint or get_end_of_day(point), "long"), class_="endpoint")
1.95
1.96 def _slot_selector(self, value, identifier, slots):