From 06349f85c837bad8007fc3d7c34f3bf01604296c Mon Sep 17 00:00:00 2001 From: znek Date: Fri, 13 Aug 2004 17:44:00 +0000 Subject: [PATCH] new formatters, new user manager git-svn-id: http://svn.opengroupware.org/SOGo/trunk@205 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SOGo.xcode/project.pbxproj | 175 +++++++++++++++++++++++ SOGo/UI/SOGoUI/ChangeLog | 10 ++ SOGo/UI/SOGoUI/GNUmakefile | 14 +- SOGo/UI/SOGoUI/SOGoAptFormatter.h | 44 ++++++ SOGo/UI/SOGoUI/SOGoAptFormatter.m | 154 ++++++++++++++++++++ SOGo/UI/SOGoUI/UIxComponent.m | 4 +- SOGo/UI/SOGoUI/Version | 2 +- SOGo/UI/Scheduler/ChangeLog | 10 ++ SOGo/UI/Scheduler/UIxAppointmentEditor.m | 1 + SOGo/UI/Scheduler/UIxCalDayOverview.m | 1 + SOGo/UI/Scheduler/UIxCalView.h | 6 +- SOGo/UI/Scheduler/UIxCalView.m | 101 ++++--------- SOGoLogic/AgenorUserManager.h | 43 ++++++ SOGoLogic/AgenorUserManager.m | 87 +++++++++++ SOGoLogic/ChangeLog | 5 + SOGoLogic/GNUmakefile | 8 +- SOGoLogic/GNUmakefile.preamble | 5 +- SOGoLogic/Version | 2 +- 18 files changed, 583 insertions(+), 89 deletions(-) create mode 100644 SOGo/UI/SOGoUI/SOGoAptFormatter.h create mode 100644 SOGo/UI/SOGoUI/SOGoAptFormatter.m create mode 100644 SOGoLogic/AgenorUserManager.h create mode 100644 SOGoLogic/AgenorUserManager.m diff --git a/SOGo/SOGo.xcode/project.pbxproj b/SOGo/SOGo.xcode/project.pbxproj index 4a20be5d..312d1459 100644 --- a/SOGo/SOGo.xcode/project.pbxproj +++ b/SOGo/SOGo.xcode/project.pbxproj @@ -198,6 +198,176 @@ refType = 4; sourceTree = ""; }; + AD071B3C06CCFA2000A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = "iCalPerson+UIx.h"; + refType = 4; + sourceTree = ""; + }; + AD071B3D06CCFA2000A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = "iCalPerson+UIx.m"; + refType = 4; + sourceTree = ""; + }; + AD071C7D06CD214600A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = SOGoAptFormatter.h; + refType = 4; + sourceTree = ""; + }; + AD071C7E06CD214700A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = SOGoAptFormatter.m; + refType = 4; + sourceTree = ""; + }; + AD071CE306CD2AB800A9EEF4 = { + children = ( + AD071CE806CD2ACE00A9EEF4, + AD071CE706CD2ACE00A9EEF4, + AD071CE506CD2ACE00A9EEF4, + AD071CF006CD2ACE00A9EEF4, + AD071CF406CD2B0400A9EEF4, + AD071CF706CD2B1900A9EEF4, + ); + isa = PBXGroup; + name = Logic; + refType = 4; + sourceTree = ""; + }; + AD071CE506CD2ACE00A9EEF4 = { + fileEncoding = 4; + indentWidth = 8; + isa = PBXFileReference; + lastKnownFileType = text; + name = ChangeLog; + path = ../SOGoLogic/ChangeLog; + refType = 4; + sourceTree = ""; + tabWidth = 8; + usesTabs = 1; + }; + AD071CE606CD2ACE00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = common.h; + refType = 4; + sourceTree = ""; + }; + AD071CE706CD2ACE00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + name = COPYING; + path = ../SOGoLogic/COPYING; + refType = 4; + sourceTree = ""; + }; + AD071CE806CD2ACE00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + name = COPYRIGHT; + path = ../SOGoLogic/COPYRIGHT; + refType = 4; + sourceTree = ""; + }; + AD071CE906CD2ACE00A9EEF4 = { + explicitFileType = sourcecode.make; + fileEncoding = 4; + indentWidth = 8; + isa = PBXFileReference; + path = GNUmakefile; + refType = 4; + sourceTree = ""; + tabWidth = 8; + }; + AD071CEA06CD2ACE00A9EEF4 = { + explicitFileType = sourcecode.make; + fileEncoding = 4; + indentWidth = 8; + isa = PBXFileReference; + path = GNUmakefile.preamble; + refType = 4; + sourceTree = ""; + tabWidth = 8; + }; + AD071CEC06CD2ACE00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = SOGoAppointment.h; + refType = 4; + sourceTree = ""; + }; + AD071CED06CD2ACE00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = SOGoAppointment.m; + refType = 4; + sourceTree = ""; + }; + AD071CF006CD2ACE00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + name = Version; + path = ../SOGoLogic/Version; + refType = 4; + sourceTree = ""; + }; + AD071CF406CD2B0400A9EEF4 = { + children = ( + AD071CE906CD2ACE00A9EEF4, + AD071CEA06CD2ACE00A9EEF4, + ); + isa = PBXGroup; + name = Makefiles; + path = ../SOGoLogic; + refType = 4; + sourceTree = ""; + }; + AD071CF706CD2B1900A9EEF4 = { + children = ( + AD071CE606CD2ACE00A9EEF4, + AD071CEC06CD2ACE00A9EEF4, + AD071CED06CD2ACE00A9EEF4, + AD071D1206CD2BCB00A9EEF4, + AD071D1306CD2BCB00A9EEF4, + ); + isa = PBXGroup; + name = Classes; + path = ../SOGoLogic; + refType = 4; + sourceTree = ""; + }; + AD071D1206CD2BCB00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = AgenorUserManager.h; + refType = 4; + sourceTree = ""; + }; + AD071D1306CD2BCB00A9EEF4 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = AgenorUserManager.m; + refType = 4; + sourceTree = ""; + }; AD152B6F06AC159A002375D2 = { fileEncoding = 4; isa = PBXFileReference; @@ -250,6 +420,8 @@ AD6BCF11069D77E9003664CD, AD0712CA06C917A600A9EEF4, AD0712CB06C917A600A9EEF4, + AD071C7D06CD214600A9EEF4, + AD071C7E06CD214700A9EEF4, ); isa = PBXGroup; path = SOGoUI; @@ -670,6 +842,7 @@ E872058F0692E3D00099CBBD, E87205F50692E3D00099CBBD, E87206A40692E3D10099CBBD, + AD071CE306CD2AB800A9EEF4, ); isa = PBXGroup; refType = 4; @@ -1937,6 +2110,8 @@ E872090B0692E3D30099CBBD, E87209020692E3D30099CBBD, E87209030692E3D30099CBBD, + AD071B3C06CCFA2000A9EEF4, + AD071B3D06CCFA2000A9EEF4, ); isa = PBXGroup; name = Classes; diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index f545d9d8..392ec75d 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,13 @@ +2004-08-13 Marcus Mueller + + * v0.9.8 + + * SOGoAptFormatter.[hm]: added new formatter for appointments. + + * UIxComponent.m: added warning. + + * GNUmakefile: added SOGoAptFormatter.[hm] + 2004-08-11 Marcus Mueller * UIxComponent.[hm]: added -SoUser (v0.9.7) diff --git a/SOGo/UI/SOGoUI/GNUmakefile b/SOGo/UI/SOGoUI/GNUmakefile index 860efb4f..ff9bc807 100644 --- a/SOGo/UI/SOGoUI/GNUmakefile +++ b/SOGo/UI/SOGoUI/GNUmakefile @@ -7,13 +7,15 @@ LIBRARY_NAME = libSOGoUI libSOGoUI_HEADER_FILES_DIR = . libSOGoUI_HEADER_FILES_INSTALL_DIR = /SOGoUI -libSOGoUI_HEADER_FILES += \ - UIxComponent.h \ - SOGoDateFormatter.h \ +libSOGoUI_HEADER_FILES += \ + UIxComponent.h \ + SOGoDateFormatter.h \ + SOGoAptFormatter.h \ -libSOGoUI_OBJC_FILES += \ - UIxComponent.m \ - SOGoDateFormatter.m \ +libSOGoUI_OBJC_FILES += \ + UIxComponent.m \ + SOGoDateFormatter.m \ + SOGoAptFormatter.m \ # make diff --git a/SOGo/UI/SOGoUI/SOGoAptFormatter.h b/SOGo/UI/SOGoUI/SOGoAptFormatter.h new file mode 100644 index 00000000..62e14b14 --- /dev/null +++ b/SOGo/UI/SOGoUI/SOGoAptFormatter.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2000-2004 SKYRIX Software AG + + This file is part of OGo + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + + +#ifndef __SOGoAptFormatter_H_ +#define __SOGoAptFormatter_H_ + + +#include + + +@interface SOGoAptFormatter : NSFormatter +{ + NSTimeZone *tz; + SEL formatAction; +} + +- (id)initWithDisplayTimeZone:(NSTimeZone *)_tz; + +- (void)setTooltip; +- (void)setFullDetails; + +@end + +#endif /* __SOGoAptFormatter_H_ */ diff --git a/SOGo/UI/SOGoUI/SOGoAptFormatter.m b/SOGo/UI/SOGoUI/SOGoAptFormatter.m new file mode 100644 index 00000000..71cd80aa --- /dev/null +++ b/SOGo/UI/SOGoUI/SOGoAptFormatter.m @@ -0,0 +1,154 @@ +/* + Copyright (C) 2000-2004 SKYRIX Software AG + + This file is part of OGo + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + + +#import "SOGoAptFormatter.h" + + +@interface SOGoAptFormatter (PrivateAPI) +- (NSString *)shortTitleForApt:(id)_apt; +- (NSTimeZone *)displayTZ; +@end + +@implementation SOGoAptFormatter + +- (id)initWithDisplayTimeZone:(NSTimeZone *)_tz { + self = [super init]; + if(self) { + ASSIGN(self->tz, _tz); + [self setFullDetails]; + } + return self; +} + +- (void)dealloc { + [self->tz release]; + [super dealloc]; +} + +- (void)setTooltip { + self->formatAction = @selector(tooltipForApt:); +} + +- (void)setFullDetails { + self->formatAction = @selector(fullDetailsForApt:); +} + +- (NSString *)stringForObjectValue:(id)_obj { + return [self performSelector:self->formatAction + withObject:_obj]; +} + + +/* Helpers */ + +- (NSString *)shortTitleForApt:(id)_apt { + NSString *title; + + title = [_apt valueForKey:@"title"]; + if ([title length] > 12) + title = [[title substringToIndex:11] stringByAppendingString:@"..."]; + + return title; +} + +/* Private */ + +- (NSTimeZone *)displayTZ { + return self->tz; +} + +- (NSString *)fullDetailsForApt:(id)_apt { + NSCalendarDate *startDate, *endDate; + NSMutableString *aptDescr; + NSString *s; + BOOL spansRange; + + spansRange = NO; + startDate = [_apt valueForKey:@"startDate"]; + [startDate setTimeZone:[self displayTZ]]; + endDate = [_apt valueForKey:@"endDate"]; + if(endDate != nil) { + [endDate setTimeZone:[self displayTZ]]; + spansRange = ![endDate isEqualToDate:startDate]; + } + aptDescr = [[NSMutableString alloc] init]; + [aptDescr appendFormat:@"%02i:%02i", + [startDate hourOfDay], + [startDate minuteOfHour]]; + if(spansRange) { + [aptDescr appendFormat:@", %02i:%02i", + [endDate hourOfDay], + [endDate minuteOfHour]]; + } + s = [_apt valueForKey:@"location"]; + if(s) { + if([s length] > 12) { + s = [NSString stringWithFormat:@"%@...", + [s substringToIndex:11]]; + } + [aptDescr appendFormat:@" (%@)", s]; + } + s = [_apt valueForKey:@"title"]; + if(s) { + [aptDescr appendFormat:@"
%@", + [self shortTitleForApt:_apt]]; + } + return [aptDescr autorelease]; +} + +- (NSString *)tooltipForApt:(id)_apt { + NSCalendarDate *startDate, *endDate; + NSMutableString *aptDescr; + NSString *s; + BOOL spansRange; + + spansRange = NO; + startDate = [_apt valueForKey:@"startDate"]; + [startDate setTimeZone:[self displayTZ]]; + endDate = [_apt valueForKey:@"endDate"]; + if(endDate != nil) { + [endDate setTimeZone:[self displayTZ]]; + spansRange = ![endDate isEqualToDate:startDate]; + } + aptDescr = [[NSMutableString alloc] init]; + [aptDescr appendString:@"appointment"]; + [aptDescr appendFormat:@"\n%02i:%02i", + [startDate hourOfDay], + [startDate minuteOfHour]]; + if(spansRange) { + [aptDescr appendFormat:@" - %02i:%02i", + [endDate hourOfDay], + [endDate minuteOfHour]]; + } + s = [_apt valueForKey:@"title"]; + if(s) { + [aptDescr appendFormat:@"\n%@", s]; + } + s = [_apt valueForKey:@"location"]; + if(s) { + [aptDescr appendFormat:@"\n%@", s]; + } + return [aptDescr autorelease]; +} + +@end diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index bb927020..ccbcba10 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -266,7 +266,9 @@ static NSMutableArray *abbrMonthLabelKeys = nil; // TODO: better use a SoUser formatter? NSString *s; NSRange r; - + +#warning !! USE USER MANAGER INSTEAD! + s = [[self user] login]; if ([s length] < 10) return s; diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index cab297dc..28292b54 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=7 +SUBMINOR_VERSION:=8 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index ffdd4dee..317a88bd 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,13 @@ +2004-08-13 Marcus Mueller + + * v0.9.34 + + * UIxCalView.[hm]: use new formatters. + + * UIxCalDayOverview.m: fixed build warnings. + + * UIxAppointmentEditor.m: added warnings. + 2004-08-13 Marcus Mueller * v0.9.33 diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.m b/SOGo/UI/Scheduler/UIxAppointmentEditor.m index 36d4da4a..dce7694d 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.m +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.m @@ -236,6 +236,7 @@ NSString *uid; NSRange r; +#warning !! USE USER MANAGER INSTEAD! uid = [[self user] login]; r = [uid rangeOfString:@"@"]; if(r.length > 0) diff --git a/SOGo/UI/Scheduler/UIxCalDayOverview.m b/SOGo/UI/Scheduler/UIxCalDayOverview.m index 3e3db0c7..3539b708 100644 --- a/SOGo/UI/Scheduler/UIxCalDayOverview.m +++ b/SOGo/UI/Scheduler/UIxCalDayOverview.m @@ -22,6 +22,7 @@ #include "UIxCalDayOverview.h" +#include "common.h" @implementation UIxCalDayOverview diff --git a/SOGo/UI/Scheduler/UIxCalView.h b/SOGo/UI/Scheduler/UIxCalView.h index d5bbff95..daac43de 100644 --- a/SOGo/UI/Scheduler/UIxCalView.h +++ b/SOGo/UI/Scheduler/UIxCalView.h @@ -12,7 +12,7 @@ a SOPE clientObject (which usually is an SOGoAppointmentFolder). */ -@class NSString, NSArray, NSDictionary, NSCalendarDate; +@class NSString, NSArray, NSDictionary, NSCalendarDate, SOGoAptFormatter; @interface UIxCalView : UIxComponent { @@ -20,6 +20,8 @@ NSArray *allDayApts; id appointment; NSCalendarDate *currentDay; + SOGoAptFormatter *aptFormatter; + SOGoAptFormatter *aptTooltipFormatter; } /* accessors */ @@ -35,6 +37,8 @@ - (NSDictionary *)aptTypeDict; - (NSString *)aptTypeLabel; - (NSString *)aptTypeIcon; +- (SOGoAptFormatter *)aptFormatter; + - (NSString *)shortTextForApt; - (NSString *)shortTitleForApt; - (NSString *)tooltipForApt; diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index b08b88cc..8aa76178 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -6,6 +6,7 @@ #include #include "SoObjects/Appointments/SOGoAppointmentFolder.h" #include +#include @interface UIxCalView (PrivateAPI) - (NSString *)_userFolderURI; @@ -23,8 +24,10 @@ static BOOL shouldDisplayWeekend = NO; - (void)dealloc { [self->appointments release]; [self->allDayApts release]; - [self->appointment release]; - [self->currentDay release]; + [self->appointment release]; + [self->currentDay release]; + [self->aptFormatter release]; + [self->aptTooltipFormatter release]; [super dealloc]; } @@ -56,45 +59,27 @@ static BOOL shouldDisplayWeekend = NO; return @""; } +- (SOGoAptFormatter *)aptFormatter { + if(self->aptFormatter) + return self->aptFormatter; + self->aptFormatter = [[SOGoAptFormatter alloc] + initWithDisplayTimeZone:[self viewTimeZone]]; + [self->aptFormatter setFullDetails]; + return self->aptFormatter; +} + +- (SOGoAptFormatter *)aptTooltipFormatter { + if(self->aptTooltipFormatter) + return self->aptTooltipFormatter; + self->aptTooltipFormatter = [[SOGoAptFormatter alloc] + initWithDisplayTimeZone:[self viewTimeZone]]; + [self->aptTooltipFormatter setTooltip]; + return self->aptTooltipFormatter; +} + +/* TODO: remove this */ - (NSString *)shortTextForApt { - NSCalendarDate *startDate, *endDate; - NSMutableString *aptDescr; - NSString *s; - BOOL spansRange; - id apt; - - apt = [self appointment]; - spansRange = NO; - startDate = [apt valueForKey:@"startDate"]; - [startDate setTimeZone:[self viewTimeZone]]; - endDate = [apt valueForKey:@"endDate"]; - if(endDate != nil) { - [endDate setTimeZone:[self viewTimeZone]]; - spansRange = ![endDate isEqualToDate:startDate]; - } - aptDescr = [[NSMutableString alloc] init]; - [aptDescr appendFormat:@"%02i:%02i", - [startDate hourOfDay], - [startDate minuteOfHour]]; - if(spansRange) { - [aptDescr appendFormat:@", %02i:%02i", - [endDate hourOfDay], - [endDate minuteOfHour]]; - } - s = [apt valueForKey:@"location"]; - if(s) { - if([s length] > 12) { - s = [NSString stringWithFormat:@"%@...", - [s substringToIndex:11]]; - } - [aptDescr appendFormat:@" (%@)", s]; - } - s = [apt valueForKey:@"title"]; - if(s) { - [aptDescr appendFormat:@"
%@", - [self shortTitleForApt]]; - } - return [aptDescr autorelease]; + return [[self aptFormatter] stringForObjectValue:self->appointment]; } - (NSString *)shortTitleForApt { @@ -107,41 +92,9 @@ static BOOL shouldDisplayWeekend = NO; return title; } +/* TODO: remove this */ - (NSString *)tooltipForApt { - NSCalendarDate *startDate, *endDate; - NSMutableString *aptDescr; - NSString *s; - BOOL spansRange; - id apt; - - apt = [self appointment]; - spansRange = NO; - startDate = [apt valueForKey:@"startDate"]; - [startDate setTimeZone:[self viewTimeZone]]; - endDate = [apt valueForKey:@"endDate"]; - if(endDate != nil) { - [endDate setTimeZone:[self viewTimeZone]]; - spansRange = ![endDate isEqualToDate:startDate]; - } - aptDescr = [[NSMutableString alloc] init]; - [aptDescr appendString:[self labelForKey:@"appointment"]]; - [aptDescr appendFormat:@"\n%02i:%02i", - [startDate hourOfDay], - [startDate minuteOfHour]]; - if(spansRange) { - [aptDescr appendFormat:@" - %02i:%02i", - [endDate hourOfDay], - [endDate minuteOfHour]]; - } - s = [apt valueForKey:@"title"]; - if(s) { - [aptDescr appendFormat:@"\n%@", s]; - } - s = [apt valueForKey:@"location"]; - if(s) { - [aptDescr appendFormat:@"\n%@", s]; - } - return [aptDescr autorelease]; + return [[self aptTooltipFormatter] stringForObjectValue:self->appointment]; } - (NSCalendarDate *)referenceDateForFormatter { diff --git a/SOGoLogic/AgenorUserManager.h b/SOGoLogic/AgenorUserManager.h new file mode 100644 index 00000000..6dff70ec --- /dev/null +++ b/SOGoLogic/AgenorUserManager.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2000-2004 SKYRIX Software AG + + This file is part of OGo + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + + +#ifndef __AgenorUserManager_H_ +#define __AgenorUserManager_H_ + + +#import + + +@interface AgenorUserManager : NSObject +{ + +} + ++ (id)sharedUserManager; + +- (NSString *)getUIDForEMail:(NSString *)_email; +- (NSString *)getEmailForUID:(NSString *)_uid; + +@end + +#endif /* __AgenorUserManager_H_ */ diff --git a/SOGoLogic/AgenorUserManager.m b/SOGoLogic/AgenorUserManager.m new file mode 100644 index 00000000..aec2deb4 --- /dev/null +++ b/SOGoLogic/AgenorUserManager.m @@ -0,0 +1,87 @@ +/* + Copyright (C) 2000-2004 SKYRIX Software AG + + This file is part of OGo + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + + +#import "AgenorUserManager.h" + + +@implementation AgenorUserManager + ++ (id)sharedUserManager { + static id mgr = nil; + if(mgr == nil) { + mgr = [[self alloc] init]; + } + return mgr; +} + +- (id)init { + self = [super init]; + if(self) { + } + return self; +} + +- (void)dealloc { + [super dealloc]; +} + + +- (NSString *)getUIDForEMail:(NSString *)_email { + NSRange r; + NSString *domain; + + r = [_email rangeOfString:@"@"]; + domain = [_email substringFromIndex:r.location + 1]; + if(![domain isEqualToString:@"equipement.gouv.fr"]) + return _email; + return [_email substringToIndex:r.location]; +} + +- (NSString *)getEmailForUID:(NSString *)_uid { + NSRange r; + + r = [_uid rangeOfString:@"@"]; + if(r.length > 0) + return _uid; + return [NSString stringWithFormat:@"%@@equipement.gouv.fr", _uid]; + +} + +- (NSString *)getCNForUID:(NSString *)_uid { +#warning !! IMPLEMENT ME!! + NSString *s; + NSRange r; + + s = _uid; + if ([s length] < 10) + return s; + + // TODO: algorithm might be inappropriate, depends on the actual UID + r = [s rangeOfString:@"."]; + if (r.length == 0) + return s; + + return [s substringToIndex:r.location]; +} + +@end diff --git a/SOGoLogic/ChangeLog b/SOGoLogic/ChangeLog index c865704c..d92abf7f 100644 --- a/SOGoLogic/ChangeLog +++ b/SOGoLogic/ChangeLog @@ -1,3 +1,8 @@ +2004-08-13 Marcus Mueller + + * AgenorUserManager.[hm]: new singleton object to manage Agenor + related user tasks. (v0.9.3) + 2004-08-12 Helge Hess * SOGoAppointment.h: added -iCalString prototype (v0.9.2) diff --git a/SOGoLogic/GNUmakefile b/SOGoLogic/GNUmakefile index 2a402c00..2696df68 100644 --- a/SOGoLogic/GNUmakefile +++ b/SOGoLogic/GNUmakefile @@ -9,11 +9,13 @@ libSOGoLogic_HEADER_FILES_DIR = . libSOGoLogic_HEADER_FILES_INSTALL_DIR = /SOGoLogic libSOGoLogic_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION) -libSOGoLogic_HEADER_FILES += \ - SOGoAppointment.h \ +libSOGoLogic_HEADER_FILES += \ + SOGoAppointment.h \ + AgenorUserManager.h \ -libSOGoLogic_OBJC_FILES += \ +libSOGoLogic_OBJC_FILES += \ SOGoAppointment.m \ + AgenorUserManager.m \ -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/library.make diff --git a/SOGoLogic/GNUmakefile.preamble b/SOGoLogic/GNUmakefile.preamble index ba805980..0bd280ab 100644 --- a/SOGoLogic/GNUmakefile.preamble +++ b/SOGoLogic/GNUmakefile.preamble @@ -1,6 +1,7 @@ # $Id$ -libSOGoLogic_LIBRARIES_DEPEND_UPON += \ - -lNGiCal \ +libSOGoLogic_LIBRARIES_DEPEND_UPON += \ + -lNGiCal \ + -lNGLdap \ -lSaxObjC diff --git a/SOGoLogic/Version b/SOGoLogic/Version index 1bf86739..fc795f55 100644 --- a/SOGoLogic/Version +++ b/SOGoLogic/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=2 +SUBMINOR_VERSION:=3 -- 2.39.5