From: helge Date: Sun, 15 Aug 2004 17:10:38 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/trunk@225 d1b88da0-ebda-0310-925b-ed51d... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d4044356cf7d77df5fea4797c033fdea7994e51;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/trunk@225 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Anais/AnaisAttendeeSelector.m b/SOGo/UI/Anais/AnaisAttendeeSelector.m new file mode 100644 index 00000000..df93edd1 --- /dev/null +++ b/SOGo/UI/Anais/AnaisAttendeeSelector.m @@ -0,0 +1,168 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + 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: AnaisSelector.m 184 2004-08-11 17:46:10Z znek $ + +#include + +/* + AnaisAttendeeSelector + + Select a set of attendees using Anais. + + Bindings: + attendees - array of iCalPerson objects + selectorID - string to be used as the identifier for form/JS elements +*/ + +@class iCalPerson; + +@interface AnaisAttendeeSelector : UIxComponent +{ + NSString *selectorID; + NSArray *attendees; + iCalPerson *attendee; +} + +@end + +#include +#include +#include "common.h" + +@implementation AnaisAttendeeSelector + +- (void)dealloc { + [self->selectorID release]; + [self->attendee release]; + [self->attendees release]; + [super dealloc]; +} + +/* notifications */ + +- (void)sleep { + [self->attendee release]; self->attendee = nil; + [super sleep]; +} + +/* accessors */ + +- (void)setAttendees:(NSArray *)_attendees { + ASSIGN(self->attendees, _attendees); +} +- (NSArray *)attendees { + return self->attendees; +} + +- (void)setAttendee:(iCalPerson *)_attendee { + ASSIGN(self->attendee, _attendee); +} +- (iCalPerson *)attendee { + return self->attendee; +} + +/* id accessors */ + +- (void)setSelectorID:(NSString *)_value { + ASSIGNCOPY(self->selectorID, _value); +} +- (NSString *)selectorID { + return self->selectorID; +} +- (NSString *)capitalizedSelectorID { + return [[self selectorID] capitalizedString]; +} + +- (NSString *)windowId { + /* eg: 'Resources' */ + return [[self capitalizedSelectorID] stringByAppendingString:@"s"]; +} +- (NSString *)callbackName { + /* eg: 'addResource' */ + return [@"add" stringByAppendingString:[self capitalizedSelectorID]]; +} +- (NSString *)tableId { + /* eg: 'resources' */ + return [[self selectorID] stringByAppendingString:@"s"]; +} +- (NSString *)checkboxId { + /* eg: 'resources' */ + return [self tableId]; /* TODO: znek, is this ok? */ +} + +/* handling requests */ + +- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { + [self logWithFormat:@"Note: will take values ..."]; + [super takeValuesFromRequest:_rq inContext:_ctx]; +} + +/* response generation */ + +- (NSString *)jsCode { + NSMutableString *ms; + WOContext *ctx; + NSString *s; + + ms = [NSMutableString stringWithCapacity:128]; + + ctx = [self context]; + if (![[ctx valueForKey:@"HasAddTableAnaisAttendeeSelector"] boolValue]) { + static NSString *script = \ + @"function addToTable(tableId, type, cn, dn, email, uid, sn) {\n" + @" var test = document.getElementById(email);" + @" if(test)" + @" return;" + @"" + @" var table = document.getElementById(tableId);" + @" var tr = document.createElement('tr');" + @" var td, checkbox, text;" + @"" + @" td = document.createElement('td');" + @" checkbox = document.createElement('input');" + @" checkbox.setAttribute('type', 'checkbox');" + @" checkbox.setAttribute('checked', 'checked');" + @" checkbox.setAttribute('value', email + ';' + cn);" + @" checkbox.setAttribute('id', email);" + @" checkbox.setAttribute('name', tableId);" + @" td.appendChild(checkbox);" + @" tr.appendChild(td);" + @" td = document.createElement('td');" + @" text = document.createTextNode(cn);" + @" td.appendChild(text);" + @" tr.appendChild(td);" + @" table.appendChild(tr);" + @"}\n"; + [ms appendString:script]; + + [ctx takeValue:[NSNumber numberWithBool:YES] + forKey:@"HasAddTableAnaisAttendeeSelector"]; + } + + s = + @"function %@(type, cn, dn, email, uid, sn) {\n" + @" addToTable('%@', type, cn, dn, email, uid, sn);\n" + @"}\n"; + [ms appendFormat:s, [self callbackName], [self tableId]]; + return ms; +} + +@end /* AnaisAttendeeSelector */ diff --git a/SOGo/UI/Anais/AnaisAttendeeSelector.wox b/SOGo/UI/Anais/AnaisAttendeeSelector.wox new file mode 100644 index 00000000..74047179 --- /dev/null +++ b/SOGo/UI/Anais/AnaisAttendeeSelector.wox @@ -0,0 +1,30 @@ + + + + +
+ + + + + + + +
+
diff --git a/SOGo/UI/Anais/AnaisSelector.m b/SOGo/UI/Anais/AnaisSelector.m index 9cba783f..8b1b34e5 100644 --- a/SOGo/UI/Anais/AnaisSelector.m +++ b/SOGo/UI/Anais/AnaisSelector.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -20,7 +20,6 @@ */ // $Id$ - #include @interface AnaisSelector : UIxComponent @@ -50,66 +49,66 @@ @implementation AnaisSelector - (id)init { - self = [super init]; - if(self) { - [self setTitle:@"Anais"]; - [self setWindowId:@"Anais"]; - [self setCallback:@"undefined"]; - } - return self; + if ((self = [super init])) { + [self setTitle:@"Anais"]; + [self setWindowId:@"Anais"]; + [self setCallback:@"undefined"]; + } + return self; } - (void)dealloc { - [self->title release]; - [self->windowId release]; - [self->division release]; - [self->callback release]; - [super dealloc]; + [self->title release]; + [self->windowId release]; + [self->division release]; + [self->callback release]; + [super dealloc]; } +/* accessors */ + - (void)setTitle:(NSString *)_title { - ASSIGN(self->title, _title); + ASSIGNCOPY(self->title, _title); } - (NSString *)title { - return self->title; + return self->title; } - (void)setWindowId:(NSString *)_winId { - ASSIGN(self->windowId, _winId); + ASSIGNCOPY(self->windowId, _winId); } - (NSString *)windowId { - return self->windowId; + return self->windowId; } - (void)setDivision:(NSString *)_division { - ASSIGN(self->division, _division); + ASSIGNCOPY(self->division, _division); } - (NSString *)division { - return self->division; + return self->division; } - (void)setCallback:(NSString *)_callback { - ASSIGN(self->callback, _callback); + ASSIGNCOPY(self->callback, _callback); } - (NSString *)callback { - return self->callback; + return self->callback; } - /* JavaScript */ - (NSString *)jsFunctionName { - return [NSString stringWithFormat:@"openAnaisWindowWithId%@", + return [NSString stringWithFormat:@"openAnaisWindowWithId%@", [self windowId]]; } - (NSString *)jsFunctionHref { - return [NSString stringWithFormat:@"javascript:%@()", + return [NSString stringWithFormat:@"javascript:%@()", [self jsFunctionName]]; } - (NSString *)jsCode { - static NSString *codeFmt = \ + static NSString *codeFmt = \ @"function %@() {\n" @" var url = '/anais/aideAnais.php?m_fonc=%@%@&m_champ=mail,uid,sn#mon_etiquette';\n" @" var anaisWindow = window.open(url, '%@', 'width=350, height=600, left=10, top=10, toolbar=no, dependent=yes, menubar=no, location=no, resizable=yes, scrollbars=yes, directories=no, status=no');\n" @@ -130,4 +129,4 @@ [self windowId]]; } -@end +@end /* AnaisSelector */ diff --git a/SOGo/UI/Anais/AnaisSelector.wox b/SOGo/UI/Anais/AnaisSelector.wox index 1f192869..a868809f 100644 --- a/SOGo/UI/Anais/AnaisSelector.wox +++ b/SOGo/UI/Anais/AnaisSelector.wox @@ -1,5 +1,4 @@ - + + * added AnaisAttendeeSelector component (v0.9.4) + 2004-08-12 Marcus Mueller * AnaisUidSelector.[m|wox]: fixed all known problems (v0.9.3) diff --git a/SOGo/UI/Anais/GNUmakefile b/SOGo/UI/Anais/GNUmakefile index 554bf368..ef9450d4 100644 --- a/SOGo/UI/Anais/GNUmakefile +++ b/SOGo/UI/Anais/GNUmakefile @@ -12,14 +12,14 @@ AnaisUI_OBJC_FILES += \ AnaisUIProduct.m \ AnaisSelector.m \ AnaisUidSelector.m \ - + AnaisAttendeeSelector.m \ AnaisUI_RESOURCE_FILES += \ Version \ product.plist \ AnaisSelector.wox \ AnaisUidSelector.wox \ - + AnaisAttendeeSelector.wox ADDITIONAL_INCLUDE_DIRS += \ -I.. -I../.. -I../../.. diff --git a/SOGo/UI/Anais/Version b/SOGo/UI/Anais/Version index 2d11c00f..deba2e25 100644 --- a/SOGo/UI/Anais/Version +++ b/SOGo/UI/Anais/Version @@ -1,3 +1,3 @@ # $Id: Version 165 2004-08-05 17:55:50Z znek $ -SUBMINOR_VERSION:=3 +SUBMINOR_VERSION:=4 diff --git a/SOGo/UI/Anais/bundle-info.plist b/SOGo/UI/Anais/bundle-info.plist index 050b134f..bb9ae84f 100644 --- a/SOGo/UI/Anais/bundle-info.plist +++ b/SOGo/UI/Anais/bundle-info.plist @@ -10,12 +10,14 @@ provides = { classes = ( - { name = AnaisUIProduct; }, - { name = AnaisSelector; }, + { name = AnaisUIProduct; }, + { name = AnaisSelector; }, + { name = AnaisAttendeeSelector; }, ); WOComponents = ( - { name = AnaisSelector; }, + { name = AnaisSelector; }, + { name = AnaisAttendeeSelector; }, ); }; } diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.m b/SOGo/UI/Scheduler/UIxAppointmentEditor.m index 83853c86..cbeebb64 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.m +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.m @@ -350,9 +350,8 @@ NSString *iCalString; NSString *uri; NSCalendarDate *sd, *ed; - NSArray *attendees; + NSArray *attendees, *resources; WORequest *req; - if (![[self clientObject] respondsToSelector:@selector(saveContentString:)]){ /* return 400 == Bad Request */ @@ -391,11 +390,16 @@ attendees = [self getICalPersonsFromFormValues: [req formValuesForKey:@"participants"] treatAsResource:NO]; - [apt setAttendees:attendees]; - attendees = [self getICalPersonsFromFormValues: + resources = [self getICalPersonsFromFormValues: [req formValuesForKey:@"resources"] treatAsResource:YES]; - [apt appendAttendees:attendees]; + if ([resources count] > 0) { + attendees = ([attendees count] > 0) + ? [attendees arrayByAddingObjectsFromArray:resources] + : resources; + } + [apt setAttendees:attendees]; + [apt setOrganizer:[self getOrganizer]]; /* receive current representation for save operation */ diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.wox b/SOGo/UI/Scheduler/UIxAppointmentEditor.wox index 063e6f32..322dfa8c 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.wox @@ -105,11 +105,8 @@ -