1.1 --- a/htdocs/styles.css Thu Sep 24 23:41:47 2015 +0200
1.2 +++ b/htdocs/styles.css Fri Sep 25 15:06:06 2015 +0200
1.3 @@ -2,6 +2,7 @@
1.4
1.5 table.calendar,
1.6 table.conflicts,
1.7 +table.counters,
1.8 table.recurrence,
1.9 table.object {
1.10 border: 2px solid #000;
2.1 --- a/imip_store.py Thu Sep 24 23:41:47 2015 +0200
2.2 +++ b/imip_store.py Fri Sep 25 15:06:06 2015 +0200
2.3 @@ -769,22 +769,15 @@
2.4 def get_counters(self, user, uid, recurrenceid=None):
2.5
2.6 """
2.7 - For the given 'user', return a mapping of counter-proposals from other
2.8 - users to nodes representing those proposals for the given 'uid' and
2.9 - optional 'recurrenceid'.
2.10 + For the given 'user', return a list of users from whom counter-proposals
2.11 + have been received for the given 'uid' and optional 'recurrenceid'.
2.12 """
2.13
2.14 filename = self.get_event_filename(user, uid, recurrenceid, "counters")
2.15 if not filename:
2.16 return False
2.17
2.18 - counters = {}
2.19 -
2.20 - for other in listdir(filename):
2.21 - counter_filename = self.get_event_filename(user, uid, recurrenceid, "counters", other)
2.22 - counters[other] = self._get_object(user, counter_filename)
2.23 -
2.24 - return counters
2.25 + return [name for name in listdir(filename) if isfile(join(filename, name))]
2.26
2.27 def get_counter(self, user, other, uid, recurrenceid=None):
2.28
3.1 --- a/imiptools/client.py Thu Sep 24 23:41:47 2015 +0200
3.2 +++ b/imiptools/client.py Fri Sep 25 15:06:06 2015 +0200
3.3 @@ -267,16 +267,16 @@
3.4
3.5 # Store operations.
3.6
3.7 - def get_stored_object(self, uid, recurrenceid, section=None):
3.8 + def get_stored_object(self, uid, recurrenceid, section=None, username=None):
3.9
3.10 """
3.11 Return the stored object for the current user, with the given 'uid' and
3.12 - 'recurrenceid' from the given 'section' (if specified), or from the
3.13 - standard object collection otherwise.
3.14 + 'recurrenceid' from the given 'section' and for the given 'username' (if
3.15 + specified), or from the standard object collection otherwise.
3.16 """
3.17
3.18 if section == "counters":
3.19 - fragment = self.store.get_counter(self.user, uid, recurrenceid)
3.20 + fragment = self.store.get_counter(self.user, username, uid, recurrenceid)
3.21 else:
3.22 fragment = self.store.get_event(self.user, uid, recurrenceid)
3.23 return fragment and Object(fragment)
4.1 --- a/imipweb/event.py Thu Sep 24 23:41:47 2015 +0200
4.2 +++ b/imipweb/event.py Fri Sep 25 15:06:06 2015 +0200
4.3 @@ -287,6 +287,7 @@
4.4 page.table.close()
4.5
4.6 self.show_recurrences(errors)
4.7 + self.show_counters()
4.8 self.show_conflicting_events()
4.9 self.show_request_controls()
4.10
4.11 @@ -477,6 +478,57 @@
4.12
4.13 page.div.close()
4.14
4.15 + def show_counters(self):
4.16 +
4.17 + "Show any counter-proposals for the current object."
4.18 +
4.19 + page = self.page
4.20 + attendees = self._get_counters(self.uid, self.recurrenceid)
4.21 + tzid = self.get_tzid()
4.22 +
4.23 + if not attendees:
4.24 + return
4.25 +
4.26 + page.p("The following counter-proposals have been received for this event:")
4.27 +
4.28 + page.table(cellspacing=5, cellpadding=5, class_="counters")
4.29 + page.thead()
4.30 + page.tr()
4.31 + page.th("Attendee", rowspan=2)
4.32 + page.th("Periods", colspan=2)
4.33 + page.tr.close()
4.34 + page.tr()
4.35 + page.th("Start")
4.36 + page.th("End")
4.37 + page.tr.close()
4.38 + page.thead.close()
4.39 + page.tbody()
4.40 +
4.41 + for attendee in attendees:
4.42 + obj = self.get_stored_object(self.uid, self.recurrenceid, "counters", attendee)
4.43 + periods = self.get_periods(obj)
4.44 +
4.45 + page.tr(rowspan=len(periods))
4.46 + page.td(attendee)
4.47 +
4.48 + first = True
4.49 + for p in periods:
4.50 + if not first:
4.51 + page.tr()
4.52 + else:
4.53 + first = False
4.54 +
4.55 + start = self.format_datetime(to_timezone(p.get_start(), tzid), "long")
4.56 + end = self.format_datetime(to_timezone(p.get_end(), tzid), "long")
4.57 +
4.58 + page.td(start)
4.59 + page.td(end)
4.60 +
4.61 + page.tr.close()
4.62 +
4.63 + page.tbody.close()
4.64 + page.table.close()
4.65 +
4.66 def show_conflicting_events(self):
4.67
4.68 "Show conflicting events for the current object."
5.1 --- a/imipweb/resource.py Thu Sep 24 23:41:47 2015 +0200
5.2 +++ b/imipweb/resource.py Fri Sep 25 15:06:06 2015 +0200
5.3 @@ -146,6 +146,9 @@
5.4 def _have_request(self, uid, recurrenceid=None, type=None, strict=False):
5.5 return self.store.have_request(self._get_requests(), uid, recurrenceid, type, strict)
5.6
5.7 + def _get_counters(self, uid, recurrenceid=None):
5.8 + return self.store.get_counters(self.user, uid, recurrenceid)
5.9 +
5.10 def _get_request_summary(self):
5.11
5.12 "Return a list of periods comprising the request summary."