JSON: fix handling of dates of all-day events
parent
177c933af4
commit
f47a22068f
|
@ -328,24 +328,30 @@
|
|||
*/
|
||||
- (NSDictionary *) attributesInContext: (WOContext *) context
|
||||
{
|
||||
BOOL isAllDay;
|
||||
NSCalendarDate *eventStartDate, *eventEndDate;
|
||||
NSMutableDictionary *data;
|
||||
NSTimeZone *timeZone;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
isAllDay = [self isAllDay];
|
||||
ud = [[context activeUser] userDefaults];
|
||||
timeZone = [ud timeZone];
|
||||
eventStartDate = [self startDate];
|
||||
eventEndDate = [self endDate];
|
||||
|
||||
if (!isAllDay)
|
||||
{
|
||||
[eventStartDate setTimeZone: timeZone];
|
||||
[eventEndDate setTimeZone: timeZone];
|
||||
}
|
||||
|
||||
data = [NSMutableDictionary dictionaryWithDictionary: [super attributesInContext: context]];
|
||||
|
||||
[data setObject: [eventStartDate iso8601DateString] forKey: @"startDate"];
|
||||
[data setObject: [eventEndDate iso8601DateString] forKey: @"endDate"];
|
||||
|
||||
[data setObject: [NSNumber numberWithBool: [self isAllDay]] forKey: @"isAllDay"];
|
||||
[data setObject: [NSNumber numberWithBool: isAllDay] forKey: @"isAllDay"];
|
||||
[data setObject: [NSNumber numberWithBool: ![self isOpaque]] forKey: @"isTransparent"];
|
||||
|
||||
return data;
|
||||
|
|
|
@ -542,12 +542,12 @@
|
|||
* @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
|
||||
* @apiSuccess (Success 200) {String} startDate Start date (YYYY-MM-DD)
|
||||
* @apiSuccess (Success 200) {String} startDate Start date (ISO8601)
|
||||
* @apiSuccess (Success 200) {String} localizedStartDate Formatted start date
|
||||
* @apiSuccess (Success 200) {String} startTime Formatted start time
|
||||
* @apiSuccess (Success 200) {String} endDate End date (YYYY-MM-DD)
|
||||
* @apiSuccess (Success 200) {String} [localizedStartTime] Formatted start time
|
||||
* @apiSuccess (Success 200) {String} endDate End date (ISO8601)
|
||||
* @apiSuccess (Success 200) {String} localizedEndDate Formatted end date
|
||||
* @apiSuccess (Success 200) {String} endTime Formatted end time
|
||||
* @apiSuccess (Success 200) {String} [localizedEndTime] Formatted end time
|
||||
*
|
||||
* From [iCalEvent+SOGo attributes]
|
||||
*
|
||||
|
@ -606,6 +606,7 @@
|
|||
*/
|
||||
- (id <WOActionResults>) viewAction
|
||||
{
|
||||
BOOL isAllDay;
|
||||
NSMutableDictionary *data;
|
||||
NSCalendarDate *eventStartDate, *eventEndDate;
|
||||
NSTimeZone *timeZone;
|
||||
|
@ -618,14 +619,18 @@
|
|||
unsigned int snoozeAlarm;
|
||||
|
||||
event = [self event];
|
||||
co = [self clientObject];
|
||||
|
||||
isAllDay = [event isAllDay];
|
||||
ud = [[context activeUser] userDefaults];
|
||||
timeZone = [ud timeZone];
|
||||
eventStartDate = [event startDate];
|
||||
eventEndDate = [event endDate];
|
||||
if (!isAllDay)
|
||||
{
|
||||
[eventStartDate setTimeZone: timeZone];
|
||||
[eventEndDate setTimeZone: timeZone];
|
||||
co = [self clientObject];
|
||||
}
|
||||
|
||||
// resetAlarm=yes is set only when we are about to show the alarm popup in the Web
|
||||
// interface of SOGo. See generic.js for details. snoozeAlarm=X is called when the
|
||||
|
@ -665,11 +670,15 @@
|
|||
[componentCalendar nameInContainer], @"pid",
|
||||
[componentCalendar displayName], @"calendar",
|
||||
[dateFormatter formattedDate: eventStartDate], @"localizedStartDate",
|
||||
[dateFormatter formattedTime: eventStartDate], @"startTime",
|
||||
[dateFormatter formattedDate: eventEndDate], @"localizedEndDate",
|
||||
[dateFormatter formattedTime: eventEndDate], @"endTime",
|
||||
nil];
|
||||
|
||||
if (!isAllDay)
|
||||
{
|
||||
[data setObject: [dateFormatter formattedTime: eventStartDate] forKey: @"localizedStartTime"];
|
||||
[data setObject: [dateFormatter formattedTime: eventEndDate] forKey: @"localizedEndTime"];
|
||||
}
|
||||
|
||||
// Add attributes from iCalEvent+SOGo, iCalEntityObject+SOGo and iCalRepeatableEntityObject+SOGo
|
||||
[data addEntriesFromDictionary: [event attributesInContext: context]];
|
||||
|
||||
|
|
Loading…
Reference in New Issue