2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include <SOGoUI/UIxComponent.h>
28 Open a satellite window providing access to Anais.
31 title - button title to display to user
32 windowId - string to be used for uniquing this window to a particular
33 purpose (i.e. for adding participants)
34 division - Anais division
35 callback - name of JavaScript callback function to use in caller's page
36 extraAttributes - extra attributes to add as paramaters to the callback
39 <var:component className="AnaisSelector"
40 const:windowId="ParticipantSelection"
42 const:callback="addParticipant"
43 const:extraAttributes="givenName,initials"
47 @interface AnaisSelector : UIxComponent
53 NSString *extraAttributes;
56 - (void)setTitle:(NSString *)_title;
58 - (void)setWindowId:(NSString *)_winId;
59 - (NSString *)windowId;
60 - (void)setDivision:(NSString *)_division;
61 - (NSString *)division;
62 - (void)setCallback:(NSString *)_callback;
63 - (NSString *)callback;
65 - (NSString *)jsFunctionName;
66 - (NSString *)jsFunctionHref;
72 @implementation AnaisSelector
75 if ((self = [super init])) {
76 [self setTitle:@"Anais"];
77 [self setWindowId:@"Anais"];
78 [self setCallback:@"undefined"];
84 [self->title release];
85 [self->windowId release];
86 [self->division release];
87 [self->callback release];
88 [self->extraAttributes release];
94 - (void)setTitle:(NSString *)_title {
95 ASSIGNCOPY(self->title, _title);
101 - (void)setWindowId:(NSString *)_winId {
102 ASSIGNCOPY(self->windowId, _winId);
104 - (NSString *)windowId {
105 return self->windowId;
108 - (void)setDivision:(NSString *)_division {
109 ASSIGNCOPY(self->division, _division);
111 - (NSString *)division {
112 return self->division;
115 - (void)setCallback:(NSString *)_callback {
116 ASSIGNCOPY(self->callback, _callback);
118 - (NSString *)callback {
119 return self->callback;
122 - (void)setExtraAttributes:(NSString *)_extraAttributes {
123 ASSIGN(self->extraAttributes, _extraAttributes);
125 - (NSString *)extraAttributes {
126 return self->extraAttributes;
131 - (NSString *)jsFunctionName {
132 return [NSString stringWithFormat:@"openAnaisWindowWithId%@",
136 - (NSString *)jsFunctionHref {
137 return [NSString stringWithFormat:@"javascript:%@()",
138 [self jsFunctionName]];
141 - (NSString *)jsCode {
142 static NSString *codeFmt = \
144 @" var url = '/anais/Admin/Autres/aideFonc.php?m_fonc=%@&m_data=data1&m_type=Pour&m_nom=,%@&m_champ=mail,uid,sn%@&m_nature=BALI&m_agenda0#mon_etiquette';\n"
145 @" 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"
146 @" anaisWindow.focus();\n"
148 static NSString *divFmt = @"&m_type=%@";
149 NSString *fmt, *exAttrFmt;
152 fmt = [NSString stringWithFormat:divFmt, [self division]];
156 if([self extraAttributes])
157 exAttrFmt = [NSString stringWithFormat:@",%@", [self extraAttributes]];
161 return [NSString stringWithFormat:codeFmt,
162 [self jsFunctionName],
169 @end /* AnaisSelector */