1.1 --- a/htdocs/styles.css Tue Feb 03 16:57:36 2015 +0100
1.2 +++ b/htdocs/styles.css Tue Feb 03 17:43:44 2015 +0100
1.3 @@ -69,8 +69,9 @@
1.4 display: none;
1.5 }
1.6
1.7 +th.container,
1.8 td.container {
1.9 - padding: 0;
1.10 + padding: 0; /* for regions covered by labels */
1.11 }
1.12
1.13 th.dayheading:hover,
1.14 @@ -82,10 +83,14 @@
1.15 background-color: #af8;
1.16 }
1.17
1.18 +label.day,
1.19 +label.newevent.popup {
1.20 + display: block; /* to make labels cover regions */
1.21 + padding: 0.25em;
1.22 +}
1.23 +
1.24 label.newevent.popup {
1.25 visibility: hidden;
1.26 - display: block;
1.27 - padding: 0.25em;
1.28 text-align: center;
1.29 }
1.30
1.31 @@ -94,9 +99,8 @@
1.32 visibility: visible;
1.33 }
1.34
1.35 -input.newevent:checked ~ .day,
1.36 input.newevent:checked ~ .timepoint {
1.37 - background-color: #af8;
1.38 + background-color: #5f4;
1.39 text-decoration: underline;
1.40 }
1.41
2.1 --- a/imip_manager.py Tue Feb 03 16:57:36 2015 +0100
2.2 +++ b/imip_manager.py Tue Feb 03 17:43:44 2015 +0100
2.3 @@ -910,6 +910,8 @@
2.4 partitioned_group_types.append(group_type)
2.5 partitioned_group_sources.append(group_source)
2.6
2.7 + self.show_calendar_day_controls(days)
2.8 +
2.9 page.table(cellspacing=5, cellpadding=5, class_="calendar")
2.10 self.show_calendar_participant_headings(partitioned_group_types, partitioned_group_sources, group_columns)
2.11 self.show_calendar_days(days, partitioned_groups, partitioned_group_types, group_columns)
2.12 @@ -919,6 +921,36 @@
2.13
2.14 page.form.close()
2.15
2.16 + def show_calendar_day_controls(self, days):
2.17 +
2.18 + "Show controls for the given 'days' in the calendar."
2.19 +
2.20 + page = self.page
2.21 + slots = self.env.get_args().get("slot", [])
2.22 +
2.23 + for day in days:
2.24 + value, identifier = self._day_value_and_identifier(day)
2.25 + self._slot_selector(value, identifier, slots)
2.26 +
2.27 + # Generate a dynamic stylesheet to allow day selections to colour
2.28 + # specific days.
2.29 + # NOTE: The style details need to be coordinated with the static
2.30 + # NOTE: stylesheet.
2.31 +
2.32 + page.style(type="text/css")
2.33 +
2.34 + for day in days:
2.35 + daystr = format_datetime(day)
2.36 + page.add("""\
2.37 +input.newevent#day-%s-:checked ~ table label.day.day-%s,
2.38 +input.newevent#day-%s-:checked ~ table label.timepoint.day-%s {
2.39 + background-color: #5f4;
2.40 + text-decoration: underline;
2.41 +}
2.42 +""" % (daystr, daystr, daystr, daystr))
2.43 +
2.44 + page.style.close()
2.45 +
2.46 def show_calendar_participant_headings(self, group_types, group_sources, group_columns):
2.47
2.48 """
2.49 @@ -972,7 +1004,7 @@
2.50 for day, intervals in all_days:
2.51 page.thead()
2.52 page.tr()
2.53 - page.th(class_="dayheading", colspan=all_columns+1)
2.54 + page.th(class_="dayheading container", colspan=all_columns+1)
2.55 self._day_heading(day)
2.56 page.th.close()
2.57 page.tr.close()
2.58 @@ -1097,18 +1129,34 @@
2.59 page.tr.close()
2.60
2.61 def _day_heading(self, day):
2.62 +
2.63 + """
2.64 + Generate a heading for 'day' of the following form:
2.65 +
2.66 + <label class="day day-20150203" for="day-20150203">Tuesday, 3 February 2015</label>
2.67 + """
2.68 +
2.69 page = self.page
2.70 + daystr = format_datetime(day)
2.71 value, identifier = self._day_value_and_identifier(day)
2.72 - slots = self.env.get_args().get("slot", [])
2.73 - self._slot_selector(value, identifier, slots)
2.74 - page.label(self.format_date(day, "full"), class_="day", for_=identifier)
2.75 + page.label(self.format_date(day, "full"), class_="day day-%s" % daystr, for_=identifier)
2.76
2.77 def _time_point(self, point, endpoint):
2.78 +
2.79 + """
2.80 + Generate headings for the 'point' to 'endpoint' period of the following
2.81 + form:
2.82 +
2.83 + <label class="timepoint day-20150203" for="slot-20150203T090000-20150203T100000">09:00:00 CET</label>
2.84 + <span class="endpoint">10:00:00 CET</span>
2.85 + """
2.86 +
2.87 page = self.page
2.88 + daystr = format_datetime(point.date())
2.89 value, identifier = self._slot_value_and_identifier(point, endpoint)
2.90 slots = self.env.get_args().get("slot", [])
2.91 self._slot_selector(value, identifier, slots)
2.92 - page.label(self.format_time(point, "long"), class_="timepoint", for_=identifier)
2.93 + page.label(self.format_time(point, "long"), class_="timepoint day-%s" % daystr, for_=identifier)
2.94 page.span(self.format_time(endpoint or get_end_of_day(point), "long"), class_="endpoint")
2.95
2.96 def _slot_selector(self, value, identifier, slots):