Monotone-Parent: f3830c65328146810871090fdfd037458b8d87af
Monotone-Revision: 37f12ad4f4daf31d2b81f43a8d21b5c4a53f4a1d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-04-02T18:50:21 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
1a5a5fe13d
commit
95cdd86021
|
@ -1,3 +1,10 @@
|
||||||
|
2010-04-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* UI/Scheduler/UIxCalListingActions.m
|
||||||
|
(_fillFreeBusy:forUid:fromDate:): fixed a crash occuring when the
|
||||||
|
length of an event would happen after the period covered by the
|
||||||
|
freebusy.
|
||||||
|
|
||||||
2010-04-02 Francis Lachapelle <flachapelle@inverse.ca>
|
2010-04-02 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
* UI/WebServerResources/SchedulerUI.js (onClickableCellsDblClick):
|
* UI/WebServerResources/SchedulerUI.js (onClickableCellsDblClick):
|
||||||
|
|
|
@ -64,13 +64,14 @@ static NSArray *eventsFields = nil;
|
||||||
static NSArray *tasksFields = nil;
|
static NSArray *tasksFields = nil;
|
||||||
|
|
||||||
#define dayLength 86400
|
#define dayLength 86400
|
||||||
#define quarterLength 900
|
#define quarterLength 900 // number of seconds in 15 minutes
|
||||||
|
#define offsetHours (24 * 5) // number of hours in invitation window
|
||||||
#define intervalSeconds 900 // number of seconds in 15 minutes
|
#define offsetSeconds (offsetHours * 60 * 60) // number of seconds in
|
||||||
#define offsetHours 24 * 5 // number of hours in invitation window
|
// invitation window
|
||||||
#define offsetSeconds offsetHours * 60 * 60 // number of seconds in invitation window
|
/* 1 block = 15 minutes */
|
||||||
#define offsetBlocks offsetHours * 4 // number of 15-minute blocks in invitation window
|
#define offsetBlocks (offsetHours * 4) // number of 15-minute blocks in invitation window
|
||||||
#define maxBlocks offsetBlocks * 2 // maximum number of blocks to search for a free slot (10 days)
|
#define maxBlocks (offsetBlocks * 2) // maximum number of blocks to search
|
||||||
|
// for a free slot (10 days)
|
||||||
|
|
||||||
@implementation UIxCalListingActions
|
@implementation UIxCalListingActions
|
||||||
|
|
||||||
|
@ -1076,24 +1077,20 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
SOGoUser *user;
|
SOGoUser *user;
|
||||||
SOGoFreeBusyObject *fbObject;
|
SOGoFreeBusyObject *fbObject;
|
||||||
NSCalendarDate *end;
|
NSCalendarDate *end;
|
||||||
NSTimeInterval interval;
|
|
||||||
NSArray *records;
|
NSArray *records;
|
||||||
NSDictionary *record;
|
NSDictionary *record;
|
||||||
NSArray *emails, *partstates;
|
NSArray *emails, *partstates;
|
||||||
NSCalendarDate *currentDate;
|
NSCalendarDate *currentDate;
|
||||||
unsigned int intervals, recordCount, recordMax;
|
unsigned int recordCount, recordMax;
|
||||||
int count, startInterval, endInterval, i, type;
|
int count, startInterval, endInterval, i, type;
|
||||||
int itemCount = (offsetBlocks + maxBlocks) * 15 * 60;
|
int itemCount = (offsetBlocks + maxBlocks);
|
||||||
|
|
||||||
user = [SOGoUser userWithLogin: uid roles: nil];
|
user = [SOGoUser userWithLogin: uid];
|
||||||
fbObject = [[user homeFolderInContext: context]
|
fbObject
|
||||||
freeBusyObject: @"freebusy.ifb"
|
= [[user homeFolderInContext: context] freeBusyObject: @"freebusy.ifb"
|
||||||
inContext: context];
|
inContext: context];
|
||||||
|
|
||||||
end = [start addTimeInterval: itemCount];
|
end = [start addTimeInterval: (itemCount * quarterLength)];
|
||||||
|
|
||||||
interval = [end timeIntervalSinceDate: start];// + 60;
|
|
||||||
intervals = interval / intervalSeconds; /* slices of 15 minutes */
|
|
||||||
|
|
||||||
records = [fbObject fetchFreeBusyInfosFrom: start to: end];
|
records = [fbObject fetchFreeBusyInfosFrom: start to: end];
|
||||||
recordMax = [records count];
|
recordMax = [records count];
|
||||||
|
@ -1140,14 +1137,14 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
startInterval = 0;
|
startInterval = 0;
|
||||||
else
|
else
|
||||||
startInterval = ([currentDate timeIntervalSinceDate: start]
|
startInterval = ([currentDate timeIntervalSinceDate: start]
|
||||||
/ intervalSeconds);
|
/ quarterLength);
|
||||||
|
|
||||||
currentDate = [record objectForKey: @"endDate"];
|
currentDate = [record objectForKey: @"endDate"];
|
||||||
if ([currentDate earlierDate: end] == end)
|
if ([currentDate earlierDate: end] == end)
|
||||||
endInterval = itemCount - 1;
|
endInterval = itemCount - 1;
|
||||||
else
|
else
|
||||||
endInterval = ([currentDate timeIntervalSinceDate: start]
|
endInterval = ([currentDate timeIntervalSinceDate: start]
|
||||||
/ intervalSeconds);
|
/ quarterLength);
|
||||||
|
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
for (count = startInterval; count < endInterval; count++)
|
for (count = startInterval; count < endInterval; count++)
|
||||||
|
@ -1160,15 +1157,16 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
- (unsigned int **) _loadFreeBusyForUsers: (NSArray *) uids
|
- (unsigned int **) _loadFreeBusyForUsers: (NSArray *) uids
|
||||||
fromDate: (NSCalendarDate *) start
|
fromDate: (NSCalendarDate *) start
|
||||||
{
|
{
|
||||||
unsigned int **fbData, **node, count;
|
unsigned int **fbData, **node;
|
||||||
|
int count, max;
|
||||||
|
|
||||||
fbData = calloc ([uids count], sizeof (unsigned int *));
|
max = [uids count];
|
||||||
for (count = 0; count < [uids count]; count++)
|
fbData = calloc (max, sizeof (unsigned int *));
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
{
|
{
|
||||||
fbData[count] = calloc (offsetBlocks + maxBlocks, sizeof (unsigned int *));
|
|
||||||
node = fbData + count;
|
node = fbData + count;
|
||||||
[self _fillFreeBusy: *node
|
*node = calloc (offsetBlocks + maxBlocks, sizeof (unsigned int *));
|
||||||
forUid: [uids objectAtIndex: count]
|
[self _fillFreeBusy: *node forUid: [uids objectAtIndex: count]
|
||||||
fromDate: start];
|
fromDate: start];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,11 +1347,11 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
|
|
||||||
nStart = [[self _parseDateField: @"startDate"
|
nStart = [[self _parseDateField: @"startDate"
|
||||||
timeField: @"startTime"]
|
timeField: @"startTime"]
|
||||||
addTimeInterval: intervalSeconds * step];
|
addTimeInterval: quarterLength * step];
|
||||||
nEnd = [[self _parseDateField: @"endDate"
|
nEnd = [[self _parseDateField: @"endDate"
|
||||||
timeField: @"endTime"]
|
timeField: @"endTime"]
|
||||||
addTimeInterval: intervalSeconds * step];
|
addTimeInterval: quarterLength * step];
|
||||||
blockDuration = [nEnd timeIntervalSinceDate: nStart] / intervalSeconds;
|
blockDuration = [nEnd timeIntervalSinceDate: nStart] / quarterLength;
|
||||||
|
|
||||||
fbData = [self _loadFreeBusyForUsers: uids
|
fbData = [self _loadFreeBusyForUsers: uids
|
||||||
fromDate: [nStart addTimeInterval: -offsetSeconds]];
|
fromDate: [nStart addTimeInterval: -offsetSeconds]];
|
||||||
|
@ -1380,8 +1378,8 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nStart = [nStart addTimeInterval: intervalSeconds * step];
|
nStart = [nStart addTimeInterval: quarterLength * step];
|
||||||
nEnd = [nEnd addTimeInterval: intervalSeconds * step];
|
nEnd = [nEnd addTimeInterval: quarterLength * step];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = 0; count < [uids count]; count++)
|
for (count = 0; count < [uids count]; count++)
|
||||||
|
|
Loading…
Reference in New Issue