mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 04:15:26 +00:00
Monotone-Parent: 630c66b7e6178f9769bc0e36ab044c68a2082b30
Monotone-Revision: c76b5a64aa06e12f5edf8a0d9ab1e361cda9bca9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-02T19:24:49 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -106,6 +106,8 @@
|
||||
|
||||
- (NSArray *) fetchAllSOGoAppointments;
|
||||
|
||||
- (NSArray *) calendarFoldersInContext: (WOContext *) context;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Appointments_SOGoAppointmentFolder_H__ */
|
||||
|
||||
@@ -72,7 +72,7 @@ static NSNumber *sharedYes = nil;
|
||||
NSStringFromClass([self superclass]), [super version]);
|
||||
|
||||
lm = [NGLoggerManager defaultLoggerManager];
|
||||
logger = [lm loggerForDefaultKey:@"SOGoAppointmentFolderDebugEnabled"];
|
||||
logger = [lm loggerForDefaultKey: @"SOGoAppointmentFolderDebugEnabled"];
|
||||
|
||||
// securityInfo = [self soClassSecurityInfo];
|
||||
// [securityInfo declareRole: SOGoRole_Delegate
|
||||
@@ -221,7 +221,8 @@ static NSNumber *sharedYes = nil;
|
||||
|
||||
filters = [NSMutableArray new];
|
||||
|
||||
children = [[parentNode getElementsByTagName: @"comp-filter"] objectEnumerator];
|
||||
children = [[parentNode getElementsByTagName: @"comp-filter"]
|
||||
objectEnumerator];
|
||||
node = [children nextObject];
|
||||
while (node)
|
||||
{
|
||||
@@ -443,7 +444,7 @@ static NSNumber *sharedYes = nil;
|
||||
}
|
||||
|
||||
if (nameFields == nil)
|
||||
nameFields = [[NSArray alloc] initWithObjects:@"c_name", nil];
|
||||
nameFields = [[NSArray alloc] initWithObjects: @"c_name", nil];
|
||||
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _u];
|
||||
records = [_f fetchFields: nameFields matchingQualifier: qualifier];
|
||||
@@ -1133,6 +1134,68 @@ static NSNumber *sharedYes = nil;
|
||||
return events;
|
||||
}
|
||||
|
||||
#warning We only support ONE calendar per user at this time
|
||||
- (BOOL) _appendSubscribedFolders: (NSDictionary *) subscribedFolders
|
||||
toFolderList: (NSMutableArray *) calendarFolders
|
||||
{
|
||||
NSEnumerator *keys;
|
||||
NSString *currentKey;
|
||||
NSMutableDictionary *currentCalendar;
|
||||
BOOL firstShouldBeActive;
|
||||
unsigned int count;
|
||||
|
||||
firstShouldBeActive = YES;
|
||||
|
||||
keys = [[subscribedFolders allKeys] objectEnumerator];
|
||||
currentKey = [keys nextObject];
|
||||
count = 1;
|
||||
while (currentKey)
|
||||
{
|
||||
currentCalendar = [NSMutableDictionary new];
|
||||
[currentCalendar autorelease];
|
||||
[currentCalendar
|
||||
setDictionary: [subscribedFolders objectForKey: currentKey]];
|
||||
[currentCalendar setObject: currentKey forKey: @"folder"];
|
||||
[calendarFolders addObject: currentCalendar];
|
||||
if ([[currentCalendar objectForKey: @"active"] boolValue])
|
||||
firstShouldBeActive = NO;
|
||||
count++;
|
||||
currentKey = [keys nextObject];
|
||||
}
|
||||
|
||||
return firstShouldBeActive;
|
||||
}
|
||||
|
||||
- (NSArray *) calendarFoldersInContext: (WOContext *) context
|
||||
{
|
||||
NSMutableDictionary *userCalendar, *calendarDict;
|
||||
NSMutableArray *calendarFolders;
|
||||
SOGoUser *activeUser;
|
||||
BOOL firstActive;
|
||||
|
||||
calendarFolders = [NSMutableArray new];
|
||||
[calendarFolders autorelease];
|
||||
|
||||
activeUser = [context activeUser];
|
||||
|
||||
userCalendar = [NSMutableDictionary new];
|
||||
[userCalendar autorelease];
|
||||
[userCalendar setObject: @"/" forKey: @"folder"];
|
||||
[userCalendar setObject: @"Calendar" forKey: @"displayName"];
|
||||
[calendarFolders addObject: userCalendar];
|
||||
|
||||
calendarDict = [[activeUser userSettings] objectForKey: @"Calendar"];
|
||||
firstActive = [[calendarDict objectForKey: @"activateUserFolder"] boolValue];
|
||||
firstActive = ([self _appendSubscribedFolders:
|
||||
[calendarDict objectForKey: @"SubscribedFolders"]
|
||||
toFolderList: calendarFolders]
|
||||
|| firstActive);
|
||||
[userCalendar setObject: [NSNumber numberWithBool: firstActive]
|
||||
forKey: @"active"];
|
||||
|
||||
return calendarFolders;
|
||||
}
|
||||
|
||||
/* folder type */
|
||||
|
||||
- (NSString *) folderType
|
||||
|
||||
+46
-46
@@ -12,18 +12,23 @@
|
||||
a SOPE clientObject (which usually is an SOGoAppointmentFolder).
|
||||
*/
|
||||
|
||||
@class NSString, NSArray, NSDictionary, NSMutableDictionary, NSCalendarDate, SOGoAptFormatter;
|
||||
@class NSArray;
|
||||
@class NSCalendarDate;
|
||||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
@class NSString;
|
||||
|
||||
@class SOGoAptFormatter;
|
||||
@class SOGoAppointmentFolder;
|
||||
|
||||
@interface UIxCalView : UIxComponent
|
||||
{
|
||||
NSArray *appointments;
|
||||
NSMutableArray *calendarFolders;
|
||||
NSArray *appointments;
|
||||
NSMutableDictionary *componentsData;
|
||||
NSArray *tasks;
|
||||
NSArray *allDayApts;
|
||||
id appointment;
|
||||
NSCalendarDate *currentDay;
|
||||
NSArray *tasks;
|
||||
NSArray *allDayApts;
|
||||
id appointment;
|
||||
NSCalendarDate *currentDay;
|
||||
SOGoAptFormatter *aptFormatter;
|
||||
SOGoAptFormatter *aptTooltipFormatter;
|
||||
SOGoAptFormatter *privateAptFormatter;
|
||||
@@ -36,10 +41,9 @@
|
||||
} aptFlags;
|
||||
}
|
||||
|
||||
|
||||
/* config */
|
||||
|
||||
- (void)configureFormatters;
|
||||
- (void) configureFormatters;
|
||||
|
||||
/* accessors */
|
||||
|
||||
@@ -49,64 +53,60 @@
|
||||
- (void) setTasks: (NSArray *) _tasks;
|
||||
- (NSArray *) tasks;
|
||||
|
||||
- (NSArray *)allDayApts;
|
||||
- (id)appointment;
|
||||
- (BOOL)isMyApt;
|
||||
- (BOOL)canAccessApt; /* protection */
|
||||
- (NSArray *) allDayApts;
|
||||
- (id) appointment;
|
||||
- (BOOL) isMyApt;
|
||||
- (BOOL) canAccessApt; /* protection */
|
||||
|
||||
- (BOOL)hasDayInfo;
|
||||
- (BOOL)hasHoldidayInfo;
|
||||
- (BOOL)hasAllDayApts;
|
||||
- (BOOL) hasDayInfo;
|
||||
- (BOOL) hasHoldidayInfo;
|
||||
- (BOOL) hasAllDayApts;
|
||||
|
||||
- (NSDictionary *)aptTypeDict;
|
||||
- (NSString *)aptTypeLabel;
|
||||
- (NSString *)aptTypeIcon;
|
||||
- (SOGoAptFormatter *)aptFormatter;
|
||||
- (NSDictionary *) aptTypeDict;
|
||||
- (NSString *) aptTypeLabel;
|
||||
- (NSString *) aptTypeIcon;
|
||||
- (SOGoAptFormatter *) aptFormatter;
|
||||
|
||||
- (NSString *)shortTextForApt;
|
||||
- (NSString *)shortTitleForApt;
|
||||
- (NSString *)tooltipForApt;
|
||||
- (NSString *)appointmentViewURL;
|
||||
- (NSString *) shortTextForApt;
|
||||
- (NSString *) shortTitleForApt;
|
||||
- (NSString *) tooltipForApt;
|
||||
- (NSString *) appointmentViewURL;
|
||||
|
||||
- (id)holidayInfo;
|
||||
- (id) holidayInfo;
|
||||
|
||||
/* related to current day */
|
||||
- (void)setCurrentDay:(NSCalendarDate *)_day;
|
||||
- (NSCalendarDate *)currentDay;
|
||||
- (NSString *)currentDayName; /* localized */
|
||||
- (void) setCurrentDay: (NSCalendarDate *) _day;
|
||||
- (NSCalendarDate *) currentDay;
|
||||
- (NSString *) currentDayName; /* localized */
|
||||
|
||||
/* defaults */
|
||||
- (BOOL)showFullNames;
|
||||
- (BOOL)showAMPMDates;
|
||||
- (unsigned)dayStartHour;
|
||||
- (unsigned)dayEndHour;
|
||||
- (BOOL)shouldDisplayWeekend;
|
||||
- (BOOL)shouldDisplayRejectedAppointments;
|
||||
- (BOOL) showFullNames;
|
||||
- (BOOL) showAMPMDates;
|
||||
- (unsigned) dayStartHour;
|
||||
- (unsigned) dayEndHour;
|
||||
- (BOOL) shouldDisplayWeekend;
|
||||
- (BOOL) shouldDisplayRejectedAppointments;
|
||||
|
||||
- (NSCalendarDate *)referenceDateForFormatter;
|
||||
- (NSCalendarDate *) referenceDateForFormatter;
|
||||
|
||||
- (NSCalendarDate *)thisMonth;
|
||||
- (NSCalendarDate *)nextMonth;
|
||||
- (NSCalendarDate *) thisMonth;
|
||||
- (NSCalendarDate *) nextMonth;
|
||||
|
||||
/* fetching */
|
||||
|
||||
- (NSCalendarDate *)startDate;
|
||||
- (NSCalendarDate *)endDate;
|
||||
- (NSCalendarDate *) startDate;
|
||||
- (NSCalendarDate *) endDate;
|
||||
- (NSArray *) fetchCoreAppointmentsInfos;
|
||||
- (NSArray *) fetchCoreTasksInfos;
|
||||
|
||||
/* date selection */
|
||||
|
||||
- (NSDictionary *)todayQueryParameters;
|
||||
- (NSDictionary *)currentDayQueryParameters;
|
||||
|
||||
/* calendarUIDs */
|
||||
|
||||
- (NSString *)formattedCalendarUIDs;
|
||||
- (NSDictionary *) todayQueryParameters;
|
||||
- (NSDictionary *) currentDayQueryParameters;
|
||||
|
||||
/* CSS related */
|
||||
|
||||
- (NSString *)aptStyle;
|
||||
- (NSString *) aptStyle;
|
||||
|
||||
/* protected methods */
|
||||
- (NSDictionary *) _dateQueryParametersWithOffset: (int) daysOffset;
|
||||
|
||||
@@ -56,7 +56,6 @@ static BOOL shouldDisplayWeekend = NO;
|
||||
= [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz];
|
||||
[self configureFormatters];
|
||||
componentsData = [NSMutableDictionary new];
|
||||
calendarFolders = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -64,15 +63,14 @@ static BOOL shouldDisplayWeekend = NO;
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[calendarFolders release];
|
||||
[componentsData release];
|
||||
[appointments release];
|
||||
[allDayApts release];
|
||||
[appointment release];
|
||||
[currentDay release];
|
||||
[aptFormatter release];
|
||||
[aptTooltipFormatter release];
|
||||
[privateAptFormatter release];
|
||||
[appointments release];
|
||||
[allDayApts release];
|
||||
[appointment release];
|
||||
[currentDay release];
|
||||
[aptFormatter release];
|
||||
[aptTooltipFormatter release];
|
||||
[privateAptFormatter release];
|
||||
[privateAptTooltipFormatter release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -449,62 +447,6 @@ static BOOL shouldDisplayWeekend = NO;
|
||||
return [[self startDate] tomorrow];
|
||||
}
|
||||
|
||||
#warning We only support ONE calendar per user at this time
|
||||
- (BOOL) _appendSubscribedFolders: (NSDictionary *) subscribedFolders
|
||||
{
|
||||
NSEnumerator *keys;
|
||||
NSString *currentKey;
|
||||
NSMutableDictionary *currentCalendar;
|
||||
BOOL firstShouldBeActive;
|
||||
unsigned int count;
|
||||
|
||||
firstShouldBeActive = YES;
|
||||
|
||||
keys = [[subscribedFolders allKeys] objectEnumerator];
|
||||
currentKey = [keys nextObject];
|
||||
count = 1;
|
||||
while (currentKey)
|
||||
{
|
||||
currentCalendar = [NSMutableDictionary new];
|
||||
[currentCalendar autorelease];
|
||||
[currentCalendar
|
||||
setDictionary: [subscribedFolders objectForKey: currentKey]];
|
||||
[currentCalendar setObject: currentKey forKey: @"folder"];
|
||||
[calendarFolders addObject: currentCalendar];
|
||||
if ([[currentCalendar objectForKey: @"active"] boolValue])
|
||||
firstShouldBeActive = NO;
|
||||
count++;
|
||||
currentKey = [keys nextObject];
|
||||
}
|
||||
|
||||
return firstShouldBeActive;
|
||||
}
|
||||
|
||||
- (void) _setupCalendarFolders
|
||||
{
|
||||
NSMutableDictionary *userCalendar, *calendarDict;
|
||||
SOGoUser *activeUser;
|
||||
BOOL firstActive;
|
||||
|
||||
calendarFolders = [NSMutableArray new];
|
||||
activeUser = [context activeUser];
|
||||
|
||||
userCalendar = [NSMutableDictionary new];
|
||||
[userCalendar autorelease];
|
||||
[userCalendar setObject: @"/" forKey: @"folder"];
|
||||
[userCalendar setObject: [self labelForKey: @"Calendar"]
|
||||
forKey: @"displayName"];
|
||||
[calendarFolders addObject: userCalendar];
|
||||
|
||||
calendarDict = [[activeUser userSettings] objectForKey: @"Calendar"];
|
||||
firstActive = [[calendarDict objectForKey: @"activateUserFolder"] boolValue];
|
||||
firstActive = ([self _appendSubscribedFolders:
|
||||
[calendarDict objectForKey: @"SubscribedFolders"]]
|
||||
|| firstActive);
|
||||
[userCalendar setObject: [NSNumber numberWithBool: firstActive]
|
||||
forKey: @"active"];
|
||||
}
|
||||
|
||||
- (SOGoAppointmentFolder *) _aptFolder: (NSString *) folder
|
||||
withClientObject: (SOGoAppointmentFolder *) clientObject
|
||||
{
|
||||
@@ -524,14 +466,6 @@ static BOOL shouldDisplayWeekend = NO;
|
||||
return aptFolder;
|
||||
}
|
||||
|
||||
- (NSArray *) calendarFolders
|
||||
{
|
||||
if (!calendarFolders)
|
||||
[self _setupCalendarFolders];
|
||||
|
||||
return calendarFolders;
|
||||
}
|
||||
|
||||
- (NSArray *) _activeCalendarFolders
|
||||
{
|
||||
NSMutableArray *activeFolders;
|
||||
@@ -542,12 +476,10 @@ static BOOL shouldDisplayWeekend = NO;
|
||||
activeFolders = [NSMutableArray new];
|
||||
[activeFolders autorelease];
|
||||
|
||||
if (!calendarFolders)
|
||||
[self _setupCalendarFolders];
|
||||
|
||||
clientObject = [self clientObject];
|
||||
|
||||
folders = [calendarFolders objectEnumerator];
|
||||
folders = [[clientObject calendarFoldersInContext: context]
|
||||
objectEnumerator];
|
||||
currentFolderDict = [folders nextObject];
|
||||
while (currentFolderDict)
|
||||
{
|
||||
@@ -662,14 +594,6 @@ static BOOL shouldDisplayWeekend = NO;
|
||||
return [self queryParametersBySettingSelectedDate: currentDay];
|
||||
}
|
||||
|
||||
/* calendarUIDs */
|
||||
|
||||
- (NSString *) formattedCalendarUIDs
|
||||
{
|
||||
return [[[self clientObject] calendarUIDs]
|
||||
componentsJoinedByString: @", "];
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
|
||||
- (NSString *) _userFolderURI
|
||||
|
||||
Reference in New Issue
Block a user