diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index eb0a49f60..b90b510e0 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -32,8 +32,6 @@ SchedulerUI_OBJC_FILES = \ \ UIxAttendeesEditor.m \ UIxComponentEditor.m \ - UIxFreeBusyUserSelector.m \ - UIxFreeBusyUserSelectorTable.m \ UIxAppointmentView.m \ UIxAppointmentEditor.m \ UIxAppointmentProposal.m \ diff --git a/UI/Scheduler/UIxFreeBusyUserSelector.h b/UI/Scheduler/UIxFreeBusyUserSelector.h deleted file mode 100644 index 44ff82ec2..000000000 --- a/UI/Scheduler/UIxFreeBusyUserSelector.h +++ /dev/null @@ -1,62 +0,0 @@ -/* UIxFreeBusyUserSelector.h - this file is part of SOGo - * - * Copyright (C) 2006 Inverse groupe conseil - * - * Author: Wolfgang Sourdeau - * - * 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 - -@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 */ diff --git a/UI/Scheduler/UIxFreeBusyUserSelector.m b/UI/Scheduler/UIxFreeBusyUserSelector.m deleted file mode 100644 index 13f4c3aad..000000000 --- a/UI/Scheduler/UIxFreeBusyUserSelector.m +++ /dev/null @@ -1,163 +0,0 @@ -/* UIxFreeBusyUserSelector.m - this file is part of SOGo - * - * Copyright (C) 2006 Inverse groupe conseil - * - * Author: Wolfgang Sourdeau - * - * 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 -#import - -#import -#import - -#import - -#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 diff --git a/UI/Scheduler/UIxFreeBusyUserSelectorTable.h b/UI/Scheduler/UIxFreeBusyUserSelectorTable.h deleted file mode 100644 index 969695f76..000000000 --- a/UI/Scheduler/UIxFreeBusyUserSelectorTable.h +++ /dev/null @@ -1,82 +0,0 @@ -/* UIxFreeBusyUserSelectorTable.h - this file is part of SOGo - * - * Copyright (C) 2006 Inverse groupe conseil - * - * Author: Wolfgang Sourdeau - * - * 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 - -@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 */ diff --git a/UI/Scheduler/UIxFreeBusyUserSelectorTable.m b/UI/Scheduler/UIxFreeBusyUserSelectorTable.m deleted file mode 100644 index 4e3df859d..000000000 --- a/UI/Scheduler/UIxFreeBusyUserSelectorTable.m +++ /dev/null @@ -1,292 +0,0 @@ -/* UIxFreeBusyUserSelectorTable.m - this file is part of SOGo - * - * Copyright (C) 2006 Inverse groupe conseil - * - * Author: Wolfgang Sourdeau - * - * 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 -#import -#import -#import - -#import -#import - -#import -#import -#import - -#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 ) 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