diff --git a/NEWS b/NEWS index 9402793e3..464b13b57 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ New features Enhancements - [web] prevent using localhost on additional IMAP accounts - [web] renamed buttons of alarm toast (#3945) + - [web] load photos of LDAP-based address books in contacts list (#3942) Bug fixes - [core] honor blocking wrong login attemps within time interval (#2850) diff --git a/SoObjects/Contacts/SOGoContactSourceFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m index 446ce251c..a74515fae 100644 --- a/SoObjects/Contacts/SOGoContactSourceFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -338,6 +338,10 @@ [newRecord setObject: data forKey: @"contactInfo"]; } + // photo => hasPhoto + data = [oldRecord objectForKey: @"photo"]; + [newRecord setObject: [NSNumber numberWithInt: [data length] ? 1 : 0] forKey: @"hasPhoto"]; + recordSource = [oldRecord objectForKey: @"source"]; if ([recordSource conformsToProtocol: @protocol (SOGoDNSource)] && [[(NSObject *) recordSource MSExchangeHostname] length]) diff --git a/UI/WebServerResources/js/Common/Resource.service.js b/UI/WebServerResources/js/Common/Resource.service.js index b80f5b4a7..10977044e 100644 --- a/UI/WebServerResources/js/Common/Resource.service.js +++ b/UI/WebServerResources/js/Common/Resource.service.js @@ -56,6 +56,21 @@ return new Resource(this._http, this._q, '/' + path.join('/'), this._activeUser); }; + /** + * @function path + * @memberof Resource.prototype + * @desc Create a URL of the resource context with any number of additional segments + * @return an absolute URL + */ + Resource.prototype.path = function() { + var path = [this._path]; + + if (arguments.length > 0) + Array.prototype.push.apply(path, Array.prototype.slice.call(arguments)); + + return path.join('/'); + }; + /** * @function fetch * @memberof Resource.prototype diff --git a/UI/WebServerResources/js/Contacts/Card.service.js b/UI/WebServerResources/js/Contacts/Card.service.js index f08b462dd..d46829cb8 100644 --- a/UI/WebServerResources/js/Contacts/Card.service.js +++ b/UI/WebServerResources/js/Contacts/Card.service.js @@ -152,6 +152,8 @@ Card.$Preferences.avatar(this.$$email, 32, {no_404: true}).then(function(url) { _this.$$image = url; }); + if (this.hasphoto) + this.photoURL = Card.$$resource.path(this.pid, this.id, 'photo'); if (this.isgroup) this.c_component = 'vlist'; this.$avatarIcon = this.$isList()? 'group' : 'person';