$image->show(); | $image->show(); | ||||
} else { | } else { | ||||
// Signalizes $.avatar() to display a defaultavatar | // Signalizes $.avatar() to display a defaultavatar | ||||
\OC_JSON::success(); | |||||
\OC_JSON::success(array("data"=> array("displayname"=> \OC_User::getDisplayName($user)) )); | |||||
} | } | ||||
} | } | ||||
var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken; | var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken; | ||||
$.get(url, function(result) { | $.get(url, function(result) { | ||||
if (typeof(result) === 'object') { | if (typeof(result) === 'object') { | ||||
$div.placeholder(user); | |||||
if (result.data && result.data.displayname) { | |||||
$div.placeholder(user, result.data.displayname); | |||||
} else { | |||||
$div.placeholder(user); | |||||
} | |||||
} else { | } else { | ||||
if (ie8fix === true) { | if (ie8fix === true) { | ||||
$div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">'); | $div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">'); |
$('#oldDisplayName').text($('#displayName').val()); | $('#oldDisplayName').text($('#displayName').val()); | ||||
// update displayName on the top right expand button | // update displayName on the top right expand button | ||||
$('#expandDisplayName').text($('#displayName').val()); | $('#expandDisplayName').text($('#displayName').val()); | ||||
updateAvatar(); | |||||
} | } | ||||
else{ | else{ | ||||
$('#newdisplayname').val(data.data.displayName); | $('#newdisplayname').val(data.data.displayName); |