diff --git a/NEWS b/NEWS index b33e85ef1..41a4bd9db 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ Bug fixes - [web] fixed position of ghost block when creating an event from DnD - [web] fixed avatar image in autocompletion - [web] restored expunge of current mailbox when leaving the Mail module + - [web] added support for multiple description values in LDAP entries (#3750) - [eas] fixed long GUID issue preventing sometimes synchronisation (#3460) 3.1.4 (2016-07-12) diff --git a/SoObjects/Contacts/NGVCard+SOGo.h b/SoObjects/Contacts/NGVCard+SOGo.h index 87b612eae..766a91120 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.h +++ b/SoObjects/Contacts/NGVCard+SOGo.h @@ -1,6 +1,6 @@ /* NGVCard+SOGo.h - this file is part of SOGo * - * Copyright (C) 2009-2015 Inverse inc. + * Copyright (C) 2009-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,6 +49,9 @@ - (NSString *) pager; - (NSCalendarDate *) birthday; +- (void) setNotes: (NSArray *) newNotes; +- (NSArray *) notes; + @end #endif /* NGVCARD_SOGO_H */ diff --git a/SoObjects/Contacts/NGVCard+SOGo.m b/SoObjects/Contacts/NGVCard+SOGo.m index ea4d2cb1f..d67622c26 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.m +++ b/SoObjects/Contacts/NGVCard+SOGo.m @@ -1,6 +1,6 @@ /* NGVCard+SOGo.m - this file is part of SOGo * - * Copyright (C) 2009-2015 Inverse inc. + * Copyright (C) 2009-2016 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -339,7 +339,11 @@ convention: setSingleValue: [ldifRecord objectForKey: @"c_info"] forKey: @""]; - [self setNote: [ldifRecord objectForKey: @"description"]]; + o = [ldifRecord objectForKey: @"description"]; + if ([o isKindOfClass: [NSArray class]]) + [self setNotes: o]; + else + [self setNote: o]; o = [ldifRecord objectForKey: @"vcardcategories"]; @@ -851,6 +855,40 @@ convention: return date; } +- (void) setNotes: (NSArray *) newNotes +{ + NSUInteger count, max; + + max = [newNotes count]; + for (count = 0; count < max; count++) + { + [self addChildWithTag: @"note" + types: nil + singleValue: [newNotes objectAtIndex: count]]; + } +} + + +- (NSArray *) notes +{ + NSArray *notes; + NSMutableArray *flattenedNotes; + NSString *note; + NSUInteger count, max; + + notes = [self childrenWithTag: @"note"]; + max = [notes count]; + flattenedNotes = [NSMutableArray arrayWithCapacity: max]; + + for (count = 0; count < max; count++) + { + note = [[notes objectAtIndex: count] flattenedValuesForKey: @""]; + [flattenedNotes addObject: note]; + } + + return flattenedNotes; +} + - (NSMutableDictionary *) quickRecordFromContent: (NSString *) theContent container: (id) theContainer { diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index 831b9b2a3..f590707de 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -705,22 +705,27 @@ // return [self _cardStringWithLabel: @"Timezone:" value: [card tz]]; // } -- (NSString *) note +- (NSArray *) notes { + NSMutableArray *notes; NSString *note; + NSUInteger count, max; - note = [card note]; - if (note) + notes = [NSMutableArray arrayWithArray: [card notes]]; + max = [notes count]; + for (count = 0; count < max; count++) { + note = [notes objectAtIndex: count]; note = [note stringByEscapingHTMLString]; note = [note stringByReplacingString: @"\r\n" withString: @"
"]; note = [note stringByReplacingString: @"\n" withString: @"
"]; + + [notes replaceObjectAtIndex: count withObject: note]; } - return note; - //return [self _cardStringWithLabel: @"Note:" value: note]; + return notes; } /* hrefs */ @@ -785,7 +790,7 @@ * @apiSuccess (Success 200) {String} [c_fn] Fullname * @apiSuccess (Success 200) {String} [c_screenname] Screen Name (X-AIM for now) * @apiSuccess (Success 200) {String} [tz] Timezone - * @apiSuccess (Success 200) {String} [note] Note + * @apiSuccess (Success 200) {String} [notes] Notes * @apiSuccess (Success 200) {String[]} allCategories All available categories * @apiSuccess (Success 200) {Object[]} [categories] Categories assigned to the card * @apiSuccess (Success 200) {String} categories.value Category name @@ -853,31 +858,21 @@ if (o) [data setObject: o forKey: @"nickname"]; o = [card title]; if ([o length] > 0) - { - [data setObject: o forKey: @"title"]; - } + [data setObject: o forKey: @"title"]; o = [card role]; if ([o length] > 0) - { - [data setObject: o forKey: @"role"]; - } + [data setObject: o forKey: @"role"]; o = [self orgUnits]; if ([o count] > 0) - { - [data setObject: o forKey: @"orgUnits"]; - } + [data setObject: o forKey: @"orgUnits"]; o = [card workCompany]; if ([o length] > 0) - { - [data setObject: o forKey: @"c_org"]; - } + [data setObject: o forKey: @"c_org"]; o = [card birthday]; if (o) - { - [data setObject: [o descriptionWithCalendarFormat: @"%Y-%m-%d"] + [data setObject: [o descriptionWithCalendarFormat: @"%Y-%m-%d"] forKey: @"birthday"]; - } o = [card tz]; if (o) [data setObject: o forKey: @"tz"]; @@ -893,8 +888,8 @@ o = [self urls]; if ([o count]) [data setObject: o forKey: @"urls"]; - o = [self note]; - if (o) [data setObject: o forKey: @"note"]; + o = [self notes]; + if (o) [data setObject: o forKey: @"notes"]; o = [self _fetchAndCombineCategoriesList]; if (o) [data setObject: o forKey: @"allCategories"]; if ([contact hasPhoto]) diff --git a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox index 8fa0c7de7..8acf87267 100644 --- a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox +++ b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox @@ -147,10 +147,12 @@ -
- -
-
+
+
+ +
+
+
diff --git a/UI/WebServerResources/js/Contacts/Card.service.js b/UI/WebServerResources/js/Contacts/Card.service.js index 29394e6fe..488c8bfe1 100644 --- a/UI/WebServerResources/js/Contacts/Card.service.js +++ b/UI/WebServerResources/js/Contacts/Card.service.js @@ -140,6 +140,7 @@ this.refs = []; this.categories = []; + this.notes = [this.note]; this.c_screenname = null; angular.extend(this, data); if (!this.$$fullname)