mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-13 07:47:12 +00:00
Load alarm from UIxComponentEditor
The alarm attributes are now loaded from UIxComponentEditor and not iCalEntityObject so we can determine if the component's owner is part of the alarm's attendees.
This commit is contained in:
1 parent
d89f02ff53
commit
8402152a59
4 files changed
+56
-36
No files matched your search
@@ -545,8 +545,8 @@
|
||||
* @apiExample {curl} Example usage:
|
||||
* curl -i http://localhost/SOGo/so/sogo1/Calendar/personal/71B6-54904400-1-7C308500.ics/view
|
||||
*
|
||||
* @apiParam {Number} [resetAlarm] Mark alarm as triggered if set to 1
|
||||
* @apiParam {Number} [snoozeAlarm] Snooze the alarm for this number of minutes
|
||||
* @apiParam {Number} [resetAlarm] Mark alarm as triggered if set to 1
|
||||
* @apiParam {Number} [snoozeAlarm] Snooze the alarm for this number of minutes
|
||||
*
|
||||
* @apiSuccess (Success 200) {String} id Event ID
|
||||
* @apiSuccess (Success 200) {String} pid Calendar ID (event's folder)
|
||||
@@ -682,6 +682,7 @@
|
||||
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
|
||||
[dateFormatter formattedDate: eventStartDate], @"localizedStartDate",
|
||||
[dateFormatter formattedDate: eventEndDate], @"localizedEndDate",
|
||||
[self loadAlarm], @"alarm",
|
||||
nil];
|
||||
|
||||
if (!isAllDay)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
- (BOOL) isReadOnly;
|
||||
- (void) setAttributes: (NSDictionary *) attributes;
|
||||
|
||||
- (NSDictionary *) loadAlarm;
|
||||
+ (NSArray *) reminderValues;
|
||||
|
||||
@end
|
||||
|
||||
@@ -545,6 +545,56 @@ static NSArray *reminderValues = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSDictionary *) loadAlarm
|
||||
{
|
||||
NSArray *attendees;
|
||||
NSMutableDictionary *alarmData;
|
||||
NSString *ownerId, *email;
|
||||
iCalAlarm *anAlarm;
|
||||
iCalPerson *aAttendee;
|
||||
iCalTrigger *trigger;
|
||||
SOGoUser *owner;
|
||||
BOOL emailOrganizer, emailAttendees;
|
||||
int count, max;
|
||||
|
||||
alarmData = nil;
|
||||
if ([component hasAlarms])
|
||||
{
|
||||
anAlarm = [component firstSupportedAlarm];
|
||||
trigger = [anAlarm trigger];
|
||||
if (![[trigger valueType] length] || [[trigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame)
|
||||
{
|
||||
alarmData = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[[anAlarm action] lowercaseString], @"action",
|
||||
nil];
|
||||
[alarmData addEntriesFromDictionary: [trigger asDictionary]];
|
||||
|
||||
emailOrganizer = NO;
|
||||
emailAttendees = NO;
|
||||
attendees = [anAlarm attendees];
|
||||
ownerId = [[self clientObject] ownerInContext: nil];
|
||||
owner = [SOGoUser userWithLogin: ownerId];
|
||||
email = [[owner defaultIdentity] objectForKey: @"email"];
|
||||
max = [attendees count];
|
||||
for (count = 0;
|
||||
!(emailOrganizer && emailAttendees)
|
||||
&& count < max;
|
||||
count++)
|
||||
{
|
||||
aAttendee = [attendees objectAtIndex: count];
|
||||
if ([[aAttendee rfc822Email] isEqualToString: email])
|
||||
emailOrganizer = YES;
|
||||
else
|
||||
emailAttendees = YES;
|
||||
}
|
||||
[alarmData setObject: [NSNumber numberWithBool: emailOrganizer] forKey: @"organizer"];
|
||||
[alarmData setObject: [NSNumber numberWithBool: emailAttendees] forKey: @"attendees"];
|
||||
}
|
||||
}
|
||||
|
||||
return alarmData;
|
||||
}
|
||||
|
||||
- (void) setAttributes: (NSDictionary *) data
|
||||
{
|
||||
NSCalendarDate *now;
|
||||
@@ -757,7 +807,7 @@ static NSArray *reminderValues = nil;
|
||||
// ? @"true"
|
||||
// : @"false");
|
||||
//}
|
||||
//
|
||||
|
||||
//- (BOOL) userHasRSVP
|
||||
//{
|
||||
// return ([self getEventRWType] == 1);
|
||||
|
||||
Reference in new issue
Block a user