mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-22 02:41:50 +02:00
Add user placeholders into placeholder dialog
This commit is contained in:
parent
9239b86cd9
commit
704b6c6dc2
@ -273,7 +273,7 @@ class Merge extends Api\Storage\Merge
|
|||||||
*
|
*
|
||||||
* Placeholders are grouped logically. Group key should have a user-friendly translation.
|
* Placeholders are grouped logically. Group key should have a user-friendly translation.
|
||||||
*/
|
*/
|
||||||
public function get_placeholder_list()
|
public function get_placeholder_list($prefix = '')
|
||||||
{
|
{
|
||||||
$placeholders = [];
|
$placeholders = [];
|
||||||
$group = 'contact';
|
$group = 'contact';
|
||||||
@ -302,21 +302,21 @@ class Merge extends Api\Storage\Merge
|
|||||||
case 'url':
|
case 'url':
|
||||||
$group = 'details';
|
$group = 'details';
|
||||||
}
|
}
|
||||||
$placeholders[$group]["{{" . $name . "}}"] = $label;
|
$placeholders[$group]["{{" . ($prefix ? $prefix . '/' : '') . $name . "}}"] = $label;
|
||||||
if($name == 'cat_id')
|
if($name == 'cat_id')
|
||||||
{
|
{
|
||||||
$placeholders[$group]["{{" . $name . "}}"] = lang('Category path');
|
$placeholders[$group]["{{" . ($prefix ? $prefix . '/' : '') . $name . "}}"] = lang('Category path');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Correctly formatted address by country / preference
|
// Correctly formatted address by country / preference
|
||||||
$placeholders['business']["{{adr_one_formatted}}"] = "Formatted business address";
|
$placeholders['business']['{{' . ($prefix ? $prefix . '/' : '') . 'adr_one_formatted}}'] = "Formatted business address";
|
||||||
$placeholders['private']["{{adr_two_formatted}}"] = "Formatted private address";
|
$placeholders['private']['{{' . ($prefix ? $prefix . '/' : '') . 'adr_two_formatted}}'] = "Formatted private address";
|
||||||
|
|
||||||
$group = 'customfields';
|
$group = 'customfields';
|
||||||
foreach($this->contacts->customfields as $name => $field)
|
foreach($this->contacts->customfields as $name => $field)
|
||||||
{
|
{
|
||||||
$placeholders[$group]["{{" . $name . "}}"] = $field['label'];
|
$placeholders[$group]["{{" . ($prefix ? $prefix . '/' : '') . $name . "}}"] = $field['label'];
|
||||||
}
|
}
|
||||||
return $placeholders;
|
return $placeholders;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class Placeholder extends Etemplate\Widget
|
|||||||
|
|
||||||
if(is_null($apps))
|
if(is_null($apps))
|
||||||
{
|
{
|
||||||
$apps = ['addressbook'];
|
$apps = ['addressbook', 'user'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($apps as $appname)
|
foreach($apps as $appname)
|
||||||
@ -73,7 +73,7 @@ class Placeholder extends Etemplate\Widget
|
|||||||
switch($appname)
|
switch($appname)
|
||||||
{
|
{
|
||||||
case 'user':
|
case 'user':
|
||||||
$list = $merge->get_user_replacement_list();
|
$list = $merge->get_user_placeholder_list();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$list = $merge->get_placeholder_list();
|
$list = $merge->get_placeholder_list();
|
||||||
|
@ -2620,4 +2620,20 @@ abstract class Merge
|
|||||||
'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'),
|
'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of placeholders for the current user
|
||||||
|
*/
|
||||||
|
public function get_user_placeholder_list($prefix = '')
|
||||||
|
{
|
||||||
|
$contacts = new Api\Contacts\Merge();
|
||||||
|
$replacements = $contacts->get_placeholder_list(($prefix ? $prefix . '/' : '') . 'user');
|
||||||
|
unset($replacements['details']['{{' . ($prefix ? $prefix . '/' : '') . 'user/account_id}}']);
|
||||||
|
$replacements['account'] = [
|
||||||
|
'{{' . ($prefix ? $prefix . '/' : '') . 'user/account_id}}' => 'Account ID',
|
||||||
|
'{{' . ($prefix ? $prefix . '/' : '') . 'user/account_lid}}' => 'Login ID'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $replacements;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user