From 3bc87f19572e441bb921b1ca25bfbc505db2dfb6 Mon Sep 17 00:00:00 2001 From: maxime Date: Wed, 13 Jul 2005 14:25:16 +0000 Subject: [PATCH] Contacts imported from Anais now got CN set from LDAP git-svn-id: http://svn.opengroupware.org/SOGo/trunk@738 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Anais/AnaisAttendeeSelector.m | 8 +--- SOGo/UI/Anais/AnaisSelector.m | 2 +- SOGo/UI/Contacts/UIxContactEditorBase.h | 1 + SOGo/UI/Contacts/UIxContactEditorBase.m | 45 ++++++++++++------- .../Templates/ContactsUI/UIxContactEditor.wox | 7 ++- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/SOGo/UI/Anais/AnaisAttendeeSelector.m b/SOGo/UI/Anais/AnaisAttendeeSelector.m index be53632a..1377ab8e 100644 --- a/SOGo/UI/Anais/AnaisAttendeeSelector.m +++ b/SOGo/UI/Anais/AnaisAttendeeSelector.m @@ -340,13 +340,7 @@ static BOOL debugOn = NO; // @"function %@(type, cn, dn, email, uid, sn) {\n" // @" addToTable('%@', type, cn, dn, email, uid, sn);\n" // @"}\n"; - @"function %@() {\n" - @" var type=arguments[0];\n" - @" var email=arguments[1];\n" - @" var uid=arguments[2];\n" - @" var sn=arguments[3];\n" - @" var cn=arguments[4];\n" - @" var dn=arguments[5];\n" + @"function %@(type, email, uid, sn, cn, dn) {\n" @" addToTable('%@', type, cn, dn, email, uid, sn);\n" @"}\n"; diff --git a/SOGo/UI/Anais/AnaisSelector.m b/SOGo/UI/Anais/AnaisSelector.m index fe8f003e..07cea046 100644 --- a/SOGo/UI/Anais/AnaisSelector.m +++ b/SOGo/UI/Anais/AnaisSelector.m @@ -141,7 +141,7 @@ - (NSString *)jsCode { static NSString *codeFmt = \ @"function %@() {\n" - @" var url = '/anais/Admin/Autres/aideFonc.php?m_fonc=%@&m_data=data1&m_type=Pour&m_nom=Titre,Bandeau%@&m_champ=mail,uid,sn%@&m_nature=BALI&m_agenda0#mon_etiquette';\n" + @" 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" @" 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" @"}"; diff --git a/SOGo/UI/Contacts/UIxContactEditorBase.h b/SOGo/UI/Contacts/UIxContactEditorBase.h index b9a26c55..af041c69 100644 --- a/SOGo/UI/Contacts/UIxContactEditorBase.h +++ b/SOGo/UI/Contacts/UIxContactEditorBase.h @@ -30,6 +30,7 @@ { NSString *contentString; NSString *errorText; + NSString *anaisCN; NSMutableDictionary *snapshot; /* contains the values for editing */ } diff --git a/SOGo/UI/Contacts/UIxContactEditorBase.m b/SOGo/UI/Contacts/UIxContactEditorBase.m index 6e67a38a..f1b3ad64 100644 --- a/SOGo/UI/Contacts/UIxContactEditorBase.m +++ b/SOGo/UI/Contacts/UIxContactEditorBase.m @@ -35,6 +35,7 @@ - (void)dealloc { [self->snapshot release]; + [self->anaisCN release]; [self->errorText release]; [self->contentString release]; [super dealloc]; @@ -63,10 +64,20 @@ - (NSString *)errorText { return self->errorText; } + - (BOOL)hasErrorText { return [self->errorText length] > 0 ? YES : NO; } + +- (void)setAnaisCN:(NSString *)_txt { + ASSIGNCOPY(self->anaisCN, _txt); +} +- (NSString *)anaisCN { + return self->anaisCN; +} + + /* load/store content format */ - (void)loadValuesFromContentString:(NSString *)_s { @@ -108,8 +119,9 @@ } [self->snapshot setObject:sn forKey:@"sn"]; } - - if (sn == nil && gn == nil) + if ([self->anaisCN length] > 0 ) + cn = self->anaisCN; + else if (sn == nil && gn == nil) cn = @"[noname]"; else if (sn == nil) cn = gn; @@ -137,21 +149,24 @@ @" return s;\n" @"}\n" @"\n" - @"function copyContact()" + @"function copyContact(type, email, uid, sn," + @"cn, givenName, telephoneNumber, facsimileTelephoneNumber, mobile, postalAddress, homePostalAddress, departmentNumber, l)" @"{\n" - @" var type = arguments[0]; \n" - @" var email = arguments[1]; \n" - @" var uid = arguments[2]; \n" - @" var sn = arguments[3]; \n" - @" var givenName = arguments[4]; \n" - @" var telephoneNumber = arguments[5]; \n" - @" var facsimileTelephoneNumber = arguments[6]; \n" - @" var mobile = arguments[7]; \n" - @" var postalAddress = arguments[8]; \n" - @" var homePostalAddress = arguments[9]; \n" - @" var departmentNumber = arguments[10]; \n" - @" var l = arguments[11]; \n" + // @" var type = arguments[0]; \n" + // @" var email = arguments[1]; \n" + // @" var uid = arguments[2]; \n" + // @" var sn = arguments[3]; \n" + // @" var givenName = arguments[4]; \n" + // @" var telephoneNumber = arguments[5]; \n" + // @" var facsimileTelephoneNumber = arguments[6]; \n" + // @" var mobile = arguments[7]; \n" + // @" var postalAddress = arguments[8]; \n" + // @" var homePostalAddress = arguments[9]; \n" + // @" var departmentNumber = arguments[10]; \n" + // @" var l = arguments[11]; \n" @" var e;\n" + @" e = document.getElementById('cn');\n" + @" e.setAttribute('value', unescapeCallbackParameter(cn));\n" @" e = document.getElementById('email');\n" @" e.setAttribute('value', email);\n" @" e = document.getElementById('sn');\n" diff --git a/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox b/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox index f6fca769..fb20ce62 100644 --- a/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox +++ b/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox @@ -53,7 +53,7 @@ const:windowId="UIxContactTemplates" label:title="Copy from Anais" const:callback="copyContact" - const:extraAttributes="givenName,telephoneNumber,facsimileTelephoneNumber,mobile,postalAddress,homePostalAddress,departmentNumber,l" + const:extraAttributes="cn, givenName,telephoneNumber,facsimileTelephoneNumber,mobile,postalAddress,homePostalAddress,departmentNumber,l" /> @@ -88,6 +88,11 @@ +