1.1 --- a/imipweb/calendar.py Fri Mar 27 17:35:05 2015 +0100
1.2 +++ b/imipweb/calendar.py Fri Mar 27 18:15:43 2015 +0100
1.3 @@ -28,7 +28,7 @@
1.4 from imiptools.period import add_day_start_points, add_empty_days, add_slots, \
1.5 convert_periods, get_freebusy_details, \
1.6 get_scale, get_slots, get_spans, partition_by_day, \
1.7 - POINT
1.8 + POINT, REPEATED
1.9 from imipweb.resource import Resource
1.10
1.11 class CalendarPage(Resource):
1.12 @@ -544,8 +544,6 @@
1.13 intervals = list(intervals)
1.14 intervals.sort()
1.15
1.16 - last = None
1.17 -
1.18 for (point, indicator), endpoint in intervals:
1.19 continuation = point == get_start_of_day(point, tzid)
1.20
1.21 @@ -566,14 +564,16 @@
1.22
1.23 css = " ".join([
1.24 "slot",
1.25 - (have_active or indicator) and "busy" or have_active_request and "suggested" or "empty",
1.26 + (have_active or indicator == REPEATED) and "busy" or have_active_request and "suggested" or "empty",
1.27 continuation and "daystart" or ""
1.28 ])
1.29
1.30 page.tr(class_=css)
1.31 - page.th(class_="timeslot")
1.32 if indicator == POINT:
1.33 + page.th(class_="timeslot")
1.34 self._time_point(point, endpoint)
1.35 + else:
1.36 + page.th()
1.37 page.th.close()
1.38
1.39 # Obtain slots for the time point from each group.
1.40 @@ -586,9 +586,7 @@
1.41 # the colspan is adjusted to be 1, not 0.
1.42
1.43 if not active:
1.44 - page.td(class_="empty container", colspan=max(columns, 1))
1.45 - self._empty_slot(point, endpoint)
1.46 - page.td.close()
1.47 + self._empty_slot(point, endpoint, max(columns, 1), indicator)
1.48 continue
1.49
1.50 slots = slots.items()
1.51 @@ -605,9 +603,7 @@
1.52 # Flush empty slots preceding this one.
1.53
1.54 if empty:
1.55 - page.td(class_="empty container", colspan=empty)
1.56 - self._empty_slot(point, endpoint)
1.57 - page.td.close()
1.58 + self._empty_slot(point, endpoint, empty, indicator)
1.59 empty = 0
1.60
1.61 start, end, uid, recurrenceid, summary, organiser, key = get_freebusy_details(t)
1.62 @@ -615,8 +611,10 @@
1.63
1.64 # Produce a table cell only at the start of the period
1.65 # or when continued at the start of a day.
1.66 + # Points defining the ends of instant events should
1.67 + # never define the start of new events.
1.68
1.69 - if point == start or continuation:
1.70 + if indicator == POINT and (point == start or continuation):
1.71
1.72 has_continued = continuation and point != start
1.73 will_continue = not ends_on_same_day(point, end, tzid)
1.74 @@ -658,9 +656,7 @@
1.75 empty = columns - len(active)
1.76
1.77 if empty:
1.78 - page.td(class_="empty container", colspan=empty)
1.79 - self._empty_slot(point, endpoint)
1.80 - page.td.close()
1.81 + self._empty_slot(point, endpoint, empty, indicator)
1.82
1.83 page.tr.close()
1.84
1.85 @@ -712,13 +708,20 @@
1.86 else:
1.87 page.input(name="slot", type="checkbox", value=value, id=identifier, class_="newevent selector")
1.88
1.89 - def _empty_slot(self, point, endpoint):
1.90 + def _empty_slot(self, point, endpoint, colspan, indicator):
1.91
1.92 - "Show an empty slot label for the given 'point' and 'endpoint'."
1.93 + """
1.94 + Show an empty slot cell for the given 'point' and 'endpoint', with the
1.95 + given 'colspan' and 'indicator' (0 as POINT or 1 as REPEATED)
1.96 + configuring the cell's appearance.
1.97 + """
1.98
1.99 page = self.page
1.100 - value, identifier = self._slot_value_and_identifier(point, endpoint)
1.101 - page.label("Select/deselect period", class_="newevent popup", for_=identifier)
1.102 + page.td(class_="empty%s" % (indicator == POINT and " container" or ""), colspan=colspan)
1.103 + if indicator == POINT:
1.104 + value, identifier = self._slot_value_and_identifier(point, endpoint)
1.105 + page.label("Select/deselect period", class_="newevent popup", for_=identifier)
1.106 + page.td.close()
1.107
1.108 def _day_value_and_identifier(self, day):
1.109