merge of '7507ba8f285d4ba0e11270cb7a9dab563a554cbf'
and 'c61d92bb4f27310c5e538ea6a6361a5df3e85dfc' Monotone-Parent: 7507ba8f285d4ba0e11270cb7a9dab563a554cbf Monotone-Parent: c61d92bb4f27310c5e538ea6a6361a5df3e85dfc Monotone-Revision: 257276eeab3254ccae729ef188757348760688db Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-11T21:30:45 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
4370527ebd
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2007-06-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxCalMonthView.m: no longer retrieve appointments.
|
||||
|
||||
* UI/Scheduler/UIxCalView.m ([-fetchCoreAppointmentsInfos]):
|
||||
removed method.
|
||||
([-fetchCoreTasksInfos]): removed method.
|
||||
|
||||
* UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions
|
||||
-init]): initialize an instance of SOGoDateFormatter.
|
||||
([UIxCalListingActions -eventsListAction]): the display start and
|
||||
end dates are added to the listing for each event.
|
||||
|
||||
* UI/Scheduler/UIxCalDayTable.m: no longer retrieve appointments.
|
||||
|
||||
* UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor
|
||||
-isAllDay]): returns YES if the "hm" url parameter is set to
|
||||
"allday".
|
||||
([UIxAppointmentEditor -defaultAction]): if isAllDay, the enddate
|
||||
is displayed one day earlier.
|
||||
|
||||
2007-06-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions
|
||||
|
|
|
@ -541,7 +541,7 @@ static BOOL uixDebugEnabled = NO;
|
|||
|
||||
- (NSDictionary *)locale {
|
||||
/* we need no fallback here, as locale is guaranteed to be set by sogod */
|
||||
return [[self context] valueForKey:@"locale"];
|
||||
return [context valueForKey: @"locale"];
|
||||
}
|
||||
|
||||
- (WOResourceManager *) pageResourceManager
|
||||
|
|
|
@ -69,7 +69,12 @@
|
|||
/* icalendar values */
|
||||
- (BOOL) isAllDay
|
||||
{
|
||||
return isAllDay;
|
||||
NSString *hm;
|
||||
|
||||
hm = [self queryParameterForKey: @"hm"];
|
||||
|
||||
return (isAllDay
|
||||
|| (hm && [hm isEqualToString: @"allday"]));
|
||||
}
|
||||
|
||||
- (void) setIsAllDay: (BOOL) newIsAllDay
|
||||
|
@ -249,6 +254,10 @@
|
|||
if (event)
|
||||
{
|
||||
startDate = [event startDate];
|
||||
isAllDay = [event isAllDay];
|
||||
if (isAllDay)
|
||||
endDate = [[event endDate] dateByAddingYears: 0 months: 0 days: -1];
|
||||
else
|
||||
endDate = [event endDate];
|
||||
}
|
||||
else
|
||||
|
@ -304,7 +313,7 @@
|
|||
iCalString = [[clientObject calendar: NO] versitString];
|
||||
[clientObject saveContentString: iCalString];
|
||||
|
||||
return [self jsCloseWithRefreshMethod: @"refreshAppointmentsAndDisplay()"];
|
||||
return [self jsCloseWithRefreshMethod: @"refreshEventsAndDisplay()"];
|
||||
}
|
||||
|
||||
- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
NSString *currentTableHour;
|
||||
NSMutableArray *daysToDisplay;
|
||||
NSMutableArray *hoursToDisplay;
|
||||
NSArray *allAppointments;
|
||||
|
||||
NSDictionary *currentAppointment;
|
||||
|
||||
NSString *cssClass;
|
||||
NSString *cssId;
|
||||
|
@ -65,9 +62,6 @@
|
|||
- (void) setCurrentTableDay: (NSCalendarDate *) aTableDay;
|
||||
- (NSCalendarDate *) currentTableDay;
|
||||
|
||||
- (void) setCurrentAppointment: (NSDictionary *) newCurrentAppointment;
|
||||
- (NSDictionary *) currentAppointment;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXCALDAYTABLE_H */
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
allAppointments = nil;
|
||||
// allAppointments = nil;
|
||||
daysToDisplay = nil;
|
||||
hoursToDisplay = nil;
|
||||
numberOfDays = 1;
|
||||
|
@ -57,11 +57,9 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (allAppointments)
|
||||
[allAppointments release];
|
||||
if (daysToDisplay)
|
||||
// if (allAppointments)
|
||||
// [allAppointments release];
|
||||
[daysToDisplay release];
|
||||
if (hoursToDisplay)
|
||||
[hoursToDisplay release];
|
||||
[dateFormatter release];
|
||||
[super dealloc];
|
||||
|
@ -90,11 +88,8 @@
|
|||
- (void) setNumberOfDays: (NSString *) aNumber
|
||||
{
|
||||
numberOfDays = [aNumber intValue];
|
||||
if (daysToDisplay)
|
||||
{
|
||||
[daysToDisplay release];
|
||||
daysToDisplay = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) numberOfDays
|
||||
|
@ -105,11 +100,8 @@
|
|||
- (void) setStartDate: (NSCalendarDate *) aStartDate
|
||||
{
|
||||
startDate = aStartDate;
|
||||
if (daysToDisplay)
|
||||
{
|
||||
[daysToDisplay release];
|
||||
daysToDisplay = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) startDate
|
||||
|
@ -169,6 +161,7 @@
|
|||
[daysToDisplay addObject: [currentDate dateByAddingYears: 0
|
||||
months: 0
|
||||
days: count]];
|
||||
|
||||
}
|
||||
|
||||
return daysToDisplay;
|
||||
|
@ -201,94 +194,97 @@
|
|||
|
||||
- (NSString *) labelForDay
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@<br />%@",
|
||||
[dateFormatter shortDayOfWeek: [currentTableDay dayOfWeek]],
|
||||
[dateFormatter stringForObjectValue: currentTableDay]];
|
||||
return [dateFormatter shortDayOfWeek: [currentTableDay dayOfWeek]];
|
||||
}
|
||||
|
||||
- (NSDictionary *) _adjustedAppointment: (NSDictionary *) anAppointment
|
||||
forStart: (NSCalendarDate *) start
|
||||
andEnd: (NSCalendarDate *) end
|
||||
- (NSString *) labelForDate
|
||||
{
|
||||
NSMutableDictionary *newMutableAppointment;
|
||||
NSDictionary *newAppointment;
|
||||
BOOL startIsEarlier, endIsLater;
|
||||
|
||||
startIsEarlier
|
||||
= ([[anAppointment objectForKey: @"startDate"] laterDate: start] == start);
|
||||
endIsLater
|
||||
= ([[anAppointment objectForKey: @"endDate"] earlierDate: end] == end);
|
||||
|
||||
if (startIsEarlier || endIsLater)
|
||||
{
|
||||
newMutableAppointment
|
||||
= [NSMutableDictionary dictionaryWithDictionary: anAppointment];
|
||||
|
||||
if (startIsEarlier)
|
||||
[newMutableAppointment setObject: start
|
||||
forKey: @"startDate"];
|
||||
if (endIsLater)
|
||||
[newMutableAppointment setObject: end
|
||||
forKey: @"endDate"];
|
||||
|
||||
newAppointment = newMutableAppointment;
|
||||
}
|
||||
else
|
||||
newAppointment = anAppointment;
|
||||
|
||||
return newAppointment;
|
||||
return [dateFormatter stringForObjectValue: currentTableDay];
|
||||
}
|
||||
|
||||
- (NSArray *) appointmentsForCurrentDay
|
||||
{
|
||||
NSMutableArray *filteredAppointments;
|
||||
NSEnumerator *aptsEnumerator;
|
||||
NSDictionary *currentDayAppointment;
|
||||
NSCalendarDate *start, *end;
|
||||
int endHour;
|
||||
// - (NSDictionary *) _adjustedAppointment: (NSDictionary *) anAppointment
|
||||
// forStart: (NSCalendarDate *) start
|
||||
// andEnd: (NSCalendarDate *) end
|
||||
// {
|
||||
// NSMutableDictionary *newMutableAppointment;
|
||||
// NSDictionary *newAppointment;
|
||||
// BOOL startIsEarlier, endIsLater;
|
||||
|
||||
if (!allAppointments)
|
||||
{
|
||||
allAppointments = [self fetchCoreAppointmentsInfos];
|
||||
[allAppointments retain];
|
||||
}
|
||||
// startIsEarlier
|
||||
// = ([[anAppointment objectForKey: @"startDate"] laterDate: start] == start);
|
||||
// endIsLater
|
||||
// = ([[anAppointment objectForKey: @"endDate"] earlierDate: end] == end);
|
||||
|
||||
filteredAppointments = [NSMutableArray new];
|
||||
[filteredAppointments autorelease];
|
||||
// if (startIsEarlier || endIsLater)
|
||||
// {
|
||||
// newMutableAppointment
|
||||
// = [NSMutableDictionary dictionaryWithDictionary: anAppointment];
|
||||
|
||||
start = [currentTableDay hour: [self dayStartHour] minute: 0];
|
||||
endHour = [self dayEndHour];
|
||||
if (endHour < 24)
|
||||
end = [currentTableDay hour: [self dayEndHour] minute: 59];
|
||||
else
|
||||
end = [[currentTableDay tomorrow] hour: 0 minute: 0];
|
||||
// if (startIsEarlier)
|
||||
// [newMutableAppointment setObject: start
|
||||
// forKey: @"startDate"];
|
||||
// if (endIsLater)
|
||||
// [newMutableAppointment setObject: end
|
||||
// forKey: @"endDate"];
|
||||
|
||||
aptsEnumerator = [allAppointments objectEnumerator];
|
||||
currentDayAppointment = [aptsEnumerator nextObject];
|
||||
while (currentDayAppointment)
|
||||
{
|
||||
if (([end laterDate: [currentDayAppointment
|
||||
valueForKey: @"startDate"]] == end)
|
||||
&& ([start earlierDate: [currentDayAppointment
|
||||
valueForKey: @"endDate"]] == start))
|
||||
[filteredAppointments
|
||||
addObject: [self _adjustedAppointment: currentDayAppointment
|
||||
forStart: start andEnd: end]];
|
||||
currentDayAppointment = [aptsEnumerator nextObject];
|
||||
}
|
||||
// newAppointment = newMutableAppointment;
|
||||
// }
|
||||
// else
|
||||
// newAppointment = anAppointment;
|
||||
|
||||
return filteredAppointments;
|
||||
}
|
||||
// return newAppointment;
|
||||
// }
|
||||
|
||||
- (void) setCurrentAppointment: (NSDictionary *) newCurrentAppointment
|
||||
{
|
||||
currentAppointment = newCurrentAppointment;
|
||||
}
|
||||
// - (NSArray *) appointmentsForCurrentDay
|
||||
// {
|
||||
// NSMutableArray *filteredAppointments;
|
||||
// NSEnumerator *aptsEnumerator;
|
||||
// NSDictionary *currentDayAppointment;
|
||||
// NSCalendarDate *start, *end;
|
||||
// int endHour;
|
||||
|
||||
- (NSDictionary *) currentAppointment
|
||||
{
|
||||
return currentAppointment;
|
||||
}
|
||||
// if (!allAppointments)
|
||||
// {
|
||||
// allAppointments = [self fetchCoreAppointmentsInfos];
|
||||
// [allAppointments retain];
|
||||
// }
|
||||
|
||||
// filteredAppointments = [NSMutableArray new];
|
||||
// [filteredAppointments autorelease];
|
||||
|
||||
// start = [currentTableDay hour: [self dayStartHour] minute: 0];
|
||||
// endHour = [self dayEndHour];
|
||||
// if (endHour < 24)
|
||||
// end = [currentTableDay hour: [self dayEndHour] minute: 59];
|
||||
// else
|
||||
// end = [[currentTableDay tomorrow] hour: 0 minute: 0];
|
||||
|
||||
// aptsEnumerator = [allAppointments objectEnumerator];
|
||||
// currentDayAppointment = [aptsEnumerator nextObject];
|
||||
// while (currentDayAppointment)
|
||||
// {
|
||||
// if (([end laterDate: [currentDayAppointment
|
||||
// valueForKey: @"startDate"]] == end)
|
||||
// && ([start earlierDate: [currentDayAppointment
|
||||
// valueForKey: @"endDate"]] == start))
|
||||
// [filteredAppointments
|
||||
// addObject: [self _adjustedAppointment: currentDayAppointment
|
||||
// forStart: start andEnd: end]];
|
||||
// currentDayAppointment = [aptsEnumerator nextObject];
|
||||
// }
|
||||
|
||||
// return filteredAppointments;
|
||||
// }
|
||||
|
||||
// - (void) setCurrentAppointment: (NSDictionary *) newCurrentAppointment
|
||||
// {
|
||||
// currentAppointment = newCurrentAppointment;
|
||||
// }
|
||||
|
||||
// - (NSDictionary *) currentAppointment
|
||||
// {
|
||||
// return currentAppointment;
|
||||
// }
|
||||
|
||||
- (NSString *) appointmentsClasses
|
||||
{
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
@class NSString;
|
||||
@class NSTimeZone;
|
||||
|
||||
@class SOGoDateFormatter;
|
||||
|
||||
@class WOResponse;
|
||||
@class WORequest;
|
||||
|
||||
|
@ -41,6 +43,7 @@
|
|||
NSCalendarDate *endDate;
|
||||
NSString *userLogin;
|
||||
WORequest *request;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
}
|
||||
|
||||
- (WOResponse *) eventsListAction;
|
||||
|
|
|
@ -38,20 +38,25 @@
|
|||
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
|
||||
|
||||
#import "../SOGoUI/SOGoDateFormatter.h"
|
||||
|
||||
#import "UIxCalListingActions.h"
|
||||
|
||||
@implementation UIxCalListingActions
|
||||
|
||||
- (id) init
|
||||
{
|
||||
NSDictionary *locale;
|
||||
|
||||
if ((self = [super init]))
|
||||
{
|
||||
componentsData = [NSMutableDictionary new];
|
||||
startDate = nil;
|
||||
endDate = nil;
|
||||
request = nil;
|
||||
// knowsToShow = NO;
|
||||
// showCompleted = NO;
|
||||
locale = [[self context] valueForKey: @"locale"];
|
||||
dateFormatter = [[SOGoDateFormatter alloc] initWithLocale: locale];
|
||||
[dateFormatter setFullWeekdayNameAndDetails];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -59,6 +64,7 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[dateFormatter release];
|
||||
[componentsData release];
|
||||
[startDate release];
|
||||
[endDate release];
|
||||
|
@ -159,7 +165,7 @@
|
|||
else
|
||||
startDate = nil;
|
||||
|
||||
param = [request formValueForKey: @"sd"];
|
||||
param = [request formValueForKey: @"ed"];
|
||||
if ([param length] > 0)
|
||||
endDate = [[NSCalendarDate dateFromShortDateString: param
|
||||
andShortTimeString: nil
|
||||
|
@ -292,16 +298,42 @@
|
|||
|
||||
- (WOResponse *) eventsListAction
|
||||
{
|
||||
NSArray *fields;
|
||||
NSArray *events;
|
||||
NSArray *fields, *oldEvent;
|
||||
NSEnumerator *events;
|
||||
NSString *date;
|
||||
NSMutableArray *newEvents, *newEvent;
|
||||
unsigned int interval;
|
||||
|
||||
[self _setupContext];
|
||||
|
||||
newEvents = [NSMutableArray array];
|
||||
fields = [NSArray arrayWithObjects: @"c_name", @"owner", @"status",
|
||||
@"title", @"startdate", @"enddate", @"location", nil];
|
||||
events = [self _fetchFields: fields forComponentOfType: @"vevent"];
|
||||
@"title", @"startdate", @"enddate", @"location",
|
||||
@"isallday", nil];
|
||||
events = [[self _fetchFields: fields
|
||||
forComponentOfType: @"vevent"] objectEnumerator];
|
||||
oldEvent = [events nextObject];
|
||||
while (oldEvent)
|
||||
{
|
||||
newEvent = [NSMutableArray arrayWithArray: oldEvent];
|
||||
interval = [[oldEvent objectAtIndex: 4] intValue];
|
||||
date
|
||||
= [dateFormatter stringForObjectValue:
|
||||
[NSCalendarDate dateWithTimeIntervalSince1970: interval]];
|
||||
[newEvent addObject: date];
|
||||
interval = [[oldEvent objectAtIndex: 5] intValue];
|
||||
if ([[oldEvent objectAtIndex: 7] boolValue])
|
||||
interval -= 86400;
|
||||
date
|
||||
= [dateFormatter stringForObjectValue:
|
||||
[NSCalendarDate dateWithTimeIntervalSince1970: interval]];
|
||||
[newEvent addObject: date];
|
||||
[newEvents addObject: newEvent];
|
||||
|
||||
return [self _responseWithData: events];
|
||||
oldEvent = [events nextObject];
|
||||
}
|
||||
|
||||
return [self _responseWithData: newEvents];
|
||||
}
|
||||
|
||||
- (NSString *) _getStatusClassForStatusCode: (int) statusCode
|
||||
|
|
|
@ -64,39 +64,6 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) _addEventToSortedEvents: (NSDictionary *) newEvent
|
||||
{
|
||||
NSMutableArray *eventArray;
|
||||
NSString *dayId;
|
||||
|
||||
dayId = [[newEvent objectForKey: @"startDate"] shortDateString];
|
||||
eventArray = [sortedAppointments objectForKey: dayId];
|
||||
if (!eventArray)
|
||||
{
|
||||
eventArray = [NSMutableArray new];
|
||||
[eventArray autorelease];
|
||||
[sortedAppointments setObject: eventArray forKey: dayId];
|
||||
}
|
||||
[eventArray addObject: newEvent];
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
NSEnumerator *events;
|
||||
NSDictionary *currentEvent;
|
||||
|
||||
events = [[self fetchCoreAppointmentsInfos] objectEnumerator];
|
||||
currentEvent = [events nextObject];
|
||||
while (currentEvent)
|
||||
{
|
||||
[self _addEventToSortedEvents: currentEvent];
|
||||
currentEvent = [events nextObject];
|
||||
// NSLog (@"event:\n'%@'", currentEvent);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray *) headerDaysToDisplay
|
||||
{
|
||||
NSMutableArray *headerDaysToDisplay;
|
||||
|
|
|
@ -98,8 +98,6 @@
|
|||
|
||||
- (NSCalendarDate *) startDate;
|
||||
- (NSCalendarDate *) endDate;
|
||||
- (NSArray *) fetchCoreAppointmentsInfos;
|
||||
- (NSArray *) fetchCoreTasksInfos;
|
||||
|
||||
/* date selection */
|
||||
|
||||
|
|
|
@ -451,135 +451,6 @@ static BOOL shouldDisplayWeekend = NO;
|
|||
return [[self startDate] tomorrow];
|
||||
}
|
||||
|
||||
- (SOGoAppointmentFolder *) _aptFolder: (NSString *) folder
|
||||
withClientObject: (SOGoAppointmentFolder *) clientObject
|
||||
{
|
||||
SOGoAppointmentFolder *aptFolder;
|
||||
NSArray *folderParts;
|
||||
|
||||
if ([folder isEqualToString: @"/"])
|
||||
aptFolder = clientObject;
|
||||
else
|
||||
{
|
||||
folderParts = [folder componentsSeparatedByString: @":"];
|
||||
aptFolder
|
||||
= [clientObject lookupCalendarFolderForUID:
|
||||
[folderParts objectAtIndex: 0]];
|
||||
}
|
||||
|
||||
return aptFolder;
|
||||
}
|
||||
|
||||
- (NSArray *) _activeCalendarFolders
|
||||
{
|
||||
NSMutableArray *activeFolders;
|
||||
NSEnumerator *folders;
|
||||
NSDictionary *currentFolderDict;
|
||||
SOGoAppointmentFolder *currentFolder, *clientObject;
|
||||
|
||||
activeFolders = [NSMutableArray new];
|
||||
[activeFolders autorelease];
|
||||
|
||||
clientObject = [self clientObject];
|
||||
|
||||
folders = [[clientObject calendarFolders] objectEnumerator];
|
||||
currentFolderDict = [folders nextObject];
|
||||
while (currentFolderDict)
|
||||
{
|
||||
if ([[currentFolderDict objectForKey: @"active"] boolValue])
|
||||
{
|
||||
currentFolder
|
||||
= [self _aptFolder: [currentFolderDict objectForKey: @"folder"]
|
||||
withClientObject: clientObject];
|
||||
[activeFolders addObject: currentFolder];
|
||||
}
|
||||
|
||||
currentFolderDict = [folders nextObject];
|
||||
}
|
||||
|
||||
return activeFolders;
|
||||
}
|
||||
|
||||
- (void) _updatePrivacyInObjects: (NSArray *) objectInfos
|
||||
fromFolder: (SOGoAppointmentFolder *) folder
|
||||
{
|
||||
int hideDetails[] = {-1, -1, -1};
|
||||
NSMutableDictionary *currentRecord;
|
||||
int privacyFlag;
|
||||
NSString *roleString, *userLogin;
|
||||
NSEnumerator *infos;
|
||||
|
||||
userLogin = [[context activeUser] login];
|
||||
infos = [objectInfos objectEnumerator];
|
||||
currentRecord = [infos nextObject];
|
||||
while (currentRecord)
|
||||
{
|
||||
privacyFlag = [[currentRecord objectForKey: @"classification"] intValue];
|
||||
if (hideDetails[privacyFlag] == -1)
|
||||
{
|
||||
roleString = [folder roleForComponentsWithAccessClass: privacyFlag
|
||||
forUser: userLogin];
|
||||
hideDetails[privacyFlag] = ([roleString isEqualToString: @"ComponentDAndTViewer"]
|
||||
? 1 : 0);
|
||||
}
|
||||
if (hideDetails[privacyFlag])
|
||||
{
|
||||
[currentRecord setObject: [self labelForKey: @"(Private Event)"]
|
||||
forKey: @"title"];
|
||||
[currentRecord setObject: @"" forKey: @"location"];
|
||||
}
|
||||
currentRecord = [infos nextObject];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *) _fetchCoreInfosForComponent: (NSString *) component
|
||||
{
|
||||
NSArray *currentInfos;
|
||||
NSMutableArray *infos;
|
||||
NSEnumerator *folders;
|
||||
SOGoAppointmentFolder *currentFolder;
|
||||
|
||||
infos = [componentsData objectForKey: component];
|
||||
if (!infos)
|
||||
{
|
||||
infos = [NSMutableArray array];
|
||||
folders = [[self _activeCalendarFolders] objectEnumerator];
|
||||
currentFolder = [folders nextObject];
|
||||
while (currentFolder)
|
||||
{
|
||||
currentInfos = [currentFolder fetchCoreInfosFrom: [[self startDate] beginOfDay]
|
||||
to: [[self endDate] endOfDay]
|
||||
component: component];
|
||||
[currentInfos makeObjectsPerform: @selector (setObject:forKey:)
|
||||
withObject: [currentFolder ownerInContext: nil]
|
||||
withObject: @"owner"];
|
||||
[self _updatePrivacyInObjects: currentInfos
|
||||
fromFolder: currentFolder];
|
||||
[infos addObjectsFromArray: currentInfos];
|
||||
currentFolder = [folders nextObject];
|
||||
}
|
||||
[componentsData setObject: infos forKey: component];
|
||||
}
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
- (NSArray *) fetchCoreAppointmentsInfos
|
||||
{
|
||||
if (!appointments)
|
||||
[self setAppointments: [self _fetchCoreInfosForComponent: @"vevent"]];
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
- (NSArray *) fetchCoreTasksInfos
|
||||
{
|
||||
if (!tasks)
|
||||
[self setTasks: [self _fetchCoreInfosForComponent: @"vtodo"]];
|
||||
|
||||
return tasks;
|
||||
}
|
||||
|
||||
/* query parameters */
|
||||
|
||||
- (BOOL) shouldDisplayRejectedAppointments
|
||||
|
|
|
@ -1,10 +1,27 @@
|
|||
<?xml version="1.0" standalone="yes"?>
|
||||
<container
|
||||
<!DOCTYPE container>
|
||||
<container
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label">
|
||||
<div id="calendarHeader" var:class="daysViewClasses">
|
||||
<div class="dayLabels"
|
||||
><var:foreach list="daysToDisplay" item="currentTableDay"
|
||||
><div var:class="dayClasses"
|
||||
><var:string value="labelForDate"/><br
|
||||
/><span class="dayOfWeek"><var:string value="labelForDay"/></span
|
||||
></div
|
||||
></var:foreach>
|
||||
</div>
|
||||
<div class="days"
|
||||
><var:foreach list="daysToDisplay" item="currentTableDay"
|
||||
><div var:class="dayClasses"><!-- space --></div
|
||||
></var:foreach
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div id="daysView" var:class="daysViewClasses">
|
||||
<div class="hours">
|
||||
<var:foreach list="hoursToDisplay" item="currentTableHour"
|
||||
|
@ -43,15 +60,14 @@
|
|||
<var:foreach list="daysToDisplay" item="currentTableDay"
|
||||
><div var:class="dayClasses"
|
||||
var:day="currentTableDay.shortDateString"
|
||||
><div class="header"><var:string value="labelForDay"
|
||||
const:escapeHTML="NO"/></div>
|
||||
>
|
||||
<div class="appointments">
|
||||
<var:foreach list="hoursToDisplay" item="currentTableHour"
|
||||
><div var:class="clickableHourCellClass"
|
||||
var:day="currentTableDay.shortDateString"
|
||||
var:hour="currentAppointmentHour">
|
||||
</div></var:foreach>
|
||||
<var:foreach list="appointmentsForCurrentDay" item="currentAppointment"
|
||||
<!-- <var:foreach list="appointmentsForCurrentDay" item="currentAppointment"
|
||||
><var:component className="UIxCalInlineAptView"
|
||||
dayStartHour="dayStartHour"
|
||||
dayEndHour="dayEndHour"
|
||||
|
@ -64,10 +80,10 @@
|
|||
referenceDate="selectedDate"
|
||||
canAccess="canAccessApt"
|
||||
/></var:foreach
|
||||
>
|
||||
> -->
|
||||
</div>
|
||||
</div>
|
||||
</var:foreach>
|
||||
</div>
|
||||
</div>
|
||||
</container>
|
||||
</container>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" standalone="yes"?>
|
||||
<container
|
||||
<!DOCTYPE container>
|
||||
<container
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
|
@ -38,7 +39,6 @@
|
|||
var:date="nextDayQueryParameters.day"
|
||||
onclick="return onCalendarGotoDay(this);"
|
||||
><img rsrc:src="arrow-rit-sharp.gif"/></a>
|
||||
|
||||
<div id="calendarContent">
|
||||
<var:component
|
||||
className="UIxCalDayTable"
|
||||
|
@ -46,4 +46,4 @@
|
|||
const:CSSClass="dayOverview"
|
||||
const:numberOfDays="1" />
|
||||
</div>
|
||||
</container>
|
||||
</container>
|
||||
|
|
|
@ -89,10 +89,10 @@
|
|||
<div id="eventsListView">
|
||||
<table id="eventsList">
|
||||
<tr>
|
||||
<td class="headerCell"><span class="sortableTableHeader"><var:string label:value="Title"/></span></td>
|
||||
<td class="headerCell headerTitle"><span class="sortableTableHeader"><var:string label:value="Title"/></span></td>
|
||||
<td class="headerCell headerDateTime"><span class="sortableTableHeader"><var:string label:value="Start"/></span></td>
|
||||
<td class="headerCell headerDateTime"><span class="sortableTableHeader"><var:string label:value="End"/></span></td>
|
||||
<td class="headerCell"><span class="sortableTableHeader"><var:string label:value="Location"/></span></td>
|
||||
<td class="headerCell headerLocation"><span class="sortableTableHeader"><var:string label:value="Location"/></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -46,16 +46,16 @@
|
|||
><div var:class="headerDayCellClasses"
|
||||
><var:string value="labelForCurrentDayToDisplay"
|
||||
/></div></var:foreach>
|
||||
<div class="days"
|
||||
<div class="days" const:id="monthDaysView"
|
||||
><var:foreach list="daysToDisplay" item="currentTableColumn">
|
||||
<var:foreach list="currentTableColumn" item="currentTableDay">
|
||||
<div var:class="dayCellClasses"
|
||||
var:day="currentTableDay.shortDateString">
|
||||
<div class="dayHeader"><var:string value="dayHeaderNumber"/></div>
|
||||
<var:foreach
|
||||
<!-- var:foreach
|
||||
list="aptsForCurrentDate"
|
||||
item="appointment">
|
||||
<var:component className="UIxCalInlineMonthAptView"
|
||||
item="appointment"
|
||||
var:component className="UIxCalInlineMonthAptView"
|
||||
appointment="appointment"
|
||||
formatter="monthAptFormatter"
|
||||
tooltipFormatter="aptTooltipFormatter"
|
||||
|
@ -64,7 +64,7 @@
|
|||
queryDictionary="currentDayQueryParameters"
|
||||
referenceDate="currentTableDay"
|
||||
canAccess="canAccessApt"
|
||||
/></var:foreach>
|
||||
var:foreach -->
|
||||
</div>
|
||||
</var:foreach>
|
||||
</var:foreach>
|
||||
|
|
|
@ -33,7 +33,15 @@ String.prototype.asDate = function () {
|
|||
newDate = new Date(date[2], date[1] - 1, date[0]);
|
||||
else {
|
||||
date = this.split("-");
|
||||
if (date.length == 3)
|
||||
newDate = new Date(date[0], date[1] - 1, date[2]);
|
||||
else {
|
||||
if (this.length == 8) {
|
||||
newDate = new Date(this.substring(0, 4),
|
||||
this.substring(4, 6) - 1,
|
||||
this.substring(6, 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newDate;
|
||||
|
@ -99,6 +107,19 @@ Date.prototype.getHourString = function() {
|
|||
return newString;
|
||||
}
|
||||
|
||||
Date.prototype.getDisplayHoursString = function() {
|
||||
var hoursString = this.getHours();
|
||||
if (hoursString.length == 1)
|
||||
hoursString = '0' + hoursString;
|
||||
|
||||
var minutesString = this.getMinutes();
|
||||
if (minutesString.length == 1)
|
||||
minutesString = '0' + minutesString;
|
||||
|
||||
|
||||
return hoursString + ":" + minutesString;
|
||||
}
|
||||
|
||||
Date.prototype.stringWithSeparator = function(separator) {
|
||||
var month = '' + (this.getMonth() + 1);
|
||||
var day = '' + this.getDate();
|
||||
|
@ -118,3 +139,19 @@ Date.prototype.stringWithSeparator = function(separator) {
|
|||
Date.prototype.sogoFreeBusyStringWithSeparator = function(separator) {
|
||||
return this.sogoDayName() + ", " + this.stringWithSeparator(separator);
|
||||
}
|
||||
|
||||
Date.prototype.addDays = function(nbrDays) {
|
||||
var milliSeconds = this.getTime();
|
||||
milliSeconds += 86400000 * nbrDays;
|
||||
this.setTime(milliSeconds);
|
||||
}
|
||||
|
||||
Date.prototype.earlierDate = function(otherDate) {
|
||||
return ((this.getTime() < otherDate.getTime())
|
||||
? this : otherDate);
|
||||
}
|
||||
|
||||
Date.prototype.laterDate = function(otherDate) {
|
||||
return ((this.getTime() < otherDate.getTime())
|
||||
? otherDate : this);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,7 +23,7 @@ var usersRightsWindowHeight = 250;
|
|||
var usersRightsWindowWidth = 502;
|
||||
|
||||
function newEvent(sender, type) {
|
||||
var day = sender.getAttribute("day");
|
||||
var day = sender.day;
|
||||
if (!day)
|
||||
day = currentDay;
|
||||
|
||||
|
@ -32,7 +32,9 @@ function newEvent(sender, type) {
|
|||
&& currentView == "multicolumndayview" && type == "event")
|
||||
user = sender.parentNode.parentNode.getAttribute("user");
|
||||
|
||||
var hour = sender.getAttribute("hour");
|
||||
var hour = sender.hour;
|
||||
if (!hour)
|
||||
hour = sender.getAttribute("hour");
|
||||
var urlstr = UserFolderURL + "../" + user + "/Calendar/new" + type;
|
||||
var params = new Array();
|
||||
if (day)
|
||||
|
@ -182,7 +184,7 @@ function modifyEventCallback(http) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
log("showing alert...");
|
||||
// log("showing alert...");
|
||||
window.alert(labels["eventPartStatModificationError"]);
|
||||
}
|
||||
document.modifyEventAjaxRequest = null;
|
||||
|
@ -211,11 +213,11 @@ function deleteEventCallback(http) {
|
|||
log ("deleteEventCallback Ajax error");
|
||||
}
|
||||
|
||||
function editDoubleClickedEvent() {
|
||||
_editEventId(this.getAttribute("id"),
|
||||
this.owner);
|
||||
function editDoubleClickedEvent(event) {
|
||||
_editEventId(this.cname, this.owner);
|
||||
|
||||
return false;
|
||||
event.preventDefault();
|
||||
event.cancelBubble = true;
|
||||
}
|
||||
|
||||
function onSelectAll() {
|
||||
|
@ -225,18 +227,8 @@ function onSelectAll() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function displayEvent(event) {
|
||||
_editEventId(this.getAttribute("aptCName"),
|
||||
this.owner);
|
||||
|
||||
preventDefault(event);
|
||||
event.stopPropagation();
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
}
|
||||
|
||||
function onDaySelect(node) {
|
||||
var day = node.getAttribute("day");
|
||||
var day = node.day;
|
||||
var needRefresh = (listFilter == 'view_selectedday'
|
||||
&& day != currentDay);
|
||||
|
||||
|
@ -303,10 +295,10 @@ function dateSelectorCallback(http) {
|
|||
}
|
||||
|
||||
function eventsListCallback(http) {
|
||||
var div = $("eventsListView");
|
||||
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
var div = $("eventsListView");
|
||||
|
||||
document.eventsListAjaxRequest = null;
|
||||
var table = $("eventsList").tBodies[0];
|
||||
var params = parseQueryParameters(http.callbackData);
|
||||
|
@ -320,6 +312,7 @@ function eventsListCallback(http) {
|
|||
table.appendChild(row);
|
||||
$(row).addClassName("eventRow");
|
||||
row.setAttribute("id", data[i][0]);
|
||||
row.cname = data[i][0];
|
||||
row.owner = data[i][1];
|
||||
|
||||
var startDate = new Date();
|
||||
|
@ -339,12 +332,12 @@ function eventsListCallback(http) {
|
|||
td = document.createElement("td");
|
||||
row.appendChild(td);
|
||||
Event.observe(td, "mousedown", listRowMouseDownHandler, true);
|
||||
td.appendChild(document.createTextNode(data[i][4]));
|
||||
td.appendChild(document.createTextNode(data[i][8]));
|
||||
|
||||
td = document.createElement("td");
|
||||
row.appendChild(td);
|
||||
Event.observe(td, "mousedown", listRowMouseDownHandler, true);
|
||||
td.appendChild(document.createTextNode(data[i][5]));
|
||||
td.appendChild(document.createTextNode(data[i][9]));
|
||||
|
||||
td = document.createElement("td");
|
||||
row.appendChild(td);
|
||||
|
@ -369,7 +362,7 @@ function tasksListCallback(http) {
|
|||
//log(i + " = " + data[i][3]);
|
||||
var listItem = document.createElement("li");
|
||||
list.appendChild(listItem);
|
||||
//Event.observe(listItem, "mousedown", listRowMouseDownHandler); // causes problem with Safari
|
||||
Event.observe(listItem, "mousedown", listRowMouseDownHandler); // causes problem with Safari
|
||||
Event.observe(listItem, "click", onRowClick);
|
||||
Event.observe(listItem, "dblclick", editDoubleClickedEvent.bindAsEventListener(listItem));
|
||||
listItem.setAttribute("id", data[i][0]);
|
||||
|
@ -393,7 +386,7 @@ function tasksListCallback(http) {
|
|||
if (http.callbackData) {
|
||||
var selectedNodesId = http.callbackData;
|
||||
for (var i = 0; i < selectedNodesId.length; i++) {
|
||||
log(selectedNodesId[i] + " (" + i + ") is selected");
|
||||
// log(selectedNodesId[i] + " (" + i + ") is selected");
|
||||
$(selectedNodesId[i]).select();
|
||||
}
|
||||
}
|
||||
|
@ -410,14 +403,14 @@ function restoreCurrentDaySelection(div) {
|
|||
var i = 9;
|
||||
while (!day && i < elements.length)
|
||||
{
|
||||
day = elements[i].getAttribute("day");
|
||||
day = elements[i].day;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (day
|
||||
&& day.substr(0, 6) == currentDay.substr(0, 6)) {
|
||||
for (i = 0; i < elements.length; i++) {
|
||||
day = elements[i].getAttribute("day");
|
||||
day = elements[i].day;
|
||||
if (day && day == currentDay) {
|
||||
var td = elements[i].getParentWithTagName("td");
|
||||
if (document.selectedDate)
|
||||
|
@ -483,11 +476,9 @@ function changeCalendarDisplay(time, newView) {
|
|||
document.dayDisplayAjaxRequest.aborted = true;
|
||||
document.dayDisplayAjaxRequest.abort();
|
||||
}
|
||||
document.dayDisplayAjaxRequest = triggerAjaxRequest(url,
|
||||
calendarDisplayCallback,
|
||||
{ "view": newView,
|
||||
"day": day,
|
||||
"hour": hour });
|
||||
document.dayDisplayAjaxRequest
|
||||
= triggerAjaxRequest(url, calendarDisplayCallback,
|
||||
{ "view": newView, "day": day, "hour": hour });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -530,9 +521,10 @@ function scrollDayView(hour) {
|
|||
rowNumber = 8;
|
||||
|
||||
var daysView = $("daysView");
|
||||
var hours = $(daysView.childNodesWithTag("div")[0]).childNodesWithTag("div");
|
||||
var hours =
|
||||
$(daysView.childNodesWithTag("div"))[0].childNodesWithTag("div");
|
||||
if (hours.length > 0)
|
||||
daysView.parentNode.scrollTop = hours[rowNumber + 1].offsetTop;
|
||||
daysView.scrollTop = hours[rowNumber].offsetTop;
|
||||
}
|
||||
|
||||
function onClickableCellsDblClick(event) {
|
||||
|
@ -542,6 +534,179 @@ function onClickableCellsDblClick(event) {
|
|||
event.returnValue = false;
|
||||
}
|
||||
|
||||
function refreshCalendarEvents() {
|
||||
var sd = currentDay;
|
||||
if (!sd) {
|
||||
var todayDate = new Date();
|
||||
sd = todayDate.getDayString();
|
||||
}
|
||||
var ed;
|
||||
if (currentView == "dayview")
|
||||
ed = sd;
|
||||
else if (currentView == "weekview") {
|
||||
var endDate = sd.asDate();
|
||||
endDate.addDays(6);
|
||||
ed = endDate.getDayString();
|
||||
}
|
||||
else {
|
||||
var monthDate = sd.asDate();
|
||||
monthDate.setDate(1);
|
||||
|
||||
var workDate = new Date();
|
||||
workDate.setTime(monthDate.getTime());
|
||||
var day = workDate.getDay();
|
||||
if (day > 0)
|
||||
workDate.addDays(1 - day);
|
||||
else
|
||||
workDate.addDays(-6);
|
||||
|
||||
sd = workDate.getDayString();
|
||||
|
||||
workDate.setTime(monthDate.getTime());
|
||||
workDate.setMonth(workDate.getMonth() + 1);
|
||||
workDate.addDays(-1);
|
||||
|
||||
var day = workDate.getDay();
|
||||
if (day > 0)
|
||||
workDate.addDays(7 - day);
|
||||
ed = workDate.getDayString();
|
||||
}
|
||||
if (document.refreshCalendarEventsAjaxRequest) {
|
||||
document.refreshCalendarEventsAjaxRequest.aborted = true;
|
||||
document.refreshCalendarEventsAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "eventslist?sd=" + sd + "&ed=" + ed;
|
||||
document.refreshCalendarEventsAjaxRequest
|
||||
= triggerAjaxRequest(url, refreshCalendarEventsCallback,
|
||||
{"startDate": sd, "endDate": ed});
|
||||
}
|
||||
|
||||
function refreshCalendarEventsCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
var data = http.responseText.evalJSON(true);
|
||||
// log("refresh calendar events: " + data.length);
|
||||
for (var i = 0; i < data.length; i++)
|
||||
drawCalendarEvent(data[i],
|
||||
http.callbackData["startDate"],
|
||||
http.callbackData["endDate"]);
|
||||
}
|
||||
else
|
||||
log("AJAX error when refreshing calendar events");
|
||||
}
|
||||
|
||||
function drawCalendarEvent(eventData, sd, ed) {
|
||||
var viewStartDate = sd.asDate();
|
||||
var viewEndDate = ed.asDate();
|
||||
|
||||
var startDate = new Date();
|
||||
startDate.setTime(eventData[4] * 1000);
|
||||
var endDate = new Date();
|
||||
endDate.setTime(eventData[5] * 1000);
|
||||
|
||||
var days = startDate.daysUpTo(endDate);
|
||||
|
||||
var divs = new Array();
|
||||
|
||||
var title = null;
|
||||
var startHour = null;
|
||||
var endHour = null;
|
||||
for (var i = 0; i < days.length; i++)
|
||||
if (days[i].earlierDate(viewStartDate) == viewStartDate
|
||||
&& days[i].laterDate(viewEndDate) == viewEndDate) {
|
||||
var starts;
|
||||
if (i == 0) {
|
||||
var quarters = (startDate.getHours() * 4
|
||||
+ Math.floor(startDate.getMinutes() / 15));
|
||||
starts = quarters;
|
||||
title = eventData[3];
|
||||
startHour = startDate.getDisplayHoursString();
|
||||
endHour = endDate.getDisplayHoursString();
|
||||
}
|
||||
else
|
||||
starts = 0;
|
||||
|
||||
var ends;
|
||||
var lasts;
|
||||
if (i == days.length - 1) {
|
||||
var quarters = (endDate.getHours() * 4
|
||||
+ Math.ceil(endDate.getMinutes() / 15));
|
||||
ends = quarters;
|
||||
}
|
||||
else
|
||||
ends = 96;
|
||||
lasts = ends - starts;
|
||||
|
||||
var parentDiv;
|
||||
if (currentView == "monthview") {
|
||||
var eventDiv = newCalendarDIV(eventData[0], eventData[1], starts, lasts,
|
||||
null, null, title);
|
||||
|
||||
var dayString = days[i].getDayString();
|
||||
var dayDivs = $("monthDaysView").childNodesWithTag("div");
|
||||
var j = 0;
|
||||
while (!parentDiv && j < dayDivs.length) {
|
||||
if (dayDivs[j].getAttribute("day") == dayString)
|
||||
parentDiv = dayDivs[j];
|
||||
else
|
||||
j++;
|
||||
}
|
||||
parentDiv.appendChild(eventDiv);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function newCalendarDIV(cname, owner, starts, lasts,
|
||||
startHour, endHour, title) {
|
||||
var eventDiv = document.createElement("div");
|
||||
eventDiv.cname = cname;
|
||||
eventDiv.owner = owner;
|
||||
eventDiv.addClassName("event");
|
||||
eventDiv.addClassName("starts" + starts);
|
||||
eventDiv.addClassName("lasts" + lasts);
|
||||
for (var i = 1; i < 5; i++) {
|
||||
var shadowDiv = document.createElement("div");
|
||||
eventDiv.appendChild(shadowDiv);
|
||||
shadowDiv.addClassName("shadow");
|
||||
shadowDiv.addClassName("shadow" + i);
|
||||
}
|
||||
var innerDiv = document.createElement("div");
|
||||
eventDiv.appendChild(innerDiv);
|
||||
innerDiv.addClassName("eventInside");
|
||||
innerDiv.addClassName("ownerIs" + owner);
|
||||
|
||||
var gradientDiv = document.createElement("div");
|
||||
innerDiv.appendChild(gradientDiv);
|
||||
gradientDiv.addClassName("gradient");
|
||||
var gradientImg = document.createElement("img");
|
||||
gradientDiv.appendChild(gradientImg);
|
||||
gradientImg.src = ResourcesURL + "/event-gradient.png";
|
||||
|
||||
var textDiv = document.createElement("div");
|
||||
innerDiv.appendChild(textDiv);
|
||||
textDiv.addClassName("text");
|
||||
if (startHour) {
|
||||
var headerSpan = document.createElement("span");
|
||||
textDiv.appendChild(headerSpan);
|
||||
headerSpan.addClassName("eventHeader");
|
||||
headerSpan.appendChild(document.createTextNode(startHour + " - "
|
||||
+ endHour));
|
||||
textDiv.appendChild(document.createElement("br"));
|
||||
}
|
||||
textDiv.appendChild(document.createTextNode(title));
|
||||
|
||||
Event.observe(eventDiv, "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(eventDiv, "click",
|
||||
onCalendarSelectEvent.bindAsEventListener(eventDiv));
|
||||
Event.observe(eventDiv, "dblclick",
|
||||
editDoubleClickedEvent.bindAsEventListener(eventDiv));
|
||||
|
||||
return eventDiv;
|
||||
}
|
||||
|
||||
function calendarDisplayCallback(http) {
|
||||
var div = $("calendarView");
|
||||
|
||||
|
@ -563,25 +728,32 @@ function calendarDisplayCallback(http) {
|
|||
scrollDayView(hour);
|
||||
contentView = $("daysView");
|
||||
}
|
||||
var events = document.getElementsByClassName("event", contentView);
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
Event.observe(events[i], "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(events[i], "click", onCalendarSelectEvent.bindAsEventListener(events[i]));
|
||||
Event.observe(events[i], "dblclick", displayEvent.bindAsEventListener(events[i]));
|
||||
}
|
||||
refreshCalendarEvents();
|
||||
var days = document.getElementsByClassName("day", contentView);
|
||||
if (currentView == "monthview")
|
||||
for (var i = 0; i < days.length; i++) {
|
||||
Event.observe(days[i], "click", onCalendarSelectDay.bindAsEventListener(days[i]));
|
||||
Event.observe(days[i], "dblclick", onClickableCellsDblClick.bindAsEventListener(days[i]));
|
||||
}
|
||||
else
|
||||
else {
|
||||
var headerDivs = $("calendarHeader").childNodesWithTag("div");
|
||||
var headerDaysLabels = document.getElementsByClassName("day", headerDivs[0]);
|
||||
var headerDays = document.getElementsByClassName("day", headerDivs[1]);
|
||||
for (var i = 0; i < days.length; i++) {
|
||||
Event.observe(days[i], "click", onCalendarSelectDay.bindAsEventListener(days[i]));
|
||||
headerDays[i].hour = "allday";
|
||||
Event.observe(headerDaysLabels[i], "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(headerDays[i], "click",
|
||||
onCalendarSelectDay.bindAsEventListener(days[i]));
|
||||
Event.observe(headerDays[i], "dblclick",
|
||||
onClickableCellsDblClick.bindAsEventListener(headerDays[i]));
|
||||
Event.observe(days[i], "click",
|
||||
onCalendarSelectDay.bindAsEventListener(days[i]));
|
||||
var clickableCells = document.getElementsByClassName("clickableHourCell",
|
||||
days[i]);
|
||||
for (var j = 0; j < clickableCells.length; j++)
|
||||
Event.observe(clickableCells[j], "dblclick", onClickableCellsDblClick.bindAsEventListener(clickableCells[j]));
|
||||
Event.observe(clickableCells[j], "dblclick",
|
||||
onClickableCellsDblClick.bindAsEventListener(clickableCells[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -730,8 +902,8 @@ function onListFilterChange() {
|
|||
function onEventClick(event) {
|
||||
var target = getTarget(event);
|
||||
var node = target.getParentWithTagName("tr");
|
||||
var day = node.getAttribute("day");
|
||||
var hour = node.getAttribute("hour");
|
||||
var day = node.day;
|
||||
var hour = node.hour;
|
||||
|
||||
changeCalendarDisplay( { "day": day, "hour": hour} );
|
||||
changeDateSelectorDisplay(day);
|
||||
|
@ -818,12 +990,11 @@ function onCalendarSelectEvent() {
|
|||
var list = $("eventsList");
|
||||
list.deselectAll();
|
||||
|
||||
var aptCName = this.getAttribute("aptCName");
|
||||
if (selectedCalendarCell)
|
||||
selectedCalendarCell.deselect();
|
||||
this.select();
|
||||
selectedCalendarCell = this;
|
||||
var row = $(aptCName);
|
||||
var row = $(this.cname);
|
||||
if (row) {
|
||||
var div = row.parentNode.parentNode.parentNode;
|
||||
div.scrollTop = row.offsetTop - (div.offsetHeight / 2);
|
||||
|
@ -834,7 +1005,7 @@ function onCalendarSelectEvent() {
|
|||
function onCalendarSelectDay(event) {
|
||||
var day;
|
||||
if (currentView == "multicolumndayview")
|
||||
day = this.parentNode.getAttribute("day");
|
||||
day = this.getAttribute("day");
|
||||
else
|
||||
day = this.getAttribute("day");
|
||||
var needRefresh = (listFilter == 'view_selectedday'
|
||||
|
@ -857,12 +1028,21 @@ function onCalendarSelectDay(event) {
|
|||
|
||||
function changeWeekCalendarDisplayOfSelectedDay(node) {
|
||||
var days = document.getElementsByClassName("day", node.parentNode);
|
||||
var headerDiv = $("calendarHeader").childNodesWithTag("div")[1];
|
||||
var headerDays = document.getElementsByClassName("day", headerDiv);
|
||||
|
||||
// log ("days: " + days.length + "; headerDays: " + headerDays.length);
|
||||
for (var i = 0; i < days.length; i++)
|
||||
if (days[i] != node)
|
||||
if (days[i] != node) {
|
||||
// log("unselect day : " + i);
|
||||
headerDays[i].removeClassName("selectedDay");
|
||||
days[i].removeClassName("selectedDay");
|
||||
|
||||
node.addClassName("selectedDay");
|
||||
}
|
||||
else {
|
||||
// log("selected day : " + i);
|
||||
headerDays[i].addClassName("selectedDay");
|
||||
days[i].addClassName("selectedDay");
|
||||
}
|
||||
}
|
||||
|
||||
function findMonthCalendarSelectedCell(daysContainer) {
|
||||
|
@ -904,7 +1084,7 @@ function updateTaskStatus(event) {
|
|||
var newStatus = (this.checked ? 1 : 0);
|
||||
var http = createHTTPClient();
|
||||
|
||||
log("update task status: " + taskId + " to " + this.checked);
|
||||
// log("update task status: " + taskId + " to " + this.checked);
|
||||
event.cancelBubble = true;
|
||||
|
||||
url = (UserFolderURL + "../" + taskOwner
|
||||
|
@ -975,7 +1155,7 @@ function calendarStatusCallback(http) {
|
|||
http.status == 1223) {
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDispla4y();
|
||||
changeCalendarDisplay();
|
||||
}
|
||||
else {
|
||||
var folder = $(http.callbackData);
|
||||
|
|
|
@ -181,7 +181,7 @@ function endDayAsShortString() {
|
|||
return $('endTime_date').valueAsShortDateString();
|
||||
}
|
||||
|
||||
this._getDate = function(which) {
|
||||
function _getDate(which) {
|
||||
var date = window.timeWidgets[which]['date'].valueAsDate();
|
||||
date.setHours( window.timeWidgets[which]['hour'].value );
|
||||
date.setMinutes( window.timeWidgets[which]['minute'].value );
|
||||
|
@ -189,7 +189,7 @@ this._getDate = function(which) {
|
|||
return date;
|
||||
}
|
||||
|
||||
this._getShadowDate = function(which) {
|
||||
function _getShadowDate(which) {
|
||||
var date = window.timeWidgets[which]['date'].getAttribute("shadow-value").asDate();
|
||||
var intValue = parseInt(window.timeWidgets[which]['hour'].getAttribute("shadow-value"));
|
||||
date.setHours(intValue);
|
||||
|
@ -200,23 +200,23 @@ this._getShadowDate = function(which) {
|
|||
return date;
|
||||
}
|
||||
|
||||
this.getStartDate = function() {
|
||||
function getStartDate() {
|
||||
return this._getDate('start');
|
||||
}
|
||||
|
||||
this.getEndDate = function() {
|
||||
function getEndDate() {
|
||||
return this._getDate('end');
|
||||
}
|
||||
|
||||
this.getShadowStartDate = function() {
|
||||
function getShadowStartDate() {
|
||||
return this._getShadowDate('start');
|
||||
}
|
||||
|
||||
this.getShadowEndDate = function() {
|
||||
function getShadowEndDate() {
|
||||
return this._getShadowDate('end');
|
||||
}
|
||||
|
||||
this._setDate = function(which, newDate) {
|
||||
function _setDate(which, newDate) {
|
||||
window.timeWidgets[which]['date'].setValueAsDate(newDate);
|
||||
window.timeWidgets[which]['hour'].value = newDate.getHours();
|
||||
var minutes = newDate.getMinutes();
|
||||
|
@ -225,16 +225,16 @@ this._setDate = function(which, newDate) {
|
|||
window.timeWidgets[which]['minute'].value = minutes;
|
||||
}
|
||||
|
||||
this.setStartDate = function(newStartDate) {
|
||||
function setStartDate(newStartDate) {
|
||||
this._setDate('start', newStartDate);
|
||||
}
|
||||
|
||||
this.setEndDate = function(newEndDate) {
|
||||
function setEndDate(newEndDate) {
|
||||
// window.alert(newEndDate);
|
||||
this._setDate('end', newEndDate);
|
||||
}
|
||||
|
||||
this.onAdjustEndTime = function(event) {
|
||||
function onAdjustEndTime(event) {
|
||||
var dateDelta = (window.getStartDate().valueOf()
|
||||
- window.getShadowStartDate().valueOf());
|
||||
// window.alert(window.getEndDate().valueOf() + ' ' + dateDelta);
|
||||
|
@ -245,10 +245,39 @@ this.onAdjustEndTime = function(event) {
|
|||
window.timeWidgets['start']['minute'].updateShadowValue();
|
||||
}
|
||||
|
||||
this.initTimeWidgets = function (widgets) {
|
||||
function onAllDayChanged(event) {
|
||||
for (var type in window.timeWidgets) {
|
||||
window.timeWidgets[type]['hour'].disabled = this.checked;
|
||||
window.timeWidgets[type]['minute'].disabled = this.checked;
|
||||
}
|
||||
}
|
||||
|
||||
function initTimeWidgets(widgets) {
|
||||
this.timeWidgets = widgets;
|
||||
|
||||
Event.observe(widgets['start']['date'], "change", this.onAdjustEndTime, false);
|
||||
Event.observe(widgets['start']['hour'], "change", this.onAdjustEndTime, false);
|
||||
Event.observe(widgets['start']['minute'], "change", this.onAdjustEndTime, false);
|
||||
|
||||
var allDayLabel = $("allDay");
|
||||
var input = $(allDayLabel).childNodesWithTag("input")[0];
|
||||
Event.observe(input, "change", onAllDayChanged.bindAsEventListener(input));
|
||||
if (input.checked) {
|
||||
for (var type in widgets) {
|
||||
widgets[type]['hour'].disabled = true;
|
||||
widgets[type]['minute'].disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onAppointmentEditorLoad() {
|
||||
var widgets = {'start': {'date': $("startTime_date"),
|
||||
'hour': $("startTime_time_hour"),
|
||||
'minute': $("startTime_time_minute")},
|
||||
'end': {'date': $("endTime_date"),
|
||||
'hour': $("endTime_time_hour"),
|
||||
'minute': $("endTime_time_minute")}};
|
||||
initTimeWidgets(widgets);
|
||||
}
|
||||
|
||||
addEvent(window, 'load', onAppointmentEditorLoad);
|
||||
|
|
|
@ -56,10 +56,12 @@ LABEL
|
|||
TABLE
|
||||
{ display: block;
|
||||
table-layout: fixed;
|
||||
border-spacing: 0px;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
border: 0px; }
|
||||
border-spacing: 0px; }
|
||||
|
||||
TABLE TD
|
||||
{ white-space: nowrap;
|
||||
padding-left: .25em;
|
||||
padding-right: .25em; }
|
||||
|
||||
a:link
|
||||
{ color: #0033CC; }
|
||||
|
@ -441,11 +443,15 @@ TR.tableview TD
|
|||
padding-left: .3em;
|
||||
padding-right: .3em; }
|
||||
|
||||
TR.tableview TD.headerDateTime
|
||||
{ width: 18em; }
|
||||
TD.headerDateTime
|
||||
{ width: 30em;
|
||||
min-width: 30em; }
|
||||
|
||||
TR.tableview TD.headerLocation
|
||||
{ width: 10em; }
|
||||
TD.headerTitle
|
||||
{ width: 30%; }
|
||||
|
||||
TD.headerLocation
|
||||
{ min-width: 20em; }
|
||||
|
||||
td img.tbtv_sortcell
|
||||
{ float: right;
|
||||
|
|
Loading…
Reference in a new issue