Monotone-Parent: 49976b1102a1a35107c285adb4e08d81c27bd01d

Monotone-Revision: 9b75ae77fd7075044530ae0ea50973abd83dd51c

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-06-09T12:49:57
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-06-09 12:49:57 +00:00
parent fe2ab6e9b6
commit 17389d874e
3 changed files with 81 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2010-06-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolderObject.m
(-_folderCalendars): we now fetch the records only covering the
value of SOGoDAVCalendarStartTimeLimit in days with the current
date as the middle of the time range.
2010-06-08 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-06-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/UIxAttendeesEditor.js * UI/WebServerResources/UIxAttendeesEditor.js

View File

@ -30,6 +30,7 @@
@interface SOGoAppointmentFolderObject : SOGoObject @interface SOGoAppointmentFolderObject : SOGoObject
{ {
SOGoAppointmentFolder *folder; SOGoAppointmentFolder *folder;
int davTimeHalfLimitSeconds;
} }
- (iCalCalendar *) contentCalendar; - (iCalCalendar *) contentCalendar;

View File

@ -21,27 +21,51 @@
*/ */
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDictionary.h> #import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <NGObjWeb/WOContext.h> #import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WOResponse.h> #import <NGObjWeb/WOResponse.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGCards/iCalCalendar.h> #import <NGCards/iCalCalendar.h>
#import <NGCards/iCalTimeZone.h> #import <NGCards/iCalTimeZone.h>
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoUser.h>
#import "SOGoAppointmentFolder.h" #import "SOGoAppointmentFolder.h"
#import "SOGoCalendarComponent.h" #import "SOGoCalendarComponent.h"
#import "SOGoAppointmentFolderObject.h" #import "SOGoAppointmentFolderObject.h"
static NSArray *contentFields = nil;
@implementation SOGoAppointmentFolderObject @implementation SOGoAppointmentFolderObject
+ (void) initialize
{
if (!contentFields)
contentFields = [[NSArray alloc] initWithObjects: @"c_name", @"c_version",
@"c_lastmodified", @"c_creationdate",
@"c_component", nil];
}
- (id) init - (id) init
{ {
int davCalendarStartTimeLimit;
SOGoUser *user;
if ((self = [super init])) if ((self = [super init]))
{ {
folder = nil; folder = nil;
user = [context activeUser];
davCalendarStartTimeLimit
= [[user domainDefaults] davCalendarStartTimeLimit];
/* 43200 = 60 * 60 * 24 / 2 */
davTimeHalfLimitSeconds = davCalendarStartTimeLimit * 43200;
} }
return self; return self;
@ -118,23 +142,63 @@
} }
} }
- (NSArray *) _fetchFolderRecords
{
NSCalendarDate *start, *end;
if (davTimeHalfLimitSeconds)
{
start = [[NSCalendarDate date] addYear: 0
month: 0
day: 0
hour: 0
minute: 0
second: -davTimeHalfLimitSeconds];
end = [start addYear: 0
month: 0
day: 0
hour: 0
minute: 0
second: (2 * davTimeHalfLimitSeconds)];
}
else
{
start = nil;
end = nil;
}
return [[self _folder] bareFetchFields: contentFields
from: start
to: end
title: nil
component: nil
additionalFilters: nil];
}
- (NSArray *) _folderCalendars - (NSArray *) _folderCalendars
{ {
NSArray *names; NSArray *records;
int count, max;
SOGoCalendarComponent *component;
NSMutableArray *calendars; NSMutableArray *calendars;
SOGoCalendarComponent *component;
int count, max;
iCalCalendar *calendar;
NSString *name;
names = [[self _folder] toOneRelationshipKeys]; records = [self _fetchFolderRecords];
max = [names count]; max = [records count];
calendars = [NSMutableArray arrayWithCapacity: max]; calendars = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
{ {
component = [folder lookupName: [names objectAtIndex: count] name = [[records objectAtIndex: count] objectForKey: @"c_name"];
component = [folder lookupName: name
inContext: context inContext: context
acquire: NO]; acquire: NO];
[calendars addObject: [component calendar: NO secure: YES]]; calendar = [component calendar: NO secure: !activeUserIsOwner];
if (calendar)
[calendars addObject: calendar];
else
[self errorWithFormat: @"record with c_name '%@' should obviously not"
@" be listed here", name];
} }
return calendars; return calendars;