diff --git a/api/etemplate.php b/api/etemplate.php index 4be8f05cd9..b51ff0dfe9 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -17,7 +17,7 @@ const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|date(-time[^\s]*|-duration|-sinc const ADD_ET2_PREFIX_LAST_GROUP = 6; // unconditional of legacy add et2- prefix to this widgets -const ADD_ET2_PREFIX_LEGACY_REGEXP = '#<(description|label|image|vfs-mime|vfs-uid|vfs-gid|link|link-[a-z]+|favorites)\s([^>]+)/>#m'; +const ADD_ET2_PREFIX_LEGACY_REGEXP = '#<(description|label|avatar|lavatar|image|vfs-mime|vfs-uid|vfs-gid|link|link-[a-z]+|favorites)\s([^>]+)/>#m'; // switch evtl. set output-compression off, as we can't calculate a Content-Length header with transparent compression ini_set('zlib.output_compression', 0); diff --git a/api/js/etemplate/Et2Avatar/Et2Avatar.ts b/api/js/etemplate/Et2Avatar/Et2Avatar.ts index 4bbd367e36..dadeff5f79 100644 --- a/api/js/etemplate/Et2Avatar/Et2Avatar.ts +++ b/api/js/etemplate/Et2Avatar/Et2Avatar.ts @@ -87,7 +87,7 @@ export class Et2Avatar extends Et2Widget(SlotMixin(SlAvatar)) implements et2_IDe this.contact_id = ""; this.editable = false; this.crop = false; - this.size = "3em"; + this.size = "2.7em"; } /** @@ -318,7 +318,7 @@ export class Et2Avatar extends Et2Widget(SlotMixin(SlAvatar)) implements et2_IDe */ getDetachedAttributes(_attrs : string[]) { - _attrs.push("contact_id", "label", "href"); + _attrs.push("contact_id", "label", "href", "src"); } getDetachedNodes() diff --git a/api/js/etemplate/Et2Avatar/Et2LAvatar.ts b/api/js/etemplate/Et2Avatar/Et2LAvatar.ts index d6999a3fba..f9ce0e02f3 100644 --- a/api/js/etemplate/Et2Avatar/Et2LAvatar.ts +++ b/api/js/etemplate/Et2Avatar/Et2LAvatar.ts @@ -65,12 +65,19 @@ export class Et2LAvatar extends Et2Avatar { super.updated(changedProperties); - if (changedProperties.has("lname") || changedProperties.has("fname") || changedProperties.has("contact_id")) { - if (!this.src || !decodeURIComponent(this.src).match("lavatar=1") && (this.fname || this.lname) && this.contact_id) + if (changedProperties.has("lname") || changedProperties.has("fname") || changedProperties.has("contact_id") || changedProperties.has("src")) { + if (!this.src || decodeURIComponent(this.src).match("lavatar=1") && (this.fname || this.lname) && this.contact_id) { - this.initials = Et2LAvatar.lavatar(this.fname, this.lname, this.contact_id).initials; + let lavatar = Et2LAvatar.lavatar(this.fname, this.lname, this.contact_id); + this.initials = lavatar.initials; + this._baseNode.style.backgroundColor = lavatar.background; + } + else if (this.src) + { + this.image = this.src; } } + } /**