From: znek Date: Wed, 11 Aug 2004 14:13:40 +0000 (+0000) Subject: better Anais integration X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd59f789a0926863b84d6e1e037d3bd6f11ec14e;p=scalable-opengroupware.org better Anais integration git-svn-id: http://svn.opengroupware.org/SOGo/trunk@180 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Anais/AnaisSelector.m b/SOGo/UI/Anais/AnaisSelector.m index e12bb4e7..ecde1632 100644 --- a/SOGo/UI/Anais/AnaisSelector.m +++ b/SOGo/UI/Anais/AnaisSelector.m @@ -23,14 +23,111 @@ #include - @interface AnaisSelector : UIxComponent { + NSString *title; + NSString *windowId; + NSString *division; + NSString *callback; } +- (void)setTitle:(NSString *)_title; +- (NSString *)title; +- (void)setWindowId:(NSString *)_winId; +- (NSString *)windowId; +- (void)setDivision:(NSString *)_division; +- (NSString *)division; +- (void)setCallback:(NSString *)_callback; +- (NSString *)callback; + +- (NSString *)jsFunctionName; +- (NSString *)jsFunctionHref; +- (NSString *)getCode; @end +#include "common.h" @implementation AnaisSelector +- (id)init { + self = [super init]; + if(self) { + [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]; +} + +- (void)setTitle:(NSString *)_title { + ASSIGN(self->title, _title); +} +- (NSString *)title { + return self->title; +} + +- (void)setWindowId:(NSString *)_winId { + ASSIGN(self->windowId, _winId); +} +- (NSString *)windowId { + return self->windowId; +} + +- (void)setDivision:(NSString *)_division { + ASSIGN(self->division, _division); +} +- (NSString *)division { + return self->division; +} + +- (void)setCallback:(NSString *)_callback { + ASSIGN(self->callback, _callback); +} +- (NSString *)callback { + return self->callback; +} + + +/* JavaScript */ + +- (NSString *)jsFunctionName { + return [NSString stringWithFormat:@"openAnaisWindowWithId%@", + [self windowId]]; +} + +- (NSString *)jsFunctionHref { + return [NSString stringWithFormat:@"javascript:%@()", + [self jsFunctionName]]; +} + +- (NSString *)getCode { + 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" + @" anaisWindow.focus();\n" + @"}"; + static NSString *divFmt = @"&m_type=%@"; + NSString *fmt; + + if([self division]) + fmt = [NSString stringWithFormat:divFmt, [self division]]; + else + fmt = @""; + + return [NSString stringWithFormat:codeFmt, + [self jsFunctionName], + [self callback], + fmt, + [self windowId]]; +} + @end diff --git a/SOGo/UI/Anais/AnaisSelector.wox b/SOGo/UI/Anais/AnaisSelector.wox index edf773ec..6e67a5e4 100644 --- a/SOGo/UI/Anais/AnaisSelector.wox +++ b/SOGo/UI/Anais/AnaisSelector.wox @@ -1,20 +1,14 @@ -
-

- show tree -

-

-
- -

-
+> + + + diff --git a/SOGo/UI/Anais/ChangeLog b/SOGo/UI/Anais/ChangeLog index f9f61cec..a3e53f0a 100644 --- a/SOGo/UI/Anais/ChangeLog +++ b/SOGo/UI/Anais/ChangeLog @@ -1,3 +1,10 @@ +2004-08-11 Marcus Mueller + + * AnaisSelector.[m|wox]: added several associations used for uniquing + the selector and one for preselecting a certain division (LDAP). + + * common.h: added for convenience. + 2004-08-10 Marcus Mueller * ChangeLog: created. diff --git a/SOGo/UI/Anais/common.h b/SOGo/UI/Anais/common.h new file mode 100644 index 00000000..cab9266e --- /dev/null +++ b/SOGo/UI/Anais/common.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index eb79c468..e25b9d1c 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,14 @@ +2004-08-11 Marcus Mueller + + * v0.9.17 + + * product.plist: removed "yearprintview" method - this doesn't exist. + + * English.lproj/default.strings: more labels (these need to be added + to the French version!) + + * UIxAppointmentEditor.[m|wox]: nice Anais integration showing up. ;-) + 2004-08-10 Marcus Mueller * v0.9.16 diff --git a/SOGo/UI/Scheduler/English.lproj/default.strings b/SOGo/UI/Scheduler/English.lproj/default.strings index 396ab895..4082bcaf 100644 --- a/SOGo/UI/Scheduler/English.lproj/default.strings +++ b/SOGo/UI/Scheduler/English.lproj/default.strings @@ -83,6 +83,7 @@ "Participants" = "Participants"; "Search resources" = "Search resources"; "Resources" = "Resources"; +"Search in Anais" = "Search in Anaïs"; /* calendar modes */ diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.m b/SOGo/UI/Scheduler/UIxAppointmentEditor.m index 4cb48e19..7dff1c61 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.m +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.m @@ -181,6 +181,44 @@ } +/* JavaScript */ + +- (NSString *)jsCode { + 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', '1');" + @" checkbox.setAttribute('id', email);" + @" checkbox.setAttribute('name', email);" + @" td.appendChild(checkbox);" + @" tr.appendChild(td);" + @" td = document.createElement('td');" + @" text = document.createTextNode(cn);" + @" td.appendChild(text);" + @" tr.appendChild(td);" + @" table.appendChild(tr);" + @"}\n" + @"function addParticipant(type, cn, dn, email, uid, sn) {\n" + @" addToTable('participants', type, cn, dn, email, uid, sn);\n" + @"}\n" + @"function addResource(type, cn, dn, email, uid, sn) {\n" + @" addToTable('resources', type, cn, dn, email, uid, sn);\n" + @"}\n" + @""; + return script; +} + /* helper */ - (NSString *)uriAsFormat { diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.wox b/SOGo/UI/Scheduler/UIxAppointmentEditor.wox index edf75198..3c04fdbe 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.wox @@ -124,17 +124,27 @@ : - + + -