Monotone-Parent: 4efc308e378492efdb95420253ab9f2c2b3ab674
Monotone-Revision: 7a455791a787acec10f4b9c8249a9f97a36998e0 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-06-04T18:50:23 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
52a4de60bd
commit
93067312ec
|
@ -1,9 +1,9 @@
|
||||||
2009-06-04 Cyril Robert <crobert@inverse.ca>
|
2009-06-04 Cyril Robert <crobert@inverse.ca>
|
||||||
|
|
||||||
* UI/Scheduler/UIxCalListingActions.m: Added everything needed for the
|
* UI/Scheduler/UIxCalListingActions.m: Added everything needed for the
|
||||||
findSlot action.
|
findSlot action. Fixes for allday & multiday events.
|
||||||
* UI/WebServerResources/UIxAttendeesEditor.js: Added everything needed for
|
* UI/WebServerResources/UIxAttendeesEditor.js: Added everything needed for
|
||||||
the findSlot action.
|
the findSlot action. Fixes for allday events.
|
||||||
* UI/Scheduler/UIxCalListingActions.h (findPossibleSlotAction): Added header.
|
* UI/Scheduler/UIxCalListingActions.h (findPossibleSlotAction): Added header.
|
||||||
|
|
||||||
2009-06-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2009-06-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
|
@ -1134,27 +1134,51 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
andEnd: (NSCalendarDate *) end
|
andEnd: (NSCalendarDate *) end
|
||||||
against: (NSArray *) limits
|
against: (NSArray *) limits
|
||||||
{
|
{
|
||||||
NSCalendarDate *maxFrom, *maxTo;
|
NSCalendarDate *sFrom, *sTo, *eFrom, *eTo;
|
||||||
NSString *buffer;
|
|
||||||
BOOL rc = YES;
|
BOOL rc = YES;
|
||||||
|
|
||||||
buffer = [NSString stringWithFormat: @"%04d-%02d-%02d %@ %05d",
|
sFrom = [NSCalendarDate dateWithYear: [start yearOfCommonEra]
|
||||||
[start yearOfCommonEra], [start monthOfYear], [start dayOfMonth],
|
month: [start monthOfYear]
|
||||||
[[limits objectAtIndex: 0] descriptionWithCalendarFormat: @"%H:%M"],
|
day: [start dayOfMonth]
|
||||||
([[start timeZone] secondsFromGMTForDate: start]/36)];
|
hour: [[limits objectAtIndex: 0] hourOfDay]
|
||||||
maxFrom = [NSCalendarDate dateWithString: buffer
|
minute: [[limits objectAtIndex: 0] minuteOfHour]
|
||||||
calendarFormat: @"%Y-%m-%d %H:%M %z"];
|
second: 0
|
||||||
|
timeZone: [start timeZone]];
|
||||||
|
sTo = [NSCalendarDate dateWithYear: [start yearOfCommonEra]
|
||||||
|
month: [start monthOfYear]
|
||||||
|
day: [start dayOfMonth]
|
||||||
|
hour: [[limits objectAtIndex: 1] hourOfDay]
|
||||||
|
minute: [[limits objectAtIndex: 1] minuteOfHour]
|
||||||
|
second: 0
|
||||||
|
timeZone: [start timeZone]];
|
||||||
|
|
||||||
buffer = [NSString stringWithFormat: @"%04d-%02d-%02d %@ %05d",
|
eFrom = [NSCalendarDate dateWithYear: [end yearOfCommonEra]
|
||||||
[start yearOfCommonEra], [start monthOfYear], [start dayOfMonth],
|
month: [end monthOfYear]
|
||||||
[[limits objectAtIndex: 1] descriptionWithCalendarFormat: @"%H:%M"],
|
day: [end dayOfMonth]
|
||||||
([[end timeZone] secondsFromGMTForDate: end]/36)];
|
hour: [[limits objectAtIndex: 0] hourOfDay]
|
||||||
maxTo = [NSCalendarDate dateWithString: buffer
|
minute: [[limits objectAtIndex: 0] minuteOfHour]
|
||||||
calendarFormat: @"%Y-%m-%d %H:%M %z"];
|
second: 0
|
||||||
|
timeZone: [end timeZone]];
|
||||||
|
eTo = [NSCalendarDate dateWithYear: [end yearOfCommonEra]
|
||||||
|
month: [end monthOfYear]
|
||||||
|
day: [end dayOfMonth]
|
||||||
|
hour: [[limits objectAtIndex: 1] hourOfDay]
|
||||||
|
minute: [[limits objectAtIndex: 1] minuteOfHour]
|
||||||
|
second: 0
|
||||||
|
timeZone: [end timeZone]];
|
||||||
|
|
||||||
if ([maxFrom compare: start] == NSOrderedDescending)
|
// start < sFrom
|
||||||
|
if ([sFrom compare: start] == NSOrderedDescending)
|
||||||
rc = NO;
|
rc = NO;
|
||||||
if ([maxTo compare: end] == NSOrderedAscending)
|
// start > sTo
|
||||||
|
if ([sTo compare: start] == NSOrderedAscending)
|
||||||
|
rc = NO;
|
||||||
|
|
||||||
|
// end > eTo
|
||||||
|
if ([eTo compare: end] == NSOrderedAscending)
|
||||||
|
rc = NO;
|
||||||
|
// end < eFrom
|
||||||
|
if ([eFrom compare: end] == NSOrderedDescending)
|
||||||
rc = NO;
|
rc = NO;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -1192,8 +1216,9 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
NSCalendarDate *nStart, *nEnd;
|
NSCalendarDate *nStart, *nEnd;
|
||||||
NSArray *uids, *limits;
|
NSArray *uids, *limits;
|
||||||
NSMutableDictionary *rc;
|
NSMutableDictionary *rc;
|
||||||
int direction, count, blockDuration;
|
int direction, count, blockDuration, step;
|
||||||
unsigned int **fbData;
|
unsigned int **fbData;
|
||||||
|
BOOL isAllDay = NO;
|
||||||
|
|
||||||
r = [context request];
|
r = [context request];
|
||||||
rc = nil;
|
rc = nil;
|
||||||
|
@ -1201,15 +1226,21 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
uids = [[r formValueForKey: @"uids"] componentsSeparatedByString: @","];
|
uids = [[r formValueForKey: @"uids"] componentsSeparatedByString: @","];
|
||||||
if ([uids count] > 0)
|
if ([uids count] > 0)
|
||||||
{
|
{
|
||||||
|
isAllDay = [[r formValueForKey: @"isAllDay"] boolValue];
|
||||||
|
direction = [[r formValueForKey: @"direction"] intValue];
|
||||||
limits = [self _loadScheduleLimitsForUsers: uids];
|
limits = [self _loadScheduleLimitsForUsers: uids];
|
||||||
|
|
||||||
direction = [[r formValueForKey: @"direction"] intValue];
|
if (isAllDay)
|
||||||
|
step = direction * 96;
|
||||||
|
else
|
||||||
|
step = direction;
|
||||||
|
|
||||||
nStart = [[self _parseDateField: @"startDate"
|
nStart = [[self _parseDateField: @"startDate"
|
||||||
timeField: @"startTime"]
|
timeField: @"startTime"]
|
||||||
addTimeInterval: intervalSeconds * direction];
|
addTimeInterval: intervalSeconds * step];
|
||||||
nEnd = [[self _parseDateField: @"endDate"
|
nEnd = [[self _parseDateField: @"endDate"
|
||||||
timeField: @"endTime"]
|
timeField: @"endTime"]
|
||||||
addTimeInterval: intervalSeconds * direction];
|
addTimeInterval: intervalSeconds * step];
|
||||||
blockDuration = [nEnd timeIntervalSinceDate: nStart] / intervalSeconds;
|
blockDuration = [nEnd timeIntervalSinceDate: nStart] / intervalSeconds;
|
||||||
|
|
||||||
fbData = [self _loadFreeBusyForUsers: uids
|
fbData = [self _loadFreeBusyForUsers: uids
|
||||||
|
@ -1217,24 +1248,27 @@ _computeBlocksPosition (NSArray *blocks)
|
||||||
|
|
||||||
for (count = offsetBlocks;
|
for (count = offsetBlocks;
|
||||||
(count < offsetBlocks + maxBlocks) && count >= 0;
|
(count < offsetBlocks + maxBlocks) && count >= 0;
|
||||||
count += direction)
|
count += step)
|
||||||
{
|
{
|
||||||
|
//NSLog (@"Trying %@ -> %@", nStart, nEnd);
|
||||||
if ([self _validateStart: nStart
|
if ([self _validateStart: nStart
|
||||||
andEnd: nEnd
|
andEnd: nEnd
|
||||||
against: limits])
|
against: limits])
|
||||||
{
|
{
|
||||||
|
//NSLog (@"valid");
|
||||||
if ([self _possibleBlock: count
|
if ([self _possibleBlock: count
|
||||||
forUsers: [uids count]
|
forUsers: [uids count]
|
||||||
freeBusy: fbData
|
freeBusy: fbData
|
||||||
interval: blockDuration])
|
interval: blockDuration])
|
||||||
{
|
{
|
||||||
|
//NSLog (@"possible");
|
||||||
rc = [self _makeValidResponseFrom: nStart
|
rc = [self _makeValidResponseFrom: nStart
|
||||||
to: nEnd];
|
to: nEnd];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nStart = [nStart addTimeInterval: intervalSeconds * direction];
|
nStart = [nStart addTimeInterval: intervalSeconds * step];
|
||||||
nEnd = [nEnd addTimeInterval: intervalSeconds * direction];
|
nEnd = [nEnd addTimeInterval: intervalSeconds * step];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = 0; count < [uids count]; count++)
|
for (count = 0; count < [uids count]; count++)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label><span class="content">
|
<label><span class="content">
|
||||||
<span id="allDay"><input class="checkBox"
|
<span id="allDay"><input id="isAllDay" class="checkBox"
|
||||||
type="checkbox" var:selection="isAllDay"
|
type="checkbox" var:selection="isAllDay"
|
||||||
var:checked="isAllDay"
|
var:checked="isAllDay"
|
||||||
/> <var:string label:value="All day Event"
|
/> <var:string label:value="All day Event"
|
||||||
|
|
|
@ -4,6 +4,7 @@ var resultsDiv;
|
||||||
var address;
|
var address;
|
||||||
var awaitingFreeBusyRequests = new Array();
|
var awaitingFreeBusyRequests = new Array();
|
||||||
var additionalDays = 2;
|
var additionalDays = 2;
|
||||||
|
var isAllDay = parent$("isAllDay").checked + 0;
|
||||||
|
|
||||||
var attendeesEditor = {
|
var attendeesEditor = {
|
||||||
delay: 500,
|
delay: 500,
|
||||||
|
@ -16,6 +17,19 @@ var attendeesEditor = {
|
||||||
states: null
|
states: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function handleAllDay () {
|
||||||
|
window.timeWidgets['end']['hour'].value = 17;
|
||||||
|
window.timeWidgets['end']['minute'].value = 0;
|
||||||
|
window.timeWidgets['start']['hour'].value = 9;
|
||||||
|
window.timeWidgets['start']['minute'].value = 0;
|
||||||
|
|
||||||
|
$("startTime_time_hour").disabled = true;
|
||||||
|
$("startTime_time_minute").disabled = true;
|
||||||
|
$("endTime_time_hour").disabled = true;
|
||||||
|
$("endTime_time_minute").disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* address completion */
|
/* address completion */
|
||||||
|
|
||||||
function onContactKeydown(event) {
|
function onContactKeydown(event) {
|
||||||
|
@ -486,7 +500,8 @@ function findSlot (direction) {
|
||||||
+ "&startDate=" + escape (sd)
|
+ "&startDate=" + escape (sd)
|
||||||
+ "&startTime=" + escape (st)
|
+ "&startTime=" + escape (st)
|
||||||
+ "&endDate=" + escape (ed)
|
+ "&endDate=" + escape (ed)
|
||||||
+ "&endTime=" + escape (et));
|
+ "&endTime=" + escape (et)
|
||||||
|
+ "&isAllDay=" + isAllDay);
|
||||||
document.findSlotAjaxRequest = triggerAjaxRequest(urlstr,
|
document.findSlotAjaxRequest = triggerAjaxRequest(urlstr,
|
||||||
updateSlotDisplayCallback,
|
updateSlotDisplayCallback,
|
||||||
userList);
|
userList);
|
||||||
|
@ -836,6 +851,9 @@ function initTimeWidgets(widgets) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isAllDay)
|
||||||
|
handleAllDay ();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAdjustTime(event) {
|
function onAdjustTime(event) {
|
||||||
|
|
Loading…
Reference in a new issue