1.1 --- a/imip_manager.py Wed Feb 04 15:16:02 2015 +0100
1.2 +++ b/imip_manager.py Wed Feb 04 15:30:03 2015 +0100
1.3 @@ -192,11 +192,12 @@
1.4
1.5 return False
1.6
1.7 - def process_created_request(self, update=False):
1.8 + def process_created_request(self, method, update=False):
1.9
1.10 """
1.11 Process the current request for the given 'user', sending a created
1.12 - request to attendees. Return whether any action was taken.
1.13 + request of the given 'method' to attendees. Return whether any action
1.14 + was taken.
1.15
1.16 If 'update' is given, the sequence number will be incremented in order
1.17 to override any previous message.
1.18 @@ -211,8 +212,7 @@
1.19 self.obj["SEQUENCE"] = [(str(int(sequence) + 1), {})]
1.20 self.update_dtstamp()
1.21
1.22 - self.send_message("REQUEST", get_address(self.organiser), for_organiser=True)
1.23 -
1.24 + self.send_message(method, get_address(self.organiser), for_organiser=True)
1.25 return True
1.26
1.27 class Manager:
1.28 @@ -478,21 +478,23 @@
1.29
1.30 accept = args.has_key("accept")
1.31 decline = args.has_key("decline")
1.32 + discard = args.has_key("discard")
1.33 invite = args.has_key("invite")
1.34 + cancel = args.has_key("cancel")
1.35 update = not queued and args.has_key("update")
1.36
1.37 - if accept or decline or invite:
1.38 + if accept or decline or invite or cancel:
1.39
1.40 handler = ManagerHandler(obj, self.user, self.messenger)
1.41
1.42 # Process the object and remove it from the list of requests.
1.43
1.44 if (accept or decline) and handler.process_received_request(accept, update) or \
1.45 - invite and handler.process_created_request(update):
1.46 + (invite or cancel) and handler.process_created_request(invite and "REQUEST" or "CANCEL", update):
1.47
1.48 self.remove_request(uid)
1.49
1.50 - elif args.has_key("discard"):
1.51 + elif discard:
1.52
1.53 # Remove the request and the object.
1.54
1.55 @@ -536,33 +538,39 @@
1.56 else:
1.57 page.p("This request has not yet been dealt with.")
1.58
1.59 - if needs_update:
1.60 - page.p("This request can be updated as follows:")
1.61 - else:
1.62 - page.p("An action is required for this request:")
1.63 -
1.64 - page.p()
1.65 -
1.66 # Show appropriate options depending on the role of the user.
1.67
1.68 - if is_organiser:
1.69 - page.input(name="invite", type="submit", value="Invite")
1.70 + if is_attendee:
1.71 + if needs_update:
1.72 + page.p("This request can be updated as follows:")
1.73 + else:
1.74 + page.p("An action is required for this request:")
1.75
1.76 - if is_attendee:
1.77 + page.p()
1.78 page.input(name="accept", type="submit", value="Accept")
1.79 page.add(" ")
1.80 page.input(name="decline", type="submit", value="Decline")
1.81 + page.add(" ")
1.82 + page.input(name="discard", type="submit", value="Discard")
1.83 + page.p.close()
1.84
1.85 - page.add(" ")
1.86 - page.input(name="discard", type="submit", value="Discard")
1.87 + if is_organiser:
1.88 + if needs_update:
1.89 + page.p("As organiser, you can perform the following:")
1.90 + else:
1.91 + page.p("As organiser, you will need to perform an action:")
1.92 +
1.93 + page.p()
1.94 + page.input(name="invite", type="submit", value="Invite")
1.95 + page.add(" ")
1.96 + page.input(name="cancel", type="submit", value="Cancel")
1.97 + page.p.close()
1.98
1.99 # Updated objects need to have details updated upon sending.
1.100
1.101 if needs_update:
1.102 page.input(name="update", type="hidden", value="true")
1.103
1.104 - page.p.close()
1.105 -
1.106 object_labels = {
1.107 "SUMMARY" : "Summary",
1.108 "DTSTART" : "Start",