1 /* UIxFreeBusyUserSelector.m - this file is part of SOGo
3 * Copyright (C) 2006 Inverse groupe conseil
5 * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This file is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #import <Foundation/NSArray.h>
24 #import <Foundation/NSValue.h>
26 #import <NGCards/iCalPerson.h>
27 #import <NGObjWeb/WORequest.h>
29 #import <SoObjects/SOGo/AgenorUserManager.h>
31 #import "UIxComponent+Agenor.h"
32 #import "UIxFreeBusyUserSelector.h"
34 @implementation UIxFreeBusyUserSelector
38 if ((self = [super init]))
42 dayStartHour = [NSNumber numberWithInt: 8];
43 [dayStartHour retain];
44 dayEndHour = [NSNumber numberWithInt: 18];
55 [dayStartHour release];
64 - (void) setStartDate: (NSCalendarDate *) newStartDate
66 startDate = newStartDate;
69 - (NSCalendarDate *) startDate
74 - (void) setEndDate: (NSCalendarDate *) newEndDate
79 - (NSCalendarDate *) endDate
84 - (void) setDayStartHour: (NSNumber *) newDayStartHour
86 ASSIGN (dayStartHour, newDayStartHour);
89 - (NSNumber *) dayStartHour
94 - (void) setDayEndHour: (NSNumber *) newDayEndHour
96 ASSIGN (dayEndHour, newDayEndHour);
99 - (NSNumber *) dayEndHour
104 - (void) setSelectorId: (NSString *) newSelectorId
106 ASSIGN (selectorId, newSelectorId);
109 - (NSString *) selectorId
114 - (void) setContacts: (NSArray *) newContacts
116 ASSIGN (contacts, newContacts);
119 - (NSArray *) contacts
125 - (void) takeValuesFromRequest: (WORequest *) request
126 inContext: (WOContext *) context
128 NSArray *newContacts;
131 = [self getICalPersonsFromValue: [request formValueForKey: selectorId]];
132 ASSIGN (contacts, newContacts);
133 if ([contacts count] > 0)
134 NSLog (@"got %i attendees: %@", [contacts count], contacts);
136 NSLog (@"got no attendees!");
139 /* in-template operations */
140 - (NSString *) initialContactsAsString
142 NSEnumerator *persons;
144 NSMutableArray *participants;
146 participants = [NSMutableArray arrayWithCapacity: [contacts count]];
147 persons = [contacts objectEnumerator];
148 person = [persons nextObject];
151 [participants addObject: [person cn]];
152 person = [persons nextObject];
155 return [participants componentsJoinedByString: @","];
158 - (NSString *) freeBusyViewId
160 return [NSString stringWithFormat: @"parentOf%@", [selectorId capitalizedString]];