1.1 --- a/imipweb/event.py Tue Apr 07 22:30:06 2015 +0200
1.2 +++ b/imipweb/event.py Tue Apr 07 23:16:35 2015 +0200
1.3 @@ -82,12 +82,11 @@
1.4
1.5 reply = args.has_key("reply")
1.6 discard = args.has_key("discard")
1.7 - invite = args.has_key("invite")
1.8 + create = args.has_key("create")
1.9 cancel = args.has_key("cancel")
1.10 - save = args.has_key("save")
1.11 ignore = args.has_key("ignore")
1.12
1.13 - have_action = reply or discard or invite or cancel or save or ignore
1.14 + have_action = reply or discard or create or cancel or ignore
1.15
1.16 if not have_action:
1.17 return ["action"]
1.18 @@ -98,11 +97,11 @@
1.19 self.redirect(self.env.get_path())
1.20 return None
1.21
1.22 - update = False
1.23 -
1.24 # Update the object.
1.25
1.26 - if reply or invite or cancel or save:
1.27 + single_user = False
1.28 +
1.29 + if reply or create or cancel:
1.30
1.31 # Update principal event details if organiser.
1.32
1.33 @@ -133,6 +132,7 @@
1.34 attendees = self.get_attendees()
1.35 removed = [attendees[int(i)] for i in args.get("remove", [])]
1.36 to_cancel = update_attendees(obj, attendees, removed)
1.37 + single_user = not attendees or attendees == [self.user]
1.38
1.39 # Update attendee participation.
1.40
1.41 @@ -141,6 +141,9 @@
1.42
1.43 # Process any action.
1.44
1.45 + invite = create and not single_user
1.46 + save = create and single_user
1.47 +
1.48 handled = True
1.49
1.50 if reply or invite or cancel:
1.51 @@ -149,13 +152,13 @@
1.52
1.53 # Process the object and remove it from the list of requests.
1.54
1.55 - if reply and handler.process_received_request(update):
1.56 + if reply and handler.process_received_request():
1.57 self.remove_request(uid, recurrenceid)
1.58
1.59 elif self.is_organiser(obj) and (invite or cancel):
1.60
1.61 if handler.process_created_request(
1.62 - invite and "REQUEST" or "CANCEL", update, to_cancel):
1.63 + invite and "REQUEST" or "CANCEL", to_cancel):
1.64
1.65 self.remove_request(uid, recurrenceid)
1.66
1.67 @@ -440,10 +443,8 @@
1.68
1.69 attendees = self.get_current_attendees(obj)
1.70 is_attendee = self.user in attendees
1.71 -
1.72 is_request = (obj.get_value("UID"), obj.get_value("RECURRENCE-ID")) in self._get_requests()
1.73 -
1.74 - have_other_attendees = len(attendees) > (is_attendee and 1 or 0)
1.75 + sequence = obj.get_value("SEQUENCE")
1.76
1.77 # Show appropriate options depending on the role of the user.
1.78
1.79 @@ -461,25 +462,18 @@
1.80 if self.is_organiser(obj):
1.81 page.p("As organiser, you can perform the following:")
1.82
1.83 - if have_other_attendees:
1.84 - page.p()
1.85 - page.input(name="invite", type="submit", value="Invite/notify attendees")
1.86 - page.add(" ")
1.87 - if is_request:
1.88 - page.input(name="discard", type="submit", value="Discard event")
1.89 - else:
1.90 - page.input(name="cancel", type="submit", value="Cancel event")
1.91 - page.add(" ")
1.92 - page.input(name="ignore", type="submit", value="Do nothing for now")
1.93 - page.p.close()
1.94 + page.p()
1.95 + page.input(name="create", type="submit", value=(sequence is None and "Create event" or "Update event"))
1.96 + page.add(" ")
1.97 +
1.98 + if sequence is not None and not is_request:
1.99 + page.input(name="cancel", type="submit", value="Cancel event")
1.100 else:
1.101 - page.p()
1.102 - page.input(name="save", type="submit", value="Save event")
1.103 - page.add(" ")
1.104 page.input(name="discard", type="submit", value="Discard event")
1.105 - page.add(" ")
1.106 - page.input(name="ignore", type="submit", value="Do nothing for now")
1.107 - page.p.close()
1.108 +
1.109 + page.add(" ")
1.110 + page.input(name="ignore", type="submit", value="Do nothing for now")
1.111 + page.p.close()
1.112
1.113 def show_object_on_page(self, uid, obj, errors=None):
1.114