Support multiple descriptions from LDAP entries

Fixes #3750
pull/27/merge
Francis Lachapelle 2016-08-01 15:55:50 -04:00
parent 6071375c29
commit 9d65d7c3a8
6 changed files with 70 additions and 30 deletions

1
NEWS
View File

@ -21,6 +21,7 @@ Bug fixes
- [web] fixed position of ghost block when creating an event from DnD - [web] fixed position of ghost block when creating an event from DnD
- [web] fixed avatar image in autocompletion - [web] fixed avatar image in autocompletion
- [web] restored expunge of current mailbox when leaving the Mail module - [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) - [eas] fixed long GUID issue preventing sometimes synchronisation (#3460)
3.1.4 (2016-07-12) 3.1.4 (2016-07-12)

View File

@ -1,6 +1,6 @@
/* NGVCard+SOGo.h - this file is part of SOGo /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -49,6 +49,9 @@
- (NSString *) pager; - (NSString *) pager;
- (NSCalendarDate *) birthday; - (NSCalendarDate *) birthday;
- (void) setNotes: (NSArray *) newNotes;
- (NSArray *) notes;
@end @end
#endif /* NGVCARD_SOGO_H */ #endif /* NGVCARD_SOGO_H */

View File

@ -1,6 +1,6 @@
/* NGVCard+SOGo.m - this file is part of SOGo /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -339,7 +339,11 @@ convention:
setSingleValue: [ldifRecord objectForKey: @"c_info"] setSingleValue: [ldifRecord objectForKey: @"c_info"]
forKey: @""]; 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"]; o = [ldifRecord objectForKey: @"vcardcategories"];
@ -851,6 +855,40 @@ convention:
return date; 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 - (NSMutableDictionary *) quickRecordFromContent: (NSString *) theContent
container: (id) theContainer container: (id) theContainer
{ {

View File

@ -705,22 +705,27 @@
// return [self _cardStringWithLabel: @"Timezone:" value: [card tz]]; // return [self _cardStringWithLabel: @"Timezone:" value: [card tz]];
// } // }
- (NSString *) note - (NSArray *) notes
{ {
NSMutableArray *notes;
NSString *note; NSString *note;
NSUInteger count, max;
note = [card note]; notes = [NSMutableArray arrayWithArray: [card notes]];
if (note) max = [notes count];
for (count = 0; count < max; count++)
{ {
note = [notes objectAtIndex: count];
note = [note stringByEscapingHTMLString]; note = [note stringByEscapingHTMLString];
note = [note stringByReplacingString: @"\r\n" note = [note stringByReplacingString: @"\r\n"
withString: @"<br />"]; withString: @"<br />"];
note = [note stringByReplacingString: @"\n" note = [note stringByReplacingString: @"\n"
withString: @"<br />"]; withString: @"<br />"];
[notes replaceObjectAtIndex: count withObject: note];
} }
return note; return notes;
//return [self _cardStringWithLabel: @"Note:" value: note];
} }
/* hrefs */ /* hrefs */
@ -785,7 +790,7 @@
* @apiSuccess (Success 200) {String} [c_fn] Fullname * @apiSuccess (Success 200) {String} [c_fn] Fullname
* @apiSuccess (Success 200) {String} [c_screenname] Screen Name (X-AIM for now) * @apiSuccess (Success 200) {String} [c_screenname] Screen Name (X-AIM for now)
* @apiSuccess (Success 200) {String} [tz] Timezone * @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) {String[]} allCategories All available categories
* @apiSuccess (Success 200) {Object[]} [categories] Categories assigned to the card * @apiSuccess (Success 200) {Object[]} [categories] Categories assigned to the card
* @apiSuccess (Success 200) {String} categories.value Category name * @apiSuccess (Success 200) {String} categories.value Category name
@ -853,31 +858,21 @@
if (o) [data setObject: o forKey: @"nickname"]; if (o) [data setObject: o forKey: @"nickname"];
o = [card title]; o = [card title];
if ([o length] > 0) if ([o length] > 0)
{ [data setObject: o forKey: @"title"];
[data setObject: o forKey: @"title"];
}
o = [card role]; o = [card role];
if ([o length] > 0) if ([o length] > 0)
{ [data setObject: o forKey: @"role"];
[data setObject: o forKey: @"role"];
}
o = [self orgUnits]; o = [self orgUnits];
if ([o count] > 0) if ([o count] > 0)
{ [data setObject: o forKey: @"orgUnits"];
[data setObject: o forKey: @"orgUnits"];
}
o = [card workCompany]; o = [card workCompany];
if ([o length] > 0) if ([o length] > 0)
{ [data setObject: o forKey: @"c_org"];
[data setObject: o forKey: @"c_org"];
}
o = [card birthday]; o = [card birthday];
if (o) if (o)
{ [data setObject: [o descriptionWithCalendarFormat: @"%Y-%m-%d"]
[data setObject: [o descriptionWithCalendarFormat: @"%Y-%m-%d"]
forKey: @"birthday"]; forKey: @"birthday"];
}
o = [card tz]; o = [card tz];
if (o) [data setObject: o forKey: @"tz"]; if (o) [data setObject: o forKey: @"tz"];
@ -893,8 +888,8 @@
o = [self urls]; o = [self urls];
if ([o count]) [data setObject: o forKey: @"urls"]; if ([o count]) [data setObject: o forKey: @"urls"];
o = [self note]; o = [self notes];
if (o) [data setObject: o forKey: @"note"]; if (o) [data setObject: o forKey: @"notes"];
o = [self _fetchAndCombineCategoriesList]; o = [self _fetchAndCombineCategoriesList];
if (o) [data setObject: o forKey: @"allCategories"]; if (o) [data setObject: o forKey: @"allCategories"];
if ([contact hasPhoto]) if ([contact hasPhoto])

View File

@ -147,10 +147,12 @@
</div> </div>
</div> </div>
<div class="pseudo-input-container" ng-show="editor.card.note"> <div class="section" ng-show="editor.card.notes">
<label class="pseudo-input-label"><var:string label:value="Note"/></label> <div class="pseudo-input-container" ng-repeat="note in editor.card.notes">
<div class="pseudo-input-field"> <label class="pseudo-input-label"><var:string label:value="Note"/></label>
<div ng-bind-html="editor.card.note"><!-- note --></div> <div class="pseudo-input-field">
<div ng-bind-html="note"><!-- note --></div>
</div>
</div> </div>
</div> </div>

View File

@ -140,6 +140,7 @@
this.refs = []; this.refs = [];
this.categories = []; this.categories = [];
this.notes = [this.note];
this.c_screenname = null; this.c_screenname = null;
angular.extend(this, data); angular.extend(this, data);
if (!this.$$fullname) if (!this.$$fullname)