mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
* Mail: implement new preference to configure mail identity label shown as mail folder header
This commit is contained in:
parent
c96f4ff5c2
commit
b7c359a6f1
@ -1553,9 +1553,9 @@ class Account implements \ArrayAccess
|
|||||||
* @param array|Account $account object or values for keys 'ident_(realname|org|email)', 'acc_(id|name|imap_username)'
|
* @param array|Account $account object or values for keys 'ident_(realname|org|email)', 'acc_(id|name|imap_username)'
|
||||||
* @param boolean $replace_placeholders =true should placeholders like {{n_fn}} be replaced
|
* @param boolean $replace_placeholders =true should placeholders like {{n_fn}} be replaced
|
||||||
* @param int $account_id =null account_id of user we are called for
|
* @param int $account_id =null account_id of user we are called for
|
||||||
* @return string with htmlencoded angle brackets
|
* @return string|array with htmlencoded angle brackets, returns account details as array if return_array is true
|
||||||
*/
|
*/
|
||||||
public static function identity_name($account, $replace_placeholders=true, $account_id=null)
|
public static function identity_name($account, $replace_placeholders=true, $account_id=null, $return_array=false)
|
||||||
{
|
{
|
||||||
if ($replace_placeholders)
|
if ($replace_placeholders)
|
||||||
{
|
{
|
||||||
@ -1605,6 +1605,10 @@ class Account implements \ArrayAccess
|
|||||||
_egw_log_exception($e);
|
_egw_log_exception($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($return_array)
|
||||||
|
{
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
if (strlen(trim($account['ident_realname'].$account['ident_org'])))
|
if (strlen(trim($account['ident_realname'].$account['ident_org'])))
|
||||||
{
|
{
|
||||||
$name = $account['ident_realname'].' '.$account['ident_org'];
|
$name = $account['ident_realname'].' '.$account['ident_org'];
|
||||||
|
@ -419,6 +419,23 @@ class mail_hooks
|
|||||||
'autocomplete_url' => ' ',
|
'autocomplete_url' => ' ',
|
||||||
'select_options' => $toggledOnActions
|
'select_options' => $toggledOnActions
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
'identLabel' => array(
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => 'Identity label',
|
||||||
|
'help' => 'Defines what to show as identity label on mail folder header',
|
||||||
|
'name' => 'identLabel',
|
||||||
|
'values' => array(
|
||||||
|
7 => lang('Real name Organization Email'),
|
||||||
|
3 => lang('Real name Email'),
|
||||||
|
14 => lang('Ident name Organization Email'),
|
||||||
|
10 => lang('Ident name Email'),
|
||||||
|
1 => lang('Real name'),
|
||||||
|
2 => lang('Email'),
|
||||||
|
4 => lang('Organization'),
|
||||||
|
8 => lang('Ident name')
|
||||||
|
),
|
||||||
|
'default' => 7
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (!$GLOBALS['egw_info']['apps']['stylite']) unset($settingsArray['attachVCardAtCompose']);
|
if (!$GLOBALS['egw_info']['apps']['stylite']) unset($settingsArray['attachVCardAtCompose']);
|
||||||
|
@ -29,6 +29,23 @@ class mail_tree
|
|||||||
*/
|
*/
|
||||||
const DELIMITER = Mail::DELIMITER;
|
const DELIMITER = Mail::DELIMITER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bit flag: ident_realname
|
||||||
|
*/
|
||||||
|
const IDENT_NAME = 1;
|
||||||
|
/**
|
||||||
|
* bit flag: ident_email
|
||||||
|
*/
|
||||||
|
const IDENT_EMAIL = 2;
|
||||||
|
/**
|
||||||
|
* bit flag: ident_org
|
||||||
|
*/
|
||||||
|
const IDENT_ORG = 4;
|
||||||
|
/**
|
||||||
|
* bit flag: ident_name
|
||||||
|
*/
|
||||||
|
const IDENT_NAME_IDENTITY= 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icons used for nodes different states
|
* Icons used for nodes different states
|
||||||
*
|
*
|
||||||
@ -460,7 +477,7 @@ class mail_tree
|
|||||||
foreach(Mail\Account::search(true, false) as $acc_id => $accObj)
|
foreach(Mail\Account::search(true, false) as $acc_id => $accObj)
|
||||||
{
|
{
|
||||||
if (!$accObj->is_imap()|| $_profileID && $acc_id != $_profileID) continue;
|
if (!$accObj->is_imap()|| $_profileID && $acc_id != $_profileID) continue;
|
||||||
$identity = Mail\Account::identity_name($accObj,true,$GLOBALS['egw_info']['user']['acount_id']);
|
$identity = self::getIdentityName(Mail\Account::identity_name($accObj,true,$GLOBALS['egw_info']['user']['acount_id'], true));
|
||||||
// Open top level folders for active account
|
// Open top level folders for active account
|
||||||
$openActiveAccount = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] == $acc_id?1:0;
|
$openActiveAccount = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] == $acc_id?1:0;
|
||||||
|
|
||||||
@ -516,4 +533,44 @@ class mail_tree
|
|||||||
}
|
}
|
||||||
return $tree;
|
return $tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build folder tree parent identity label
|
||||||
|
*
|
||||||
|
* @param array $_account
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static function getIdentityName ($_account)
|
||||||
|
{
|
||||||
|
$identLabel = $GLOBALS['egw_info']['user']['preferences']['mail']['identLabel'];
|
||||||
|
$name = array();
|
||||||
|
|
||||||
|
if ($identLabel & self::IDENT_NAME_IDENTITY)
|
||||||
|
{
|
||||||
|
$name[] = $_account['ident_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($identLabel & self::IDENT_NAME)
|
||||||
|
{
|
||||||
|
$name[] = $_account['ident_realname']. ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($identLabel & self::IDENT_ORG)
|
||||||
|
{
|
||||||
|
$name[] = $_account['ident_org'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($identLabel & self::IDENT_EMAIL || empty($name))
|
||||||
|
{
|
||||||
|
if (strpos($_account['ident_email'], '@') !== false || trim($_account['ident_email']) !='')
|
||||||
|
{
|
||||||
|
$name[] = ' <'.$_account['ident_email'].'>';
|
||||||
|
}
|
||||||
|
elseif(strpos($_account['acc_imap_username'], '@') !== false || trim($_account['acc_imap_username']) !='')
|
||||||
|
{
|
||||||
|
$name[] = ' <'.$_account['acc_imap_username'].'>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return implode(' ', $name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user