mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-16 19:41:45 +02:00
implement onlyEmail attribute for et2-select-mail to only display email address, even if we have a full rfc822 address and use it for aliases and forwards in admin mail
This commit is contained in:
@ -66,6 +66,13 @@ export class Et2SelectEmail extends Et2Select
|
||||
*/
|
||||
includeLists: {type: Boolean},
|
||||
|
||||
/**
|
||||
* If the email is a contact, we normally show the contact name instead of the email.
|
||||
* Set to true to turn this off and always show just the email
|
||||
* Mutually exclusive with fullEmail!
|
||||
*/
|
||||
onlyEmail: {type: Boolean},
|
||||
|
||||
/**
|
||||
* Show the full, original value email address under all circumstances, rather than the contact name for known contacts
|
||||
*/
|
||||
@ -85,6 +92,7 @@ export class Et2SelectEmail extends Et2Select
|
||||
this.includeLists = false;
|
||||
this.multiple = false;
|
||||
this.fullEmail = false;
|
||||
this.onlyEmail = false;
|
||||
this.defaultValidators.push(new IsEmail(this.allowPlaceholder));
|
||||
}
|
||||
|
||||
@ -190,6 +198,7 @@ export class Et2SelectEmail extends Et2Select
|
||||
let tag = super._createTagNode(item);
|
||||
|
||||
tag.fullEmail = this.fullEmail;
|
||||
tag.onlyEmail = this.onlyEmail;
|
||||
|
||||
// Re-set after setting fullEmail as that can change what we show
|
||||
tag.textContent = item.getTextLabel().trim();
|
||||
|
@ -72,6 +72,13 @@ export class Et2EmailTag extends Et2Tag
|
||||
reflect: true,
|
||||
},
|
||||
|
||||
/**
|
||||
* If the email is a contact, we normally show the contact name instead of the email.
|
||||
* Set to true to turn this off and always show just the email
|
||||
* Mutually exclusive with fullEmail!
|
||||
*/
|
||||
onlyEmail: {type: Boolean},
|
||||
|
||||
/**
|
||||
* If the email is a contact, we normally show the contact name instead of the email.
|
||||
* Set to true to turn this off and always show the email
|
||||
@ -85,6 +92,7 @@ export class Et2EmailTag extends Et2Tag
|
||||
super(...args);
|
||||
this.contactPlus = true;
|
||||
this.fullEmail = false;
|
||||
this.onlyEmail = false;
|
||||
this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
||||
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
@ -184,12 +192,17 @@ export class Et2EmailTag extends Et2Tag
|
||||
{
|
||||
let content = this.value;
|
||||
// If there's a name, just show the name, otherwise show the email
|
||||
if(Et2EmailTag.email_cache[this.value])
|
||||
if(!this.onlyEmail && Et2EmailTag.email_cache[this.value])
|
||||
{
|
||||
// Append current value as email, data may have work & home email in it
|
||||
content = (Et2EmailTag.email_cache[this.value]?.n_fn || "") + " <" + this.value + ">"
|
||||
}
|
||||
if(!this.fullEmail)
|
||||
if (this.onlyEmail)
|
||||
{
|
||||
const split = this.splitEmail(content);
|
||||
content = split.email || this.value;
|
||||
}
|
||||
else if(!this.fullEmail)
|
||||
{
|
||||
const split = this.splitEmail(content);
|
||||
content = split.name || split.email;
|
||||
|
Reference in New Issue
Block a user