From 4a8373303922bb2697d5aa91b89c34b77c3af6a2 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 4 Nov 2020 16:15:13 -0500 Subject: [PATCH] feat(calendar(web)): allow to change the classification of an event --- UI/Scheduler/UIxAppointmentEditor.m | 29 ++++++++++++++++++- .../UIxAppointmentEditorTemplate.wox | 2 +- .../UIxAppointmentViewTemplate.wox | 22 ++++++++++++-- .../js/Scheduler/Component.service.js | 3 +- .../js/Scheduler/ComponentController.js | 3 +- .../scss/core/structure.scss | 10 ++++++- 6 files changed, 61 insertions(+), 8 deletions(-) diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 911445a55..45718b9b4 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -285,27 +285,35 @@ * @apiParam {String} alarm.relation Either START or END * @apiParam {Boolean} [alarm.attendees] Alert attendees by email if 1 and action is email * @apiParam {Boolean} [alarm.organizer] Alert organizer by email if 1 and action is email + * @apiParam {String} [classification] Either public, confidential or private */ - (id ) rsvpAction { + static NSArray *validClassifications = nil; iCalPerson *delegatedAttendee; NSDictionary *params, *jsonResponse; WOResponse *response; WORequest *request; iCalAlarm *anAlarm; + iCalEvent *event; NSException *ex; NSString *status; - id alarm; + id alarm, classification; int replyList; + if (!validClassifications) + validClassifications = [[NSArray alloc] initWithObjects: @"PUBLIC", @"CONFIDENTIAL", @"PRIVATE", nil]; + request = [context request]; params = [[request contentAsString] objectFromJSONString]; + event = [self event]; delegatedAttendee = nil; anAlarm = nil; status = nil; + // Set invitation reply replyList = [[params objectForKey: @"reply"] intValue]; switch (replyList) @@ -368,6 +376,25 @@ break; } + // Update classification + classification = [params objectForKey: @"classification"]; + if (classification && + [classification isKindOfClass: [NSString class]] && + [validClassifications containsObject: [classification uppercaseString]] && + ![[classification uppercaseString] isEqualToString: [event accessClass]]) + { + [event setAccessClass: [classification uppercaseString]]; + ex = [[self clientObject] saveComponent: event force: NO]; + if (ex) + { + jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys: + [ex reason], @"message", + nil]; + return [self responseWithStatus: [ex httpStatus] + andString: [jsonResponse jsonRepresentation]]; + } + } + // Set an alarm for the user alarm = [params objectForKey: @"alarm"]; if ([alarm isKindOfClass: [NSDictionary class]]) diff --git a/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox index bb822978d..e271b4a66 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox @@ -7,7 +7,7 @@
-
+
event visibility_off diff --git a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox index f5bb9556c..edb377885 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox @@ -8,10 +8,10 @@
event -
+
- visibility_off - vpn_key + visibility_off + vpn_key priority_high @@ -110,6 +110,22 @@
+ + + visibility + + + + + + + + + + + + access_time diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js index 608ab454c..5177058c5 100644 --- a/UI/WebServerResources/js/Scheduler/Component.service.js +++ b/UI/WebServerResources/js/Scheduler/Component.service.js @@ -941,7 +941,8 @@ data = { reply: this.reply, delegatedTo: this.delegatedTo, - alarm: this.$hasAlarm? this.alarm : {} + alarm: this.$hasAlarm? this.alarm : {}, + classification: this.classification }; return Component.$$resource.save(path, data, { action: 'rsvpAppointment' }) diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js index 125427c29..cb8c68951 100644 --- a/UI/WebServerResources/js/Scheduler/ComponentController.js +++ b/UI/WebServerResources/js/Scheduler/ComponentController.js @@ -128,10 +128,11 @@ // Retrieve master event component = Calendar.$get(this.component.pid).$getComponent(this.component.id); component.$futureComponentData.then(function() { - // Propagate the participant status and alarm to the master event + // Propagate the participant status, classification and alarm to the master event component.reply = vm.component.reply; component.delegatedTo = vm.component.delegatedTo; component.$hasAlarm = vm.component.$hasAlarm; + component.classification = vm.component.classification; component.alarm = vm.component.alarm; // Send reply to the server vm.reply(component); diff --git a/UI/WebServerResources/scss/core/structure.scss b/UI/WebServerResources/scss/core/structure.scss index b5d4d6f81..22af7db1a 100644 --- a/UI/WebServerResources/scss/core/structure.scss +++ b/UI/WebServerResources/scss/core/structure.scss @@ -54,4 +54,12 @@ html * { &:last-child { margin-bottom: 0; } -} \ No newline at end of file +} + +// Remove "leave" transition +// Convenient with a ng-switch statement or when using multiple ng-if statements that are mutually exclusive +.sg-no-transition { + .ng-leave { + display: none; + } +}