diff --git a/UI/Contacts/GNUmakefile b/UI/Contacts/GNUmakefile index 67ee9889d..562fea57a 100644 --- a/UI/Contacts/GNUmakefile +++ b/UI/Contacts/GNUmakefile @@ -9,16 +9,19 @@ ContactsUI_PRINCIPAL_CLASS = ContactsUIProduct ContactsUI_LANGUAGES = English French ContactsUI_OBJC_FILES = \ - UIxContactsListViewBase.m \ UIxContactEditorBase.m \ + UIxContactsListViewBase.m \ + UIxContactsListViewContainerBase.m \ \ ContactsUIProduct.m \ UIxContactsFilterPanel.m \ UIxContactView.m \ - UIxContactSelector.m \ UIxContactEditor.m \ UIxContactsListView.m \ UIxContactsListViewContainer.m \ + UIxContactSelector.m \ + UIxContactsSelectionView.m \ + UIxContactsSelectionViewContainer.m \ UIxContactFoldersView.m \ ContactsUI_RESOURCE_FILES += \ diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index a63e50608..8fa4f22dd 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -38,4 +38,19 @@ return [self redirectToLocation: [folders defaultSourceName]]; } +- (id) selectAction +{ + SOGoContactFolders *folders; + NSString *url, *selectorId; + + folders = [self clientObject]; + selectorId = [self queryParameterForKey: @"selectorId"]; + + url = [NSString stringWithFormat: @"%@/select?selectorId=%@", + [folders defaultSourceName], + selectorId]; + + return [self redirectToLocation: url]; +} + @end diff --git a/UI/Contacts/UIxContactSelector.m b/UI/Contacts/UIxContactSelector.m index 61b41e4e2..a852674fd 100644 --- a/UI/Contacts/UIxContactSelector.m +++ b/UI/Contacts/UIxContactSelector.m @@ -20,23 +20,32 @@ */ // $Id: UIxContactSelector.m 394 2004-10-14 08:47:35Z znek $ - -#include +#import +#import +#import @interface UIxContactSelector : UIxComponent { NSString *title; NSString *windowId; + NSString *selectorId; NSString *callback; + + NSArray *contacts; } - (void)setTitle:(NSString *)_title; - (NSString *)title; - (void)setWindowId:(NSString *)_winId; - (NSString *)windowId; +- (void)setSelectorId:(NSString *)_selId; +- (NSString *)selectorId; - (void)setCallback:(NSString *)_callback; - (NSString *)callback; +- (void) setContacts: (NSArray *) _contacts; +- (NSArray *) contacts; + - (NSString *)relativeContactsPath; - (NSString *)jsFunctionName; @@ -81,6 +90,22 @@ return self->windowId; } +- (void)setSelectorId:(NSString *)_selId { + ASSIGNCOPY(selectorId, _selId); +} + +- (NSString *)selectorId { + return selectorId; +} + +- (NSString *)selectorIdList { + return [NSString stringWithFormat: @"uixselector-%@-uidList", selectorId]; +} + +- (NSString *)selectorIdDisplay { + return [NSString stringWithFormat: @"uixselector-%@-display", selectorId]; +} + - (void)setCallback:(NSString *)_callback { ASSIGNCOPY(self->callback, _callback); } @@ -120,4 +145,87 @@ [self windowId]]; } +- (void) setContacts: (NSArray *) _contacts +{ + contacts = _contacts; +} + +- (NSArray *) contacts +{ + return contacts; +} + +- (NSArray *) getICalPersonsFromValue: (NSString *) selectorValue +{ + NSMutableArray *persons; + NSEnumerator *uids; + NSString *uid; + + persons = [NSMutableArray new]; + [persons autorelease]; + + if ([selectorValue length] > 0) + { + uids = [[selectorValue componentsSeparatedByString: @","] + objectEnumerator]; + uid = [uids nextObject]; + while (uid) + { + [persons addObject: [iCalPerson personWithUid: uid]]; + uid = [uids nextObject]; + } + } + + return persons; +} + +- (void) takeValuesFromRequest: (WORequest *) _rq + inContext: (WOContext *) _ctx +{ + contacts = [self getICalPersonsFromValue: [_rq formValueForKey: selectorId]]; + if ([contacts count] > 0) + NSLog (@" got %i attendees: %@", [contacts count], contacts); + else + NSLog (@"go no attendees!"); +} + +- (NSString *) initialParticipantIds +{ + NSMutableArray *uids; + NSEnumerator *persons; + iCalPerson *person; + AgenorUserManager *um; + + um = [AgenorUserManager sharedUserManager]; + + uids = [NSMutableArray arrayWithCapacity: [contacts count]]; + persons = [contacts objectEnumerator]; + person = [persons nextObject]; + while (person) + { + [uids addObject: [um getUIDForICalPerson: person]]; + person = [persons nextObject]; + } + + return [uids componentsJoinedByString: @","]; +} + +- (NSString *) initialParticipants +{ + NSMutableArray *participants; + NSEnumerator *persons; + iCalPerson *person; + + participants = [NSMutableArray arrayWithCapacity: [contacts count]]; + persons = [contacts objectEnumerator]; + person = [persons nextObject]; + while (person) + { + [participants addObject: [person cn]]; + person = [persons nextObject]; + } + + return [participants componentsJoinedByString: @","]; +} + @end /* UIxContactSelector */ diff --git a/UI/Contacts/UIxContactsListViewContainer.h b/UI/Contacts/UIxContactsListViewContainer.h new file mode 100644 index 000000000..ea3371a2f --- /dev/null +++ b/UI/Contacts/UIxContactsListViewContainer.h @@ -0,0 +1,32 @@ +/* UIxContactsListViewContainer.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 UIXCONTACTSLISTVIEWCONTAINER_H +#define UIXCONTACTSLISTVIEWCONTAINER_H + +#import "UIxContactsListViewContainerBase.h" + +@interface UIxContactsListViewContainer : UIxContactsListViewContainerBase + +@end + +#endif /* UIXCONTACTSLISTVIEWCONTAINER_H */ diff --git a/UI/Contacts/UIxContactsListViewContainer.m b/UI/Contacts/UIxContactsListViewContainer.m new file mode 100644 index 000000000..13d54b8df --- /dev/null +++ b/UI/Contacts/UIxContactsListViewContainer.m @@ -0,0 +1,27 @@ +/* UIxContactsListViewContainer.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 "UIxContactsListViewContainer.h" + +@implementation UIxContactsListViewContainer + +@end diff --git a/UI/Contacts/UIxContactsSelectionView.m b/UI/Contacts/UIxContactsSelectionView.m index 2e960de9a..7e0cc6a71 100644 --- a/UI/Contacts/UIxContactsSelectionView.m +++ b/UI/Contacts/UIxContactsSelectionView.m @@ -27,89 +27,89 @@ NSString *callback; } -- (NSString *)_getCN; -- (NSString *)getCN; -- (NSString *)getSN; -- (NSString *)getMail; -- (NSString *)getUID; +// - (NSString *)_getCN; +// - (NSString *)getCN; +// - (NSString *)getSN; +// - (NSString *)getMail; +// - (NSString *)getUID; @end -#include "common.h" -#include +// #include "common.h" +// #include @implementation UIxContactsSelectionView -static SOGoJSStringFormatter *jsFormatter = nil; +// static SOGoJSStringFormatter *jsFormatter = nil; -+ (void)initialize { - static BOOL didInit = NO; +// + (void)initialize { +// static BOOL didInit = NO; - if(didInit) - return; +// if(didInit) +// return; - didInit = YES; - jsFormatter = [SOGoJSStringFormatter sharedFormatter]; -} +// didInit = YES; +// jsFormatter = [SOGoJSStringFormatter sharedFormatter]; +// } -- (void)dealloc { - [self->callback release]; - [super dealloc]; -} +// - (void)dealloc { +// [self->callback release]; +// [super dealloc]; +// } -- (NSString *)callback { - if(!self->callback) { - WORequest *r = [[self context] request]; - self->callback = [[r formValueForKey:@"callback"] retain]; - } - return self->callback; -} +// - (NSString *)callback { +// if(!self->callback) { +// WORequest *r = [[self context] request]; +// self->callback = [[r formValueForKey:@"callback"] retain]; +// } +// return self->callback; +// } -- (NSString *)_getCN { - return [self->contact valueForKey:@"cn"]; -} +// - (NSString *)_getCN { +// return [self->contact valueForKey:@"cn"]; +// } -- (NSString *)getCN { - return [jsFormatter stringByEscapingQuotesInString:[self _getCN]]; -} +// - (NSString *)getCN { +// return [jsFormatter stringByEscapingQuotesInString:[self _getCN]]; +// } -- (NSString *)getSN { - NSString *sn = [self->contact valueForKey:@"sn"]; - return [jsFormatter stringByEscapingQuotesInString:sn]; -} +// - (NSString *)getSN { +// NSString *sn = [self->contact valueForKey:@"sn"]; +// return [jsFormatter stringByEscapingQuotesInString:sn]; +// } -- (NSString *)getMail { - return [self->contact valueForKey:@"mail"]; -} +// - (NSString *)getMail { +// return [self->contact valueForKey:@"mail"]; +// } -- (NSString *)getUID { - return [[AgenorUserManager sharedUserManager] getUIDForEmail:[self getMail]]; -} +// - (NSString *)getUID { +// return [[AgenorUserManager sharedUserManager] getUIDForEmail:[self getMail]]; +// } -- (NSString *)jsOnClickCode { - /* callback parameters: (type, cn, dn, email, uid, sn) */ +// - (NSString *)jsOnClickCode { +// /* callback parameters: (type, cn, dn, email, uid, sn) */ - /* changed to : type, email, uid, sn, cn, dn */ - static NSString *jsCode = \ - @"javascript:opener.window.%@('', '%@', '%@', '%@', '%@', '');"; +// /* changed to : type, email, uid, sn, cn, dn */ +// static NSString *jsCode = \ +// @"javascript:opener.window.%@('', '%@', '%@', '%@', '%@', '');"; - return [NSString stringWithFormat:jsCode, - [self callback], - [self getMail], - [self getUID], - [self getSN], - [self getCN]]; +// return [NSString stringWithFormat:jsCode, +// [self callback], +// [self getMail], +// [self getUID], +// [self getSN], +// [self getCN]]; - // return [NSString stringWithFormat:jsCode, - // [self callback], - // [self getCN], - // [self getMail], - // [self getUID], - // [self getSN]]; -} +// // return [NSString stringWithFormat:jsCode, +// // [self callback], +// // [self getCN], +// // [self getMail], +// // [self getUID], +// // [self getSN]]; +// } @end /* UIxContactsInlineListView */ diff --git a/UI/Contacts/UIxContactsSelectionViewContainer.h b/UI/Contacts/UIxContactsSelectionViewContainer.h new file mode 100644 index 000000000..6c45deac6 --- /dev/null +++ b/UI/Contacts/UIxContactsSelectionViewContainer.h @@ -0,0 +1,32 @@ +/* UIxContactsSelectionViewContainer.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 UIXCONTACTSSELECTIONVIEWCONTAINER_H +#define UIXCONTACTSSELECTIONVIEWCONTAINER_H + +#import "UIxContactsListViewContainerBase.h" + +@interface UIxContactsSelectionViewContainer : UIxContactsListViewContainerBase + +@end + +#endif /* UIXCONTACTSSELECTIONVIEWCONTAINER_H */ diff --git a/UI/Contacts/UIxContactsSelectionViewContainer.m b/UI/Contacts/UIxContactsSelectionViewContainer.m new file mode 100644 index 000000000..3d78f76c1 --- /dev/null +++ b/UI/Contacts/UIxContactsSelectionViewContainer.m @@ -0,0 +1,27 @@ +/* UIxContactsSelectionViewContainer.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 "UIxContactsSelectionViewContainer.h" + +@implementation UIxContactsSelectionViewContainer + +@end diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 9981bc000..e57786c48 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -14,6 +14,11 @@ protectedBy = "View"; pageName = "UIxContactFoldersView"; }; + select = { + protectedBy = "View"; + pageName = "UIxContactFoldersView"; + actionName = "select"; + }; }; }; @@ -37,6 +42,7 @@ select = { protectedBy = "View"; pageName = "UIxContactsSelectionView"; + actionName = "select"; }; }; }; @@ -61,6 +67,7 @@ select = { protectedBy = "View"; pageName = "UIxContactsSelectionView"; + actionName = "select"; }; }; };