mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 00:45:09 +00:00
Monotone-Parent: 2fdf0ead0781ef2362dd389811d5db44ca4cc84a
Monotone-Revision: c91eef7edcfd08d414664c25a590b6268a7e58e2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-29T04:19:32 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
@@ -32,8 +31,10 @@
|
||||
#import <NGCards/iCalFreeBusy.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/SOGoDomainDefaults.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
|
||||
#import "SOGoAppointmentFolder.h"
|
||||
@@ -41,9 +42,6 @@
|
||||
|
||||
#import "SOGoFreeBusyObject.h"
|
||||
|
||||
static unsigned int freebusyRangeStart = 0;
|
||||
static unsigned int freebusyRangeEnd = 0;
|
||||
|
||||
@interface SOGoFreeBusyObject (PrivateAPI)
|
||||
- (NSString *) iCalStringForFreeBusyInfos: (NSArray *) _infos
|
||||
from: (NSCalendarDate *) _startDate
|
||||
@@ -52,25 +50,6 @@ static unsigned int freebusyRangeEnd = 0;
|
||||
|
||||
@implementation SOGoFreeBusyObject
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSArray *freebusyDateRange;
|
||||
NSUserDefaults *ud;
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
freebusyDateRange = [ud arrayForKey: @"SOGoFreeBusyDefaultInterval"];
|
||||
if (freebusyDateRange && [freebusyDateRange count] > 1)
|
||||
{
|
||||
freebusyRangeStart = [[freebusyDateRange objectAtIndex: 0] unsignedIntValue];
|
||||
freebusyRangeEnd = [[freebusyDateRange objectAtIndex: 1] unsignedIntValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
freebusyRangeStart = 7;
|
||||
freebusyRangeEnd = 7;
|
||||
}
|
||||
}
|
||||
|
||||
- (iCalPerson *) iCalPersonWithUID: (NSString *) uid
|
||||
{
|
||||
iCalPerson *person;
|
||||
@@ -202,15 +181,31 @@ static unsigned int freebusyRangeEnd = 0;
|
||||
- (NSString *) contentAsString
|
||||
{
|
||||
NSCalendarDate *today, *startDate, *endDate;
|
||||
NSTimeZone *timeZone;
|
||||
SOGoUserDefaults *ud;
|
||||
SOGoDomainDefaults *dd;
|
||||
NSArray *interval;
|
||||
unsigned int start, end;
|
||||
|
||||
today = [[NSCalendarDate calendarDate] beginOfDay];
|
||||
timeZone = [[context activeUser] timeZone];
|
||||
[today setTimeZone: timeZone];
|
||||
ud = [[context activeUser] userDefaults];
|
||||
[today setTimeZone: [ud timeZone]];
|
||||
|
||||
startDate = [today dateByAddingYears: 0 months: 0 days: -freebusyRangeStart
|
||||
dd = [[context activeUser] domainDefaults];
|
||||
interval = [dd freeBusyDefaultInterval];
|
||||
if ([interval count] > 1)
|
||||
{
|
||||
start = [[interval objectAtIndex: 0] unsignedIntValue];
|
||||
end = [[interval objectAtIndex: 1] unsignedIntValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
start = 7;
|
||||
end = 7;
|
||||
}
|
||||
|
||||
startDate = [today dateByAddingYears: 0 months: 0 days: -start
|
||||
hours: 0 minutes: 0 seconds: 0];
|
||||
endDate = [today dateByAddingYears: 0 months: 0 days: freebusyRangeEnd
|
||||
endDate = [today dateByAddingYears: 0 months: 0 days: end
|
||||
hours: 0 minutes: 0 seconds: 0];
|
||||
|
||||
return [self contentAsStringFrom: startDate to: endDate];
|
||||
@@ -278,7 +273,7 @@ static unsigned int freebusyRangeEnd = 0;
|
||||
- (id) GETAction: (id)_ctx
|
||||
{
|
||||
WOResponse *r;
|
||||
NSData *contentData;
|
||||
NSData *contentData;
|
||||
|
||||
contentData = [[self contentAsString]
|
||||
dataUsingEncoding: NSUTF8StringEncoding];
|
||||
|
||||
Reference in New Issue
Block a user