mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-10-05 17:42:18 +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();
|
||||||
|
@ -2590,34 +2590,50 @@ abstract class Merge
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// Link to current entry
|
// Link to current entry
|
||||||
'link' => lang('URL of current record'),
|
'link' => lang('URL of current record'),
|
||||||
'link/href' => lang('HTML link to the current record'),
|
'link/href' => lang('HTML link to the current record'),
|
||||||
'link/title' => lang('Link title of current record'),
|
'link/title' => lang('Link title of current record'),
|
||||||
|
|
||||||
// Link system - linked entries
|
// Link system - linked entries
|
||||||
'links' => lang('Titles of any entries linked to the current record, excluding attached files'),
|
'links' => lang('Titles of any entries linked to the current record, excluding attached files'),
|
||||||
'links/href' => lang('HTML links to any entries linked to the current record, excluding attached files'),
|
'links/href' => lang('HTML links to any entries linked to the current record, excluding attached files'),
|
||||||
'links/url' => lang('URLs of any entries linked to the current record, excluding attached files'),
|
'links/url' => lang('URLs of any entries linked to the current record, excluding attached files'),
|
||||||
'attachments' => lang('List of files linked to the current record'),
|
'attachments' => lang('List of files linked to the current record'),
|
||||||
'links_attachments' => lang('Links and attached files'),
|
'links_attachments' => lang('Links and attached files'),
|
||||||
'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
|
'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
|
||||||
|
|
||||||
// General information
|
// General information
|
||||||
'date' => lang('Date'),
|
'date' => lang('Date'),
|
||||||
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
|
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
|
||||||
'user/account_lid' => lang('Username'),
|
'user/account_lid' => lang('Username'),
|
||||||
|
|
||||||
// Merge control
|
// Merge control
|
||||||
'pagerepeat' => lang('For serial letter use this tag. Put the content, you want to repeat between two Tags.'),
|
'pagerepeat' => lang('For serial letter use this tag. Put the content, you want to repeat between two Tags.'),
|
||||||
'label' => lang('Use this tag for addresslabels. Put the content, you want to repeat, between two tags.'),
|
'label' => lang('Use this tag for addresslabels. Put the content, you want to repeat, between two tags.'),
|
||||||
'labelplacement' => lang('Tag to mark positions for address labels'),
|
'labelplacement' => lang('Tag to mark positions for address labels'),
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
'IF fieldname' => lang('Example {{IF n_prefix~Mr~Hello Mr.~Hello Ms.}} - search the field "n_prefix", for "Mr", if found, write Hello Mr., else write Hello Ms.'),
|
'IF fieldname' => lang('Example {{IF n_prefix~Mr~Hello Mr.~Hello Ms.}} - search the field "n_prefix", for "Mr", if found, write Hello Mr., else write Hello Ms.'),
|
||||||
'NELF' => lang('Example {{NELF role}} - if field role is not empty, you will get a new line with the value of field role'),
|
'NELF' => lang('Example {{NELF role}} - if field role is not empty, you will get a new line with the value of field role'),
|
||||||
'NENVLF' => lang('Example {{NENVLF role}} - if field role is not empty, set a LF without any value of the field'),
|
'NENVLF' => lang('Example {{NENVLF role}} - if field role is not empty, set a LF without any value of the field'),
|
||||||
'LETTERPREFIX' => lang('Example {{LETTERPREFIX}} - Gives a letter prefix without double spaces, if the title is emty for example'),
|
'LETTERPREFIX' => lang('Example {{LETTERPREFIX}} - Gives a letter prefix without double spaces, if the title is emty for example'),
|
||||||
'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…
Reference in New Issue
Block a user