pull/56/head
Ludovic Marcotte 2014-09-09 15:15:56 -04:00
parent bbe1e09ab9
commit e542ff5646
2 changed files with 31 additions and 4 deletions

1
NEWS
View File

@ -26,6 +26,7 @@ Bug fixes
- fixed In "Multicolumn Day View" mouse position is not honored when creating an event (#2864)
- fixed handling of messages labels (#2902)
- fixed Apache > 2.3 configuration
- fixed freebusy retrieval during timezone changes (#1240)
2.2.7 (2014-07-30)
------------------

View File

@ -45,6 +45,8 @@
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGoUI/UIxComponent.h>
#import <SBJson/NSObject+SBJSON.h>
#define intervalSeconds 900 /* 15 minutes */
@interface SOGoUserHomePage : UIxComponent
@ -89,7 +91,7 @@
NSDictionary *record;
SOGoUser *user;
int recordCount, recordMax, count, startInterval, endInterval, i, type, maxBookings, isResource;
int recordCount, recordMax, count, startInterval, endInterval, i, type, maxBookings, isResource, delta;
recordMax = [records count];
user = [SOGoUser userWithLogin: [[self clientObject] ownerInContext: context] roles: nil];
@ -146,12 +148,18 @@
startInterval = ([currentDate timeIntervalSinceDate: startDate]
/ intervalSeconds);
delta = [[currentDate timeZoneDetail] timeZoneSecondsFromGMT] - [[startDate timeZoneDetail] timeZoneSecondsFromGMT];
startInterval += (delta/60/15);
currentDate = [record objectForKey: @"endDate"];
if ([currentDate earlierDate: endDate] == endDate)
endInterval = itemCount - 1;
else
endInterval = ([currentDate timeIntervalSinceDate: startDate]
/ intervalSeconds);
delta = [[currentDate timeZoneDetail] timeZoneSecondsFromGMT] - [[startDate timeZoneDetail] timeZoneSecondsFromGMT];
endInterval += (delta/60/15);
// Update bit string representation
// If the user is a resource, keep the sum of overlapping events
@ -181,11 +189,31 @@
forFreeBusy: (SOGoFreeBusyObject *) fb
andContact: (NSString *) uid
{
NSCalendarDate *start, *end;
NSMutableArray *freeBusy;
unsigned int *freeBusyItems;
NSTimeInterval interval;
unsigned int count, intervals;
// We "copy" the start/end date because -fetchFreeBusyInfosFrom will mess
// with the timezone and we don't want that to properly calculate the delta
// DO NOT USE -copy HERE - it'll simply return [self retain].
start = [NSCalendarDate dateWithYear: [startDate yearOfCommonEra]
month: [startDate monthOfYear]
day: [startDate dayOfMonth]
hour: [startDate hourOfDay]
minute: [startDate minuteOfHour]
second: [startDate secondOfMinute]
timeZone: [startDate timeZone]];
end = [NSCalendarDate dateWithYear: [endDate yearOfCommonEra]
month: [endDate monthOfYear]
day: [endDate dayOfMonth]
hour: [endDate hourOfDay]
minute: [endDate minuteOfHour]
second: [endDate secondOfMinute]
timeZone: [endDate timeZone]];
interval = [endDate timeIntervalSinceDate: startDate] + 60;
intervals = interval / intervalSeconds; /* slices of 15 minutes */
@ -193,7 +221,7 @@
freeBusyItems = NSZoneCalloc (NULL, intervals, sizeof (int));
[self _fillFreeBusyItems: freeBusyItems
count: intervals
withRecords: [fb fetchFreeBusyInfosFrom: startDate to: endDate forContact: uid]
withRecords: [fb fetchFreeBusyInfosFrom: start to: end forContact: uid]
fromStartDate: startDate
toEndDate: endDate];
@ -435,8 +463,6 @@
- (WOResponse *) _foldersResponseForResults: (NSArray *) folders
{
WOResponse *response;
NSEnumerator *foldersEnum;
NSDictionary *currentFolder;
response = [context response];
[response setStatus: 200];