1.1 --- a/imipweb/calendar.py Sun Sep 27 23:38:51 2015 +0200
1.2 +++ b/imipweb/calendar.py Sun Sep 27 23:39:58 2015 +0200
1.3 @@ -470,8 +470,43 @@
1.4 # Generate controls to select time periods.
1.5
1.6 slots = self.env.get_args().get("slot", [])
1.7 + last = None
1.8 +
1.9 + # Produce controls for the intervals/slots. Where instants in time are
1.10 + # encountered, they are merged with the following slots, permitting the
1.11 + # selection of contiguous time periods. However, the identifiers
1.12 + # employed by controls corresponding to merged periods will encode the
1.13 + # instant so that labels may reference them conveniently.
1.14 +
1.15 + intervals = list(intervals)
1.16 + intervals.sort()
1.17 +
1.18 for point, endpoint in intervals:
1.19 - value, identifier = self._slot_value_and_identifier(point, endpoint)
1.20 +
1.21 + # Merge any previous slot with this one, producing a control.
1.22 +
1.23 + if last:
1.24 + _value, identifier = self._slot_value_and_identifier(last, last)
1.25 + value, _identifier = self._slot_value_and_identifier(last, endpoint)
1.26 + self._slot_selector(value, identifier, slots)
1.27 +
1.28 + # If representing an instant, hold the slot for merging.
1.29 +
1.30 + if endpoint and point.point == endpoint.point:
1.31 + last = point
1.32 +
1.33 + # If not representing an instant, produce a control.
1.34 +
1.35 + else:
1.36 + value, identifier = self._slot_value_and_identifier(point, endpoint)
1.37 + self._slot_selector(value, identifier, slots)
1.38 + last = None
1.39 +
1.40 + # Produce a control for any unmerged slot.
1.41 +
1.42 + if last:
1.43 + _value, identifier = self._slot_value_and_identifier(last, last)
1.44 + value, _identifier = self._slot_value_and_identifier(last, endpoint)
1.45 self._slot_selector(value, identifier, slots)
1.46
1.47 def show_calendar_participant_headings(self, group_types, group_sources, group_columns):
1.48 @@ -622,13 +657,16 @@
1.49 ])
1.50
1.51 page.tr(class_=css)
1.52 +
1.53 + # Produce a time interval heading, spanning two rows if this point
1.54 + # represents an instant.
1.55 +
1.56 if point.indicator == Point.PRINCIPAL:
1.57 timestr, timeid = self._slot_value_and_identifier(point, endpoint)
1.58 - page.th(class_="timeslot", id="region-%s" % timeid)
1.59 + page.th(class_="timeslot", id="region-%s" % timeid,
1.60 + rowspan=(endpoint and point.point == endpoint.point and 2 or 1))
1.61 self._time_point(point, endpoint)
1.62 - else:
1.63 - page.th()
1.64 - page.th.close()
1.65 + page.th.close()
1.66
1.67 # Obtain slots for the time point from each group.
1.68