mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
got mailing lists working again in mail compose using includeLists=true attribute
using "$list_name <$list_id@lists.egroupware.org>" instead of just integer ids for the list, thought et2-select-mail is NOT displaying the mailing-list icon, after a mailing-list is selected
This commit is contained in:
parent
02164c2cae
commit
26824323e5
@ -50,6 +50,11 @@ export class Et2SelectEmail extends Et2Select
|
|||||||
*/
|
*/
|
||||||
allowDragAndDrop: {type: Boolean},
|
allowDragAndDrop: {type: Boolean},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include mailing lists: returns them with their integer list_id
|
||||||
|
*/
|
||||||
|
includeLists: {type: Boolean},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the full, original value email address under all circumstances, rather than the contact name for known contacts
|
* Show the full, original value email address under all circumstances, rather than the contact name for known contacts
|
||||||
*/
|
*/
|
||||||
@ -65,6 +70,7 @@ export class Et2SelectEmail extends Et2Select
|
|||||||
this.allowFreeEntries = true;
|
this.allowFreeEntries = true;
|
||||||
this.editModeEnabled = true;
|
this.editModeEnabled = true;
|
||||||
this.allowDragAndDrop = false;
|
this.allowDragAndDrop = false;
|
||||||
|
this.includeLists = false;
|
||||||
this.multiple = true;
|
this.multiple = true;
|
||||||
this.fullEmail = false;
|
this.fullEmail = false;
|
||||||
this.defaultValidators.push(new IsEmail());
|
this.defaultValidators.push(new IsEmail());
|
||||||
@ -75,7 +81,6 @@ export class Et2SelectEmail extends Et2Select
|
|||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected _bindListeners()
|
protected _bindListeners()
|
||||||
{
|
{
|
||||||
super._bindListeners();
|
super._bindListeners();
|
||||||
@ -119,7 +124,7 @@ export class Et2SelectEmail extends Et2Select
|
|||||||
*/
|
*/
|
||||||
protected remoteQuery(search : string, options : object)
|
protected remoteQuery(search : string, options : object)
|
||||||
{
|
{
|
||||||
return this.egw().json(this.searchUrl, [search]).sendRequest().then((result) =>
|
return this.egw().request(this.searchUrl, [search, {includeLists: this.includeLists}]).then((result) =>
|
||||||
{
|
{
|
||||||
this.processRemoteResults(result);
|
this.processRemoteResults(result);
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ export class IsEmail extends Pattern
|
|||||||
* eg. in Safari 11.0 or node.js 4.8.3 and therefore grunt uglify!
|
* eg. in Safari 11.0 or node.js 4.8.3 and therefore grunt uglify!
|
||||||
* Server-side will fail in that case because it uses the full regexp.
|
* Server-side will fail in that case because it uses the full regexp.
|
||||||
*/
|
*/
|
||||||
static EMAIL_PREG : RegExp = new RegExp(/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|"(?:[^"\\]|\\.)*")\s?<)?[^\x00-\x20()\xe2\x80\x8b<>@,;:\042\[\]\x80-\xff]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,}>?$/i);
|
static EMAIL_PREG : RegExp = /^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|"(?:[^"\\]|\\.)*")\s?<)?[^\x00-\x20()\xe2\x80\x8b<>@,;:\042\[\]\x80-\xff]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,}>?$/i;
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
|
@ -106,17 +106,18 @@ class Taglist extends Etemplate\Widget
|
|||||||
*
|
*
|
||||||
* Uses the mail application if available, or addressbook
|
* Uses the mail application if available, or addressbook
|
||||||
*/
|
*/
|
||||||
public static function ajax_email($search)
|
public static function ajax_email($search=null, array $options=null)
|
||||||
{
|
{
|
||||||
$_REQUEST['query'] = $_REQUEST['query'] ?: $search;
|
$_REQUEST['query'] = $_REQUEST['query'] ?: $search;
|
||||||
// If no mail app access, use link system -> addressbook
|
// If no mail app access, use link system -> addressbook
|
||||||
if(!$GLOBALS['egw_info']['apps']['mail'])
|
if(empty($GLOBALS['egw_info']['apps']['mail']))
|
||||||
{
|
{
|
||||||
$_REQUEST['app'] = 'addressbook-email';
|
$_REQUEST['app'] = 'addressbook-email';
|
||||||
return self::ajax_search();
|
return self::ajax_search();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this should go to a BO, not a UI object
|
// TODO: this should go to a BO, not a UI object
|
||||||
|
$_REQUEST['include_lists'] = $options['includeLists'] ?? false;
|
||||||
return mail_compose::ajax_searchAddress();
|
return mail_compose::ajax_searchAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2832,31 +2832,24 @@ class mail_compose
|
|||||||
*/
|
*/
|
||||||
static function resolveEmailAddressList($_emailAddressList)
|
static function resolveEmailAddressList($_emailAddressList)
|
||||||
{
|
{
|
||||||
$contacts_obs = null;
|
static $contacts_obs = null;
|
||||||
$addrFromList=array();
|
$addrFromList=array();
|
||||||
foreach((array)$_emailAddressList as $ak => $address)
|
foreach((array)$_emailAddressList as $ak => $address)
|
||||||
{
|
{
|
||||||
if(is_int($address))
|
if(is_numeric($address) && $address > 0 || preg_match('/ <(\\d+)@lists.egroupware.org>$/', $address, $matches))
|
||||||
{
|
{
|
||||||
if (!isset($contacts_obs)) $contacts_obj = new Api\Contacts();
|
if (!isset($contacts_obs)) $contacts_obj = new Api\Contacts();
|
||||||
// List was selected, expand to addresses
|
// List was selected, expand to addresses
|
||||||
unset($_emailAddressList[$ak]);
|
unset($_emailAddressList[$ak]);
|
||||||
$list = $contacts_obj->search('',array('n_fn','n_prefix','n_given','n_family','org_name','email','email_home'),'','','',False,'AND',false,array('list' =>(int)$address));
|
foreach($contacts_obj->search('',array('n_fn','n_prefix','n_given','n_family','org_name','email','email_home'),
|
||||||
// Just add email addresses, they'll be checked below
|
'','','',False,'AND',false,
|
||||||
foreach($list as $email)
|
['list' => (int)($matches[1] ?? $address)]) as $email)
|
||||||
{
|
{
|
||||||
$addrFromList[] = $email['email'] ? $email['email'] : $email['email_home'];
|
$addrFromList[] = $email['email'] ?: $email['email_home'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($addrFromList))
|
return array_values(array_merge($_emailAddressList, $addrFromList));
|
||||||
{
|
|
||||||
foreach ($addrFromList as $addr)
|
|
||||||
{
|
|
||||||
if (!empty($addr)) $_emailAddressList[]=$addr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return is_array($_emailAddressList) ? array_values($_emailAddressList) : (array)$_emailAddressList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3766,12 +3759,10 @@ class mail_compose
|
|||||||
{
|
{
|
||||||
$type = $key > 0 ? 'manual' : 'group';
|
$type = $key > 0 ? 'manual' : 'group';
|
||||||
$list = array(
|
$list = array(
|
||||||
'id' => $key,
|
'value' => $list_name.' <'.$key.'@lists.egroupware.org>',
|
||||||
'name' => $list_name,
|
|
||||||
'label' => $list_name,
|
'label' => $list_name,
|
||||||
'class' => 'mailinglist ' . "{$type}_list",
|
|
||||||
'title' => lang('Mailinglist'),
|
'title' => lang('Mailinglist'),
|
||||||
'data' => $key
|
'icon' => Api\Image::find('api', 'email'),
|
||||||
);
|
);
|
||||||
${"${type}_lists"}[] = $list;
|
${"${type}_lists"}[] = $list;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user