feat(calendar(web)): allow to change the classification of an event

pull/289/head
Francis Lachapelle 2020-11-04 16:15:13 -05:00
parent 3796009eca
commit 4a83733039
6 changed files with 61 additions and 8 deletions

View File

@ -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 <WOActionResults>) 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]])

View File

@ -7,7 +7,7 @@
<md-dialog flex="60" flex-sm="80" flex-xs="100">
<form name="eventForm" class="md-inline-form" ng-submit="editor.save(eventForm)">
<md-toolbar>
<div class="md-toolbar-tools">
<div class="md-toolbar-tools sg-no-transition">
<md-icon class="material-icons sg-icon-toolbar-bg">event</md-icon>
<!-- summary -->
<md-icon ng-if="editor.component.classification == 'confidential'">visibility_off</md-icon>

View File

@ -8,10 +8,10 @@
<md-toolbar>
<div class="md-toolbar-tools">
<md-icon class="material-icons sg-icon-toolbar-bg">event</md-icon>
<div class="sg-md-title md-flex">
<div class="sg-md-title md-flex sg-no-transition">
<!-- classification -->
<md-icon ng-if="::editor.component.classification == 'confidential'">visibility_off</md-icon>
<md-icon ng-if="::editor.component.classification == 'private'">vpn_key</md-icon>
<md-icon ng-if="editor.component.classification == 'confidential'">visibility_off</md-icon>
<md-icon ng-if="editor.component.classification == 'private'">vpn_key</md-icon>
<!-- priority -->
<md-icon ng-if="::editor.highPriority()">priority_high</md-icon>
<!-- summary -->
@ -110,6 +110,22 @@
<div ng-bind="::editor.component.calendar"><!-- calendar --></div>
</div>
</md-list-item>
<!-- classification -->
<md-list-item>
<md-icon>visibility</md-icon>
<md-radio-group layout="row"
ng-model="editor.component.classification">
<md-radio-button class="sg-padded--right" value="public">
<var:string label:value="label_Public"/>
</md-radio-button>
<md-radio-button class="sg-padded--right" value="confidential">
<var:string label:value="label_Confidential"/>
</md-radio-button>
<md-radio-button value="private">
<var:string label:value="label_Private"/>
</md-radio-button>
</md-radio-group>
</md-list-item>
<!-- start/end dates -->
<md-list-item ng-class="{ 'md-2-line': editor.component.isAllDay, 'md-3-line': !editor.component.isAllDay }">
<md-icon>access_time</md-icon>

View File

@ -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' })

View File

@ -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);

View File

@ -54,4 +54,12 @@ html * {
&:last-child {
margin-bottom: 0;
}
}
}
// 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;
}
}