From a317c6b1c009c8702db1ee86d9eccdd1021eaae0 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 18 Aug 2016 18:56:52 +0200 Subject: [PATCH] Fix "From" field in mail display always get abbreviated --- api/js/etemplate/et2_widget_url.js | 8 +++++++- mail/js/app.js | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/et2_widget_url.js b/api/js/etemplate/et2_widget_url.js index c171ed757a..018c09d68c 100644 --- a/api/js/etemplate/et2_widget_url.js +++ b/api/js/etemplate/et2_widget_url.js @@ -244,6 +244,12 @@ var et2_url_ro = (function(){ "use strict"; return et2_valueWidget.extend([et2_I "type": "boolean", "default": false, "description": "Allow to add email as contact to addressbook" + }, + "full_email": { + "name": "Show full email address", + "type": "boolean", + "default": true, + "description": "Allow to show full email address if ture otherwise show only name" } }, @@ -315,7 +321,7 @@ var et2_url_ro = (function(){ "use strict"; return et2_valueWidget.extend([et2_I } } // wrap email address if there's a name - if (this.span.text() && this.span.text().split("<")) + if (this.span.text() && this.span.text().split("<") && this.options.full_email) { var val = this.span.text().split("<"); val = val[0] != ""? val[0]: val[2]; diff --git a/mail/js/app.js b/mail/js/app.js index 1037ca1222..89aa7105dd 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -792,7 +792,14 @@ app.classes.mail = AppJS.extend( else { var value = remembervalue+(remembervalue?',':'')+content[i]; - var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); + var url_email_options = { + id:widget.id+'_'+i, + value:value, + readonly:true, + contact_plus:true, + full_email:typeof field['full_email'] !='undefined'?field['full_email']:true + }; + var email = et2_createWidget('url-email',url_email_options,widget); email.loadingFinished(); remembervalue = ''; } @@ -830,7 +837,7 @@ app.classes.mail = AppJS.extend( var dataElem = {data:{FROM:"",SENDER:"",TO:"",CC:"",BCC:""}}; var content = this.et2.getArrayMgr('content').data; var expand_content = [ - {build_children: true, data_one: 'FROM', data: 'FROM', widget: 'FROM', line: 'mailDisplayHeadersFrom'}, + {build_children: true, data_one: 'FROM', data: 'FROM', widget: 'FROM', line: 'mailDisplayHeadersFrom', full_email:false}, {build_children: true, data: 'SENDER', widget: 'SENDER', line: 'mailDisplayHeadersSender'}, {build_children: true, data: 'TO', widget: 'TO', line: 'mailDisplayHeadersTo'}, {build_children: true, data: 'CC', widget: 'CC', line: 'mailDisplayHeadersCc'},