# HG changeset patch # User Paul Boddie # Date 1422143813 -3600 # Node ID b72619415ebf812ab365bc0c9cd141886ce865aa # Parent 86708cc73d28dbc3f3024b32c4c322f20a4eda92 Distinguish between requests and events, unlinking events for pending requests. diff -r 86708cc73d28 -r b72619415ebf imip_manager.py --- a/imip_manager.py Sun Jan 25 00:55:38 2015 +0100 +++ b/imip_manager.py Sun Jan 25 00:56:53 2015 +0100 @@ -451,7 +451,7 @@ if obj: details = self._get_details(obj) self.page.li() - self.page.a(get_value(details, "SUMMARY"), href="#%s" % request) + self.page.a(get_value(details, "SUMMARY"), href="#request-%s" % request) self.page.li.close() self.page.ul.close() @@ -521,11 +521,12 @@ groups = [] group_columns = [] + group_types = [] all_points = set() # Obtain time point information for each group of periods. - for periods in [request_summary, freebusy]: + for periods, group_type in zip([request_summary, freebusy], ["request", "freebusy"]): periods = convert_periods(periods, tzid) # Get the time scale with start and end points. @@ -543,14 +544,16 @@ # Record the slots and all time points employed. groups.append(slots) + group_types.append(group_type) all_points.update([point for point, slot in slots]) # Partition the groups into days. days = {} partitioned_groups = [] + partitioned_group_types = [] - for slots in groups: + for slots, group_type in zip(groups, group_types): # Propagate time points to all groups of time slots. @@ -578,14 +581,15 @@ days[day].update(day_slots.keys()) if partitioned: - group_columns.append(columns + 1) + group_columns.append(columns) partitioned_groups.append(partitioned) + partitioned_group_types.append(group_type) page.table(border=1, cellspacing=0, cellpadding=5) - self.show_calendar_days(days, partitioned_groups, group_columns) + self.show_calendar_days(days, partitioned_groups, partitioned_group_types, group_columns) page.table.close() - def show_calendar_days(self, days, partitioned_groups, group_columns): + def show_calendar_days(self, days, partitioned_groups, partitioned_group_types, group_columns): page = self.page # Determine the number of columns required, the days providing time @@ -599,16 +603,16 @@ for day, points in all_days: page.tr() - page.th(class_="dayheading", colspan=all_columns) + page.th(class_="dayheading", colspan=all_columns+1) page.add(self.format_date(day, "full")) page.th.close() page.tr.close() groups_for_day = [partitioned.get(day) for partitioned in partitioned_groups] - self.show_calendar_points(points, groups_for_day, group_columns) + self.show_calendar_points(points, groups_for_day, partitioned_group_types, group_columns) - def show_calendar_points(self, points, groups, group_columns): + def show_calendar_points(self, points, groups, group_types, group_columns): page = self.page # Produce a row for each time point. @@ -626,7 +630,7 @@ # Obtain slots for the time point from each group. - for columns, slots in zip(group_columns, groups): + for columns, slots, group_type in zip(group_columns, groups, group_types): active = slots and slots.get(point) if not active: @@ -644,18 +648,34 @@ if t: start, end, uid = t[:3] span = spans[uid] + + # Produce a table cell only at the start of the period + # or when continued at the start of a day. + if point == start or continuation: page.td(class_="event", rowspan=span) + obj = self._get_object(uid) if obj: details = self._get_details(obj) summary = get_value(details, "SUMMARY") - href = "%s/%s" % (self.env.get_url().rstrip("/"), uid) - if point == start: - page.a(summary, href=href, id=uid) + + # Only link to events if they are not being + # updated by requests. + + if uid in self._get_requests() and group_type != "request": + page.span(summary, id="%s-%s" % (group_type, uid)) else: - page.a(summary, href=href) + href = "%s/%s" % (self.env.get_url().rstrip("/"), uid) + + # Only anchor the first cell of events. + + if point == start: + page.a(summary, href=href, id="%s-%s" % (group_type, uid)) + else: + page.a(summary, href=href) + page.td.close() else: page.td(class_="empty")