--- /dev/null
+/*
+ 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 <SOGoUI/UIxComponent.h>
+
+/*
+ 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 <NGiCal/NGiCal.h>
+#include <NGObjWeb/WOContext.h>
+#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 */
--- /dev/null
+<?xml version='1.0' standalone='yes'?>
+<span
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+ xmlns:rsrc="OGo:url"
+ class="aptview_text"
+>
+ <script language="JavaScript">
+ <var:string value="jsCode" const:escapeHTML="NO" />
+ </script>
+ <var:component className="AnaisSelector"
+ label:title="Search in Anais"
+ const:windowId="windowId"
+ var:callback="callbackName" />
+ <hr />
+ <table var:id="tableId">
+ <var:foreach list="attendees" item="attendee">
+ <tr>
+ <td><input type="checkbox"
+ checked="YES"
+ var:value="attendee.rfc822Email"
+ var:id="attendee.rfc822Email"
+ var:name="checkboxId"
+ /></td>
+ <td><var:string value="attendee.cnForDisplay" /></td>
+ </tr>
+ </var:foreach>
+ </table>
+</span>
/*
- Copyright (C) 2000-2004 SKYRIX Software AG
+ Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
*/
// $Id$
-
#include <SOGoUI/UIxComponent.h>
@interface AnaisSelector : UIxComponent
@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"
[self windowId]];
}
-@end
+@end /* AnaisSelector */
<?xml version='1.0' standalone='yes'?>
-
<span xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
+2004-08-15 Helge Hess <helge.hess@skyrix.com>
+
+ * added AnaisAttendeeSelector component (v0.9.4)
+
2004-08-12 Marcus Mueller <znek@mulle-kybernetik.com>
* AnaisUidSelector.[m|wox]: fixed all known problems (v0.9.3)
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../../..
# $Id: Version 165 2004-08-05 17:55:50Z znek $
-SUBMINOR_VERSION:=3
+SUBMINOR_VERSION:=4
provides = {
classes = (
- { name = AnaisUIProduct; },
- { name = AnaisSelector; },
+ { name = AnaisUIProduct; },
+ { name = AnaisSelector; },
+ { name = AnaisAttendeeSelector; },
);
WOComponents = (
- { name = AnaisSelector; },
+ { name = AnaisSelector; },
+ { name = AnaisAttendeeSelector; },
);
};
}
NSString *iCalString;
NSString *uri;
NSCalendarDate *sd, *ed;
- NSArray *attendees;
+ NSArray *attendees, *resources;
WORequest *req;
-
if (![[self clientObject] respondsToSelector:@selector(saveContentString:)]){
/* return 400 == Bad Request */
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 */
</tr>
<tr>
<td>
- <table border="0"
- cellpadding="2"
- width="100%"
- cellspacing="0"
- bgcolor="#e8e8e0"
+ <table border="0" cellpadding="2" cellspacing="0"
+ width="100%" bgcolor="#e8e8e0"
>
<tr>
<td align="left" colspan="2">