1.1 --- a/imipweb/event.py Wed May 13 14:59:30 2015 +0200
1.2 +++ b/imipweb/event.py Wed May 13 15:40:53 2015 +0200
1.3 @@ -728,33 +728,8 @@
1.4
1.5 if self.is_organiser(obj) and recurrences:
1.6
1.7 - for index, p in enumerate(recurrences):
1.8 -
1.9 - # Isolate the controls from neighbouring tables.
1.10 -
1.11 - page.div()
1.12 -
1.13 - self.show_object_datetime_controls(p, index)
1.14 -
1.15 - page.table(cellspacing=5, cellpadding=5, class_="recurrence")
1.16 - page.caption(p.origin == "RRULE" and "Occurrence from rule" or "Occurrence")
1.17 - page.tbody()
1.18 -
1.19 - page.tr()
1.20 - error = errors and ("dtstart", index) in errors and " error" or ""
1.21 - page.th("Start", class_="objectheading start%s" % error)
1.22 - self.show_recurrence_controls(obj, index, p, recurrenceid, recurrenceids, True)
1.23 - page.tr.close()
1.24 - page.tr()
1.25 - error = errors and ("dtend", index) in errors and " error" or ""
1.26 - page.th("End", class_="objectheading end%s" % error)
1.27 - self.show_recurrence_controls(obj, index, p, recurrenceid, recurrenceids, False)
1.28 - page.tr.close()
1.29 -
1.30 - page.tbody.close()
1.31 - page.table.close()
1.32 -
1.33 - page.div.close()
1.34 + for index, period in enumerate(recurrences):
1.35 + self.show_recurrence(obj, index, period, recurrenceid, recurrenceids, errors)
1.36
1.37 # Otherwise, use a compact single table.
1.38
1.39 @@ -769,15 +744,56 @@
1.40 page.thead.close()
1.41 page.tbody()
1.42
1.43 - for index, p in enumerate(recurrences):
1.44 + for index, period in enumerate(recurrences):
1.45 page.tr()
1.46 - self.show_recurrence_label(p, recurrenceid, recurrenceids, True)
1.47 - self.show_recurrence_label(p, recurrenceid, recurrenceids, False)
1.48 + self.show_recurrence_label(period, recurrenceid, recurrenceids, True)
1.49 + self.show_recurrence_label(period, recurrenceid, recurrenceids, False)
1.50 page.tr.close()
1.51
1.52 page.tbody.close()
1.53 page.table.close()
1.54
1.55 + def show_recurrence(self, obj, index, period, recurrenceid, recurrenceids, errors=None):
1.56 +
1.57 + """
1.58 + Show recurrence controls for a recurrence provided by 'obj' with the
1.59 + given 'index' position in the list of periods, the given 'period'
1.60 + details, where a 'recurrenceid' indicates any specific recurrence, and
1.61 + where 'recurrenceids' indicates all known additional recurrences for the
1.62 + object.
1.63 +
1.64 + If 'errors' is given, show a suitable message for the different errors
1.65 + provided.
1.66 + """
1.67 +
1.68 + page = self.page
1.69 +
1.70 + # Isolate the controls from neighbouring tables.
1.71 +
1.72 + page.div()
1.73 +
1.74 + self.show_object_datetime_controls(period, index)
1.75 +
1.76 + page.table(cellspacing=5, cellpadding=5, class_="recurrence")
1.77 + page.caption(period.origin == "RRULE" and "Occurrence from rule" or "Occurrence")
1.78 + page.tbody()
1.79 +
1.80 + page.tr()
1.81 + error = errors and ("dtstart", index) in errors and " error" or ""
1.82 + page.th("Start", class_="objectheading start%s" % error)
1.83 + self.show_recurrence_controls(obj, index, period, recurrenceid, recurrenceids, True)
1.84 + page.tr.close()
1.85 + page.tr()
1.86 + error = errors and ("dtend", index) in errors and " error" or ""
1.87 + page.th("End", class_="objectheading end%s" % error)
1.88 + self.show_recurrence_controls(obj, index, period, recurrenceid, recurrenceids, False)
1.89 + page.tr.close()
1.90 +
1.91 + page.tbody.close()
1.92 + page.table.close()
1.93 +
1.94 + page.div.close()
1.95 +
1.96 def show_conflicting_events(self, uid, obj):
1.97
1.98 """