# HG changeset patch # User Paul Boddie # Date 1445205482 -7200 # Node ID 8a9d331c6b8b66aa021a2d75735cf5a533495f4f # Parent f113c939d93c0a462e9d2e36ee16807fbad38449 Propagate calendar period state between resources, maintaining the view when returning to the calendar. diff -r f113c939d93c -r 8a9d331c6b8b imipweb/calendar.py --- a/imipweb/calendar.py Sun Oct 18 23:32:32 2015 +0200 +++ b/imipweb/calendar.py Sun Oct 18 23:58:02 2015 +0200 @@ -169,7 +169,7 @@ # Redirect to the object (or the first of the objects), where instead of # attendee controls, there will be organiser controls. - self.redirect(self.link_to(uid)) + self.redirect(self.link_to(uid, args=self.get_time_navigation_args())) return True # Page fragment methods. @@ -307,6 +307,18 @@ view_end = self.get_date_arg(args, end_name) return view_start, view_end + def get_time_navigation_args(self): + + "Return a dictionary containing start and/or end navigation details." + + view_start, view_end = self.get_time_navigation() + link_args = {} + if view_start: + link_args["start"] = format_datetime(view_start) + if view_end: + link_args["end"] = format_datetime(view_end) + return link_args + # Full page output methods. def show(self): @@ -711,6 +723,10 @@ tzid = self.get_tzid() + # Get view information for links. + + link_args = self.get_time_navigation_args() + # Produce a row for each interval. intervals = list(intervals) @@ -833,11 +849,12 @@ # which counter-proposals exist). elif group_type == "request" and self._have_request(p.uid, p.recurrenceid, "COUNTER", True): - page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid, - {"counter" : self._period_identifier(p)})) + d = {"counter" : self._period_identifier(p)} + d.update(link_args) + page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid, d)) else: - page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid)) + page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid, link_args)) page.td.close() else: diff -r f113c939d93c -r 8a9d331c6b8b imipweb/event.py --- a/imipweb/event.py Sun Oct 18 23:32:32 2015 +0200 +++ b/imipweb/event.py Sun Oct 18 23:58:02 2015 +0200 @@ -755,6 +755,14 @@ def __init__(self, resource=None, messenger=None): ResourceClientForObject.__init__(self, resource, messenger or Messenger()) + def link_to(self, uid=None, recurrenceid=None): + args = self.env.get_query() + d = {} + for name in ("start", "end"): + if args.get(name): + d[name] = args[name][0] + return ResourceClientForObject.link_to(self, uid, recurrenceid, d) + # Request logic methods. def is_initial_load(self): @@ -794,7 +802,7 @@ # If ignoring the object, return to the calendar. if ignore: - self.redirect(self.env.get_path()) + self.redirect(self.link_to()) return None # Update the object. @@ -946,7 +954,7 @@ # Upon handling an action, redirect to the main page. if handled: - self.redirect(self.env.get_path()) + self.redirect(self.link_to()) return None