Monotone-Parent: 43cd41a2542f12c74dd75ec0771fabe3a296d2ce
Monotone-Revision: 5de6813223eb9a48072c97c7a682bcf2e4ed8d2f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-19T14:34:42 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
ec9313bd72
commit
e9b4f04d1f
|
@ -32,8 +32,6 @@ SchedulerUI_OBJC_FILES = \
|
|||
\
|
||||
UIxAttendeesEditor.m \
|
||||
UIxComponentEditor.m \
|
||||
UIxFreeBusyUserSelector.m \
|
||||
UIxFreeBusyUserSelectorTable.m \
|
||||
UIxAppointmentView.m \
|
||||
UIxAppointmentEditor.m \
|
||||
UIxAppointmentProposal.m \
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/* UIxFreeBusyUserSelector.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef UIXFREEBUSYUSERSELECTOR_H
|
||||
#define UIXFREEBUSYUSERSELECTOR_H
|
||||
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSCalendarDate;
|
||||
@class NSNumber;
|
||||
@class iCalPerson;
|
||||
|
||||
@interface UIxFreeBusyUserSelector : UIxComponent
|
||||
{
|
||||
NSCalendarDate *startDate;
|
||||
NSCalendarDate *endDate;
|
||||
NSNumber *dayStartHour;
|
||||
NSNumber *dayEndHour;
|
||||
|
||||
NSArray *contacts;
|
||||
|
||||
NSString *selectorId;
|
||||
}
|
||||
|
||||
- (void) setStartDate: (NSCalendarDate *) newStartDate;
|
||||
- (void) setEndDate: (NSCalendarDate *) newEndDate;
|
||||
|
||||
- (void) setDayStartHour: (NSNumber *) newDayStartHour;
|
||||
- (NSNumber *) dayStartHour;
|
||||
- (void) setDayEndHour: (NSNumber *) newDayEndHour;
|
||||
- (NSNumber *) dayEndHour;
|
||||
|
||||
- (void) setContacts: (NSArray *) contacts;
|
||||
- (NSArray *) contacts;
|
||||
|
||||
- (void) setSelectorId: (NSString *) newSelectorId;
|
||||
- (NSString *) selectorId;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXFREEBUSYUSERSELECTOR_H */
|
|
@ -1,163 +0,0 @@
|
|||
/* UIxFreeBusyUserSelector.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <SoObjects/SOGo/AgenorUserManager.h>
|
||||
|
||||
#import "UIxComponent+Agenor.h"
|
||||
#import "UIxFreeBusyUserSelector.h"
|
||||
|
||||
@implementation UIxFreeBusyUserSelector
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
startDate = nil;
|
||||
endDate = nil;
|
||||
dayStartHour = [NSNumber numberWithInt: 8];
|
||||
[dayStartHour retain];
|
||||
dayEndHour = [NSNumber numberWithInt: 18];
|
||||
[dayEndHour retain];
|
||||
contacts = nil;
|
||||
selectorId = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[dayStartHour release];
|
||||
[dayEndHour release];
|
||||
if (contacts)
|
||||
[contacts release];
|
||||
if (selectorId)
|
||||
[selectorId release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setStartDate: (NSCalendarDate *) newStartDate
|
||||
{
|
||||
startDate = newStartDate;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) startDate
|
||||
{
|
||||
return startDate;
|
||||
}
|
||||
|
||||
- (void) setEndDate: (NSCalendarDate *) newEndDate
|
||||
{
|
||||
endDate = newEndDate;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) endDate
|
||||
{
|
||||
return endDate;
|
||||
}
|
||||
|
||||
- (void) setDayStartHour: (NSNumber *) newDayStartHour
|
||||
{
|
||||
ASSIGN (dayStartHour, newDayStartHour);
|
||||
}
|
||||
|
||||
- (NSNumber *) dayStartHour
|
||||
{
|
||||
return dayStartHour;
|
||||
}
|
||||
|
||||
- (void) setDayEndHour: (NSNumber *) newDayEndHour
|
||||
{
|
||||
ASSIGN (dayEndHour, newDayEndHour);
|
||||
}
|
||||
|
||||
- (NSNumber *) dayEndHour
|
||||
{
|
||||
return dayEndHour;
|
||||
}
|
||||
|
||||
- (void) setSelectorId: (NSString *) newSelectorId
|
||||
{
|
||||
ASSIGN (selectorId, newSelectorId);
|
||||
}
|
||||
|
||||
- (NSString *) selectorId
|
||||
{
|
||||
return selectorId;
|
||||
}
|
||||
|
||||
- (void) setContacts: (NSArray *) newContacts
|
||||
{
|
||||
ASSIGN (contacts, newContacts);
|
||||
}
|
||||
|
||||
- (NSArray *) contacts
|
||||
{
|
||||
return contacts;
|
||||
}
|
||||
|
||||
/* callbacks */
|
||||
- (void) takeValuesFromRequest: (WORequest *) request
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
NSArray *newContacts;
|
||||
|
||||
newContacts
|
||||
= [self getICalPersonsFromValue: [request formValueForKey: selectorId]];
|
||||
ASSIGN (contacts, newContacts);
|
||||
if ([contacts count] > 0)
|
||||
NSLog (@"got %i attendees: %@", [contacts count], contacts);
|
||||
else
|
||||
NSLog (@"got no attendees!");
|
||||
}
|
||||
|
||||
/* in-template operations */
|
||||
- (NSString *) initialContactsAsString
|
||||
{
|
||||
NSEnumerator *persons;
|
||||
iCalPerson *person;
|
||||
NSMutableArray *participants;
|
||||
|
||||
participants = [NSMutableArray arrayWithCapacity: [contacts count]];
|
||||
persons = [contacts objectEnumerator];
|
||||
person = [persons nextObject];
|
||||
while (person)
|
||||
{
|
||||
[participants addObject: [person cn]];
|
||||
person = [persons nextObject];
|
||||
}
|
||||
|
||||
return [participants componentsJoinedByString: @","];
|
||||
}
|
||||
|
||||
- (NSString *) freeBusyViewId
|
||||
{
|
||||
return [NSString stringWithFormat: @"parentOf%@", [selectorId capitalizedString]];
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,82 +0,0 @@
|
|||
/* UIxFreeBusyUserSelectorTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef UIXFREEBUSYUSERSELECTORTABLE_H
|
||||
#define UIXFREEBUSYUSERSELECTORTABLE_H
|
||||
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
@class NSArray;
|
||||
@class NSCalendarDate;
|
||||
@class NSNumber;
|
||||
|
||||
@class iCalPerson;
|
||||
@class SOGoDateFormatter;
|
||||
|
||||
@interface UIxFreeBusyUserSelectorTable : UIxComponent
|
||||
{
|
||||
BOOL standAlone;
|
||||
NSMutableArray *daysToDisplay;
|
||||
NSMutableArray *hoursToDisplay;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
|
||||
NSArray *contacts;
|
||||
NSNumber *dayStartHour;
|
||||
NSNumber *dayEndHour;
|
||||
NSCalendarDate *startDate;
|
||||
NSCalendarDate *endDate;
|
||||
|
||||
iCalPerson *currentContact;
|
||||
NSNumber *currentHourToDisplay;
|
||||
NSCalendarDate *currentDayToDisplay;
|
||||
}
|
||||
|
||||
- (void) setContacts: (NSArray *) newContacts;
|
||||
- (NSArray *) contacts;
|
||||
|
||||
- (void) setStartDate: (NSCalendarDate *) newStartDate;
|
||||
- (void) setEndDate: (NSCalendarDate *) newEndDate;
|
||||
|
||||
- (void) setDayStartHour: (NSNumber *) newDayStartHour;
|
||||
- (NSNumber *) dayStartHour;
|
||||
- (void) setDayEndHour: (NSNumber *) newDayEndHour;
|
||||
- (NSNumber *) dayEndHour;
|
||||
|
||||
- (void) setCurrentContact: (iCalPerson *) newCurrentContact;
|
||||
- (iCalPerson *) currentContact;
|
||||
- (NSString *) currentContactId;
|
||||
- (NSString *) currentContactName;
|
||||
|
||||
- (void) setCurrentDayToDisplay: (NSCalendarDate *) newCurrentDayToDisplay;
|
||||
- (NSCalendarDate *) currentDayToDisplay;
|
||||
|
||||
- (void) setCurrentHourToDisplay: (NSNumber *) newCurrentHourToDisplay;
|
||||
- (NSNumber *) currentHourToDisplay;
|
||||
|
||||
- (NSString *) currentFormattedDay;
|
||||
|
||||
- (NSArray *) daysToDisplay;
|
||||
- (NSArray *) hoursToDisplay;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXFREEBUSYUSERSELECTORTABLE_H */
|
|
@ -1,292 +0,0 @@
|
|||
/* UIxFreeBusyUserSelectorTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
|
||||
#import <SoObjects/Appointments/SOGoFreeBusyObject.h>
|
||||
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGoUI/SOGoDateFormatter.h>
|
||||
|
||||
#import "UIxComponent+Agenor.h"
|
||||
#import "UIxFreeBusyUserSelectorTable.h"
|
||||
|
||||
@implementation UIxFreeBusyUserSelectorTable
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
standAlone = NO;
|
||||
startDate = nil;
|
||||
endDate = nil;
|
||||
contacts = nil;
|
||||
hoursToDisplay = nil;
|
||||
daysToDisplay = nil;
|
||||
dateFormatter
|
||||
= [[SOGoDateFormatter alloc] initWithLocale: [self locale]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[dateFormatter release];
|
||||
if (hoursToDisplay)
|
||||
[hoursToDisplay release];
|
||||
if (daysToDisplay)
|
||||
[daysToDisplay release];
|
||||
if (standAlone)
|
||||
{
|
||||
if (startDate)
|
||||
[startDate release];
|
||||
if (endDate)
|
||||
[endDate release];
|
||||
if (contacts)
|
||||
[contacts release];
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setContacts: (NSArray *) newContacts
|
||||
{
|
||||
contacts = newContacts;
|
||||
}
|
||||
|
||||
- (NSArray *) contacts
|
||||
{
|
||||
return contacts;
|
||||
}
|
||||
|
||||
- (void) setStartDate: (NSCalendarDate *) newStartDate
|
||||
{
|
||||
startDate = newStartDate;
|
||||
if (daysToDisplay)
|
||||
{
|
||||
[daysToDisplay release];
|
||||
daysToDisplay = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) startDate
|
||||
{
|
||||
return startDate;
|
||||
}
|
||||
|
||||
- (void) setEndDate: (NSCalendarDate *) newEndDate
|
||||
{
|
||||
endDate = newEndDate;
|
||||
if (daysToDisplay)
|
||||
{
|
||||
[daysToDisplay release];
|
||||
daysToDisplay = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) endDate
|
||||
{
|
||||
return endDate;
|
||||
}
|
||||
|
||||
- (void) setDayStartHour: (NSNumber *) newDayStartHour
|
||||
{
|
||||
dayStartHour = newDayStartHour;
|
||||
if (hoursToDisplay)
|
||||
{
|
||||
[hoursToDisplay release];
|
||||
hoursToDisplay = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSNumber *) dayStartHour
|
||||
{
|
||||
return dayStartHour;
|
||||
}
|
||||
|
||||
- (void) setDayEndHour: (NSNumber *) newDayEndHour
|
||||
{
|
||||
dayEndHour = newDayEndHour;
|
||||
if (hoursToDisplay)
|
||||
{
|
||||
[hoursToDisplay release];
|
||||
hoursToDisplay = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSNumber *) dayEndHour
|
||||
{
|
||||
return dayEndHour;
|
||||
}
|
||||
|
||||
/* template operations */
|
||||
- (NSArray *) daysToDisplay
|
||||
{
|
||||
NSCalendarDate *currentDay, *finalDay;
|
||||
|
||||
if (!daysToDisplay)
|
||||
{
|
||||
daysToDisplay = [NSMutableArray new];
|
||||
finalDay = [endDate dateByAddingYears: 0 months: 0 days: 2];
|
||||
currentDay = startDate;
|
||||
[daysToDisplay addObject: currentDay];
|
||||
while (![currentDay isDateOnSameDay: finalDay])
|
||||
{
|
||||
currentDay = [currentDay dateByAddingYears: 0
|
||||
months: 0
|
||||
days: 1];
|
||||
[daysToDisplay addObject: currentDay];
|
||||
}
|
||||
}
|
||||
|
||||
return daysToDisplay;
|
||||
}
|
||||
|
||||
- (NSArray *) hoursToDisplay
|
||||
{
|
||||
NSNumber *currentHour;
|
||||
|
||||
if (!hoursToDisplay)
|
||||
{
|
||||
hoursToDisplay = [NSMutableArray new];
|
||||
currentHour = dayStartHour;
|
||||
[hoursToDisplay addObject: currentHour];
|
||||
while (![currentHour isEqual: dayEndHour])
|
||||
{
|
||||
currentHour = [NSNumber numberWithInt: [currentHour intValue] + 1];
|
||||
[hoursToDisplay addObject: currentHour];
|
||||
}
|
||||
}
|
||||
|
||||
return hoursToDisplay;
|
||||
}
|
||||
|
||||
- (void) setCurrentContact: (iCalPerson *) newCurrentContact
|
||||
{
|
||||
currentContact = newCurrentContact;
|
||||
}
|
||||
|
||||
- (iCalPerson *) currentContact
|
||||
{
|
||||
return currentContact;
|
||||
}
|
||||
|
||||
- (BOOL) currentContactHasStatus
|
||||
{
|
||||
return ([currentContact participationStatus] != 0);
|
||||
}
|
||||
|
||||
- (NSString *) currentContactStatusImage
|
||||
{
|
||||
NSString *basename;
|
||||
|
||||
basename = [[currentContact partStatWithDefault] lowercaseString];
|
||||
|
||||
return [self urlForResourceFilename: [NSString stringWithFormat: @"%@.png", basename]];;
|
||||
}
|
||||
|
||||
- (NSString *) currentContactId
|
||||
{
|
||||
return [currentContact cn];
|
||||
}
|
||||
|
||||
- (NSString *) currentContactName
|
||||
{
|
||||
return [currentContact cn];
|
||||
}
|
||||
|
||||
- (void) setCurrentDayToDisplay: (NSCalendarDate *) newCurrentDayToDisplay
|
||||
{
|
||||
currentDayToDisplay = newCurrentDayToDisplay;
|
||||
}
|
||||
|
||||
- (void) setCurrentHourToDisplay: (NSNumber *) newCurrentHourToDisplay
|
||||
{
|
||||
currentHourToDisplay = newCurrentHourToDisplay;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) currentDayToDisplay
|
||||
{
|
||||
return currentDayToDisplay;
|
||||
}
|
||||
|
||||
- (NSNumber *) currentHourToDisplay
|
||||
{
|
||||
return currentHourToDisplay;
|
||||
}
|
||||
|
||||
- (NSString *) currentFormattedDay
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@, %.4d-%.2d-%.2d",
|
||||
[dateFormatter shortDayOfWeek: [currentDayToDisplay dayOfWeek]],
|
||||
[currentDayToDisplay yearOfCommonEra],
|
||||
[currentDayToDisplay monthOfYear],
|
||||
[currentDayToDisplay dayOfMonth]];
|
||||
}
|
||||
|
||||
/* as stand-alone component... */
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
SOGoFreeBusyObject *co;
|
||||
NSString *queryParam;
|
||||
NSTimeZone *uTZ;
|
||||
|
||||
co = [self clientObject];
|
||||
uTZ = [co userTimeZone];
|
||||
|
||||
queryParam = [self queryParameterForKey: @"sday"];
|
||||
if ([queryParam length] > 0)
|
||||
{
|
||||
[self setStartDate: [NSCalendarDate dateFromShortDateString: queryParam
|
||||
andShortTimeString: @"0000"
|
||||
inTimeZone: uTZ]];
|
||||
[startDate retain];
|
||||
}
|
||||
queryParam = [self queryParameterForKey: @"eday"];
|
||||
if ([queryParam length] > 0)
|
||||
{
|
||||
[self setEndDate: [NSCalendarDate dateFromShortDateString: queryParam
|
||||
andShortTimeString: @"0000"
|
||||
inTimeZone: uTZ]];
|
||||
[endDate retain];
|
||||
}
|
||||
queryParam = [self queryParameterForKey: @"attendees"];
|
||||
if ([queryParam length] > 0)
|
||||
{
|
||||
[self setContacts: [self getICalPersonsFromValue: queryParam]];
|
||||
[contacts retain];
|
||||
}
|
||||
dayStartHour = [NSNumber numberWithInt: 8];
|
||||
dayEndHour = [NSNumber numberWithInt: 18];
|
||||
|
||||
standAlone = YES;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue