mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
Api: Move list of common merge placeholders into parent class to reduce duplication, add link/<format> options
This commit is contained in:
parent
77b1c0ac33
commit
151889b39c
@ -2342,4 +2342,44 @@ abstract class Merge
|
||||
}
|
||||
return Api\Etemplate::number_format($number,$num_decimal_places);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of common replacements available to all applications
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_common_replacements()
|
||||
{
|
||||
return array(
|
||||
// Link to current entry
|
||||
'link' => lang('URL of current record'),
|
||||
'link/href' => lang('HTML link to the current record'),
|
||||
'link/title' => lang('Link title of current record'),
|
||||
|
||||
// Link system - linked entries
|
||||
'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/url' => lang('URLs of any entries linked to the current record, excluding attached files'),
|
||||
'attachments' => lang('List of files linked to the current record'),
|
||||
'links_attachments' => lang('Links and attached files'),
|
||||
'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
|
||||
|
||||
// General information
|
||||
'date' => lang('Date'),
|
||||
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
|
||||
'user/account_lid' => lang('Username'),
|
||||
|
||||
// Merge control
|
||||
'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.'),
|
||||
'labelplacement' => lang('Tag to mark positions for address labels'),
|
||||
|
||||
// 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.'),
|
||||
'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'),
|
||||
'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'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -933,24 +933,7 @@ class calendar_merge extends Api\Storage\Merge
|
||||
echo '<tr><td>{{day/birthdays}}</td><td colspan="3">'.lang('Birthdays').'</td></tr>';
|
||||
|
||||
echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>";
|
||||
foreach(array(
|
||||
'link' => lang('HTML link to the current record'),
|
||||
'links' => lang('Titles of any entries linked to the current record, excluding attached files'),
|
||||
'attachments' => lang('List of files linked to the current record'),
|
||||
'links_attachments' => lang('Links and attached files'),
|
||||
'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
|
||||
'date' => lang('Date'),
|
||||
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
|
||||
'user/account_lid' => lang('Username'),
|
||||
'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.'),
|
||||
'labelplacement' => lang('Tag to mark positions for address labels'),
|
||||
'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'),
|
||||
'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'),
|
||||
'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'),
|
||||
) as $name => $label)
|
||||
foreach($this->get_common_replacements() as $name => $label)
|
||||
{
|
||||
echo '<tr><td>{{'.$name.'}}</td><td colspan="3">'.$label."</td></tr>\n";
|
||||
}
|
||||
|
@ -238,26 +238,7 @@ class infolog_merge extends Api\Storage\Merge
|
||||
}
|
||||
|
||||
echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>";
|
||||
foreach(array(
|
||||
'link' => lang('HTML link to the current record'),
|
||||
'links' => lang('Titles of any entries linked to the current record, excluding attached files'),
|
||||
'attachments' => lang('List of files linked to the current record'),
|
||||
'links_attachments' => lang('Links and attached files'),
|
||||
'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
|
||||
'links/href' => lang('Links wrapped in an HREF tag with download link'),
|
||||
'links/link' => lang('Download url for links'),
|
||||
'date' => lang('Date'),
|
||||
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
|
||||
'user/account_lid' => lang('Username'),
|
||||
'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.'),
|
||||
'labelplacement' => lang('Tag to mark positions for address labels'),
|
||||
'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'),
|
||||
'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'),
|
||||
'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'),
|
||||
) as $name => $label)
|
||||
foreach($this->get_common_replacements() as $name => $label)
|
||||
{
|
||||
echo '<tr><td>{{'.$name.'}}</td><td colspan="3">'.$label."</td></tr>\n";
|
||||
}
|
||||
|
@ -204,24 +204,7 @@ class timesheet_merge extends Api\Storage\Merge
|
||||
}
|
||||
|
||||
echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>";
|
||||
foreach(array(
|
||||
'link' => lang('HTML link to the current record'),
|
||||
'links' => lang('Titles of any entries linked to the current record, excluding attached files'),
|
||||
'attachments' => lang('List of files linked to the current record'),
|
||||
'links_attachments' => lang('Links and attached files'),
|
||||
'links/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
|
||||
'date' => lang('Date'),
|
||||
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
|
||||
'user/account_lid' => lang('Username'),
|
||||
'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.'),
|
||||
'labelplacement' => lang('Tag to mark positions for address labels'),
|
||||
'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'),
|
||||
'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 empty for example'),
|
||||
'LETTERPREFIXCUSTOM' => lang('Example {{LETTERPREFIXCUSTOM n_prefix title n_family}} - Example: Mr Dr. James Miller'),
|
||||
) as $name => $label)
|
||||
foreach($this->get_common_replacements() as $name => $label)
|
||||
{
|
||||
echo '<tr><td>{{'.$name.'}}</td><td colspan="3">'.$label."</td></tr>\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user