# HG changeset patch # User Paul Boddie # Date 1423492356 -3600 # Node ID 6116cda705d38235798406da778a186aaa427d6a # Parent a3f1b894edca239b04368a32be03d12df2e5b3b4 Improved the presentation of conflicting events. diff -r a3f1b894edca -r 6116cda705d3 htdocs/styles.css --- a/htdocs/styles.css Mon Feb 09 15:11:15 2015 +0100 +++ b/htdocs/styles.css Mon Feb 09 15:32:36 2015 +0100 @@ -1,6 +1,7 @@ /* Table styling. */ table.calendar, +table.conflicts, table.object { border: 2px solid #000; } diff -r a3f1b894edca -r 6116cda705d3 imip_manager.py --- a/imip_manager.py Mon Feb 09 15:11:15 2015 +0100 +++ b/imip_manager.py Mon Feb 09 15:32:36 2015 +0100 @@ -885,21 +885,50 @@ # Show any conflicts. - for t in have_conflict(freebusy, [(dtstart, dtend)], True): - start, end, found_uid = t[:3] + conflicts = [t for t in have_conflict(freebusy, [(dtstart, dtend)], True) if t[2] != uid] - # Provide details of any conflicting event. + if conflicts: + page.p("This event conflicts with others:") - if uid != found_uid: - start = self.format_datetime(to_timezone(get_datetime(start), tzid), "full") - end = self.format_datetime(to_timezone(get_datetime(end), tzid), "full") - page.p("Event conflicts with another from %s to %s: " % (start, end)) + page.table(cellspacing=5, cellpadding=5, class_="conflicts") + page.thead() + page.tr() + page.th("Event") + page.th("Start") + page.th("End") + page.tr.close() + page.thead.close() + page.tbody() + + for t in conflicts: + start, end, found_uid = t[:3] + + # Provide details of any conflicting event. + + start = self.format_datetime(to_timezone(get_datetime(start), tzid), "long") + end = self.format_datetime(to_timezone(get_datetime(end), tzid), "long") + + page.tr() # Show the event summary for the conflicting event. + page.td() + found_obj = self._get_object(found_uid) if found_obj: page.a(found_obj.get_value("SUMMARY"), href=self.env.new_url(found_uid)) + else: + page.add("No details available") + + page.td.close() + + page.td(start) + page.td(end) + + page.tr.close() + + page.tbody.close() + page.table.close() self.show_request_controls(obj) page.form.close()