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