2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OGo
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
24 #include <SOGoUI/UIxComponent.h>
26 @interface UIxContactSelector : UIxComponent
33 - (void)setTitle:(NSString *)_title;
35 - (void)setWindowId:(NSString *)_winId;
36 - (NSString *)windowId;
37 - (void)setCallback:(NSString *)_callback;
38 - (NSString *)callback;
40 - (NSString *)relativeContactsPath;
42 - (NSString *)jsFunctionName;
43 - (NSString *)jsFunctionHref;
48 #include <NGExtensions/NGExtensions.h>
50 @implementation UIxContactSelector
53 if ((self = [super init])) {
54 [self setTitle:@"UIxContacts"];
55 [self setWindowId:@"UIxContacts"];
56 [self setCallback:@"undefined"];
62 [self->title release];
63 [self->windowId release];
64 [self->callback release];
70 - (void)setTitle:(NSString *)_title {
71 ASSIGNCOPY(self->title, _title);
77 - (void)setWindowId:(NSString *)_winId {
78 ASSIGNCOPY(self->windowId, _winId);
80 - (NSString *)windowId {
81 return self->windowId;
84 - (void)setCallback:(NSString *)_callback {
85 ASSIGNCOPY(self->callback, _callback);
87 - (NSString *)callback {
88 return self->callback;
93 - (NSString *)relativeContactsPath {
94 return [self relativePathToUserFolderSubPath:@"Contacts/select"];
99 - (NSString *)jsFunctionName {
100 return [NSString stringWithFormat:@"openUIxContactsListViewWindowWithId%@",
104 - (NSString *)jsFunctionHref {
105 return [NSString stringWithFormat:@"javascript:%@()",
106 [self jsFunctionName]];
109 - (NSString *)jsCode {
110 static NSString *codeFmt = \
112 @" var url = '%@?callback=%@';\n"
113 @" var contactsWindow = window.open(url, '%@', 'width=600, height=400, left=10, top=10, toolbar=no, dependent=yes, menubar=no, location=no, resizable=yes, scrollbars=yes, directories=no, status=no');\n"
114 @" contactsWindow.focus();\n"
116 return [NSString stringWithFormat:codeFmt,
117 [self jsFunctionName],
118 [self relativeContactsPath],
123 @end /* UIxContactSelector */