Handle attach URLs in appointment editor

This commit is contained in:
Francis Lachapelle
2015-07-01 14:34:35 -04:00
parent ba5f6410ed
commit 35ff82710a
10 changed files with 156 additions and 19 deletions
@@ -258,7 +258,7 @@
"All day Event" = "All day Event";
"check for conflicts" = "Check for conflicts";
"Browse URL" = "Browse URL";
"URL" = "URL";
"newAttendee" = "Add attendee";
+13 -6
View File
@@ -548,6 +548,8 @@
* @apiParam {Number} [resetAlarm] Mark alarm as triggered if set to 1
* @apiParam {Number} [snoozeAlarm] Snooze the alarm for this number of minutes
*
* @apiSuccess {_} . _From [UIxAppointmentEditor viewAction]_
*
* @apiSuccess (Success 200) {String} id Event ID
* @apiSuccess (Success 200) {String} pid Calendar ID (event's folder)
* @apiSuccess (Success 200) {String} calendar Human readable name of calendar
@@ -558,8 +560,10 @@
* @apiSuccess (Success 200) {String} localizedEndDate Formatted end date
* @apiSuccess (Success 200) {String} [localizedEndTime] Formatted end time
* @apiSuccess (Success 200) {Number} isReadOnly 1 if event is read-only
* @apiSuccess (Success 200) {Object[]} [attachUrls] Attached URLs
* @apiSuccess (Success 200) {String} attachUrls.value URL
*
* @apiSuccess {_} . _From [UIxComponentEditor loadAlarm]_
* @apiSuccess {_} .. _From [UIxComponentEditor alarm]_
*
* @apiSuccess (Success 200) {Object[]} [alarm] Alarm definition
* @apiSuccess (Success 200) {String} alarm.action Either display or email
@@ -572,12 +576,12 @@
* @apiSuccess (Success 200) {String} alarm.attendees.email Attendee's email address
* @apiSuccess (Success 200) {String} [alarm.attendees.uid] System user ID
*
* @apiSuccess {_} .. _From [iCalEvent+SOGo attributes]_
* @apiSuccess {_} ... _From [iCalEvent+SOGo attributes]_
*
* @apiSuccess (Success 200) {Number} isAllDay 1 if event is all-day
* @apiSuccess (Success 200) {Number} isTransparent 1 if the event is not opaque
*
* @apiSuccess {_} ... _From [iCalEntityObject+SOGo attributes]_
* @apiSuccess {_} .... _From [iCalEntityObject+SOGo attributes]_
*
* @apiSuccess (Success 200) {Number} sendAppointmentNotifications 1 if notifications must be sent
* @apiSuccess (Success 200) {String} component "vevent"
@@ -585,7 +589,6 @@
* @apiSuccess (Success 200) {String} [location] Location
* @apiSuccess (Success 200) {String} [comment] Comment
* @apiSuccess (Success 200) {String} [status] Status (tentative, confirmed, or cancelled)
* @apiSuccess (Success 200) {String} [attachUrl] Attached URL
* @apiSuccess (Success 200) {String} [createdBy] Value of custom header X-SOGo-Component-Created-By or organizer's "SENT-BY"
* @apiSuccess (Success 200) {Number} priority Priority (0-9)
* @apiSuccess (Success 200) {NSString} [classification] Either public, confidential or private
@@ -604,7 +607,7 @@
* @apiSuccess (Success 200) {String} [attendees.delegatedTo] User that the original request was delegated to
* @apiSuccess (Success 200) {String} [attendees.delegatedFrom] User the request was delegated from
*
* @apiSuccess {_} .... _From [iCalRepeatableEntityObject+SOGo attributes]_
* @apiSuccess {_} ..... _From [iCalRepeatableEntityObject+SOGo attributes]_
*
* @apiSuccess (Success 200) {Object} [repeat] Recurrence rule definition
* @apiSuccess (Success 200) {String} repeat.frequency Either daily, (every weekday), weekly, (bi-weekly), monthly, or yearly
@@ -620,6 +623,7 @@
- (id <WOActionResults>) viewAction
{
BOOL isAllDay;
NSArray *attachUrls;
NSMutableDictionary *data;
NSCalendarDate *eventStartDate, *eventEndDate;
NSTimeZone *timeZone;
@@ -685,9 +689,12 @@
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
[dateFormatter formattedDate: eventStartDate], @"localizedStartDate",
[dateFormatter formattedDate: eventEndDate], @"localizedEndDate",
[self loadAlarm], @"alarm",
[self alarm], @"alarm",
nil];
attachUrls = [self attachUrls];
if ([attachUrls count]) [data setObject: attachUrls forKey: @"attachUrls"];
if (!isAllDay)
{
[data setObject: [dateFormatter formattedTime: eventStartDate] forKey: @"localizedStartTime"];
+2 -1
View File
@@ -36,7 +36,8 @@
- (BOOL) isReadOnly;
- (void) setAttributes: (NSDictionary *) attributes;
- (NSDictionary *) loadAlarm;
- (NSDictionary *) alarm;
- (NSArray *) attachUrls;
+ (NSArray *) reminderValues;
@end
+51 -2
View File
@@ -545,7 +545,7 @@ static NSArray *reminderValues = nil;
}
}
- (NSDictionary *) loadAlarm
- (NSDictionary *) alarm
{
NSArray *attendees;
NSMutableDictionary *alarmData;
@@ -595,13 +595,41 @@ static NSArray *reminderValues = nil;
return alarmData;
}
- (NSArray *) attachUrls
{
NSMutableArray *attachUrls;
NSArray *values;
NSString *attachUrl;
NSUInteger count, max;
values = [component attach];
max = [values count];
if (max > 0)
{
attachUrls = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
attachUrl = [values objectAtIndex: count];
if ([attachUrl length] > 0)
[attachUrls addObject: [NSDictionary dictionaryWithObject: attachUrl forKey: @"value"]];
}
}
else
attachUrls = nil;
return attachUrls;
}
- (void) setAttributes: (NSDictionary *) data
{
NSArray *values;
NSCalendarDate *now;
NSMutableArray *attachUrls;
NSMutableDictionary *dataWithOwner;
NSString *owner;
NSUInteger i;
SOGoAppointmentFolders *folders;
id destinationCalendar;
id destinationCalendar, o;
now = [NSCalendarDate calendarDate];
owner = [componentCalendar ownerInContext: context];
@@ -624,6 +652,27 @@ static NSArray *reminderValues = nil;
[self _handleOrganizer];
if ([[data objectForKey: @"attachUrls"] isKindOfClass: [NSArray class]])
{
values = [component childrenWithTag: @"attach"];
[component removeChildren: values];
values = [data objectForKey: @"attachUrls"];
attachUrls = [NSMutableArray arrayWithCapacity: [values count]];
for (i = 0; i < [values count]; i++)
{
o = [values objectAtIndex: i];
if ([o isKindOfClass: [NSDictionary class]])
{
[attachUrls addObject: [o objectForKey: @"value"]];
}
}
}
else
{
attachUrls = nil;
}
[component setAttach: attachUrls];
if ([[self clientObject] isNew])
{
[component setCreated: now];
+2 -2
View File
@@ -409,7 +409,7 @@
* @apiSuccess (Success 200) {String} completedDate Completed date (ISO8601)
* @apiSuccess (Success 200) {Number} percentComplete Percent completion
*
* @apiSuccess {_} .. _From [UIxComponentEdtiror loadAlarm]_
* @apiSuccess {_} .. _From [UIxComponentEdtiror alarm]_
*
* @apiSuccess (Success 200) {Object[]} [alarm] Alarm definition
* @apiSuccess (Success 200) {String} alarm.action Either display or email
@@ -530,7 +530,7 @@
[thisFolder nameInContainer], @"pid",
[thisFolder displayName], @"calendar",
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
[self loadAlarm], @"alarm",
[self alarm], @"alarm",
nil];
if (startDate)