Skip to content

Commit

Permalink
Load photos of LDAP-based address books in listing
Browse files Browse the repository at this point in the history
Fixes #3942
  • Loading branch information
cgx committed Dec 15, 2016
1 parent 15a3bf4 commit 651c0fd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions SoObjects/Contacts/SOGoContactSourceFolder.m
Expand Up @@ -338,6 +338,10 @@ - (NSDictionary *) _flattenedRecord: (NSDictionary *) oldRecord
[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 <SOGoDNSource>*) recordSource MSExchangeHostname] length])
Expand Down
15 changes: 15 additions & 0 deletions UI/WebServerResources/js/Common/Resource.service.js
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions UI/WebServerResources/js/Contacts/Card.service.js
Expand Up @@ -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';
Expand Down

0 comments on commit 651c0fd

Please sign in to comment.