# HG changeset patch # User Paul Boddie # Date 1421188676 -3600 # Node ID dc9a25250a462c6de0eaac883ee00e0018172578 # Parent 731f81633ac5535d6f90073849335f192a9e8eda Display times in the preferred time zone if no explicit event TZID is given. Added links to conflicting events. diff -r 731f81633ac5 -r dc9a25250a46 imip_manager.py --- a/imip_manager.py Tue Jan 13 22:41:18 2015 +0100 +++ b/imip_manager.py Tue Jan 13 23:37:56 2015 +0100 @@ -90,6 +90,10 @@ path_info = self.get_path_info() return "%s%s" % (path.rstrip("/"), path_info) + def new_url(self, path_info): + path = self.get_path() + return "%s/%s" % (path.rstrip("/"), path_info.lstrip("/")) + class ManagerHandler(Handler): """ @@ -314,16 +318,21 @@ on the current page. """ - details = self._get_details(obj) + # Obtain the user's timezone. + + prefs = self.get_preferences() + tzid = prefs.get("TZID", "UTC") # Provide a summary of the object. + details = self._get_details(obj) + self.page.dl() for name in ["SUMMARY", "DTSTART", "DTEND", "ORGANIZER", "ATTENDEE"]: if name in ["DTSTART", "DTEND"]: value, attr = get_item(details, name) - tzid = attr.get("TZID") + tzid = attr.get("TZID", tzid) value = self.format_datetime(to_timezone(get_datetime(value), tzid), "full") self.page.dt(name) self.page.dd(value) @@ -346,16 +355,26 @@ # Obtain any time zone details from the suggested event. _dtstart, attr = get_item(details, "DTSTART") - tzid = attr.get("TZID") + tzid = attr.get("TZID", tzid) # Show any conflicts. for t in have_conflict(freebusy, [(dtstart, dtend)], True): start, end, found_uid = t[:3] + + # Provide details of any conflicting event. + 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") - self.page.p("Event conflicts with another from %s to %s." % (start, end)) + self.page.p("Event conflicts with another from %s to %s: " % (start, end)) + + # Show the event summary for the conflicting event. + + found_obj = self._get_object(found_uid) + if found_obj: + found_details = self._get_details(found_obj) + self.page.a(get_value(found_details, "SUMMARY"), href=self.env.new_url(found_uid)) def show_requests_on_page(self): @@ -422,7 +441,7 @@ page.p("No events scheduled.") return - # Set the locale and obtain the user's timezone. + # Obtain the user's timezone. prefs = self.get_preferences() tzid = prefs.get("TZID", "UTC")