Add general placeholder {{link}} is a link to current record

This commit is contained in:
Nathan Gray 2013-03-20 14:58:27 +00:00
parent 16e3ae2551
commit 142583956e
6 changed files with 34 additions and 2 deletions

View File

@ -182,6 +182,7 @@ class addressbook_merge extends bo_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'),

View File

@ -577,6 +577,7 @@ class calendar_merge extends bo_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'),

View File

@ -347,7 +347,7 @@ abstract class bo_merge
protected function get_all_links($app, $id, $prefix, &$content)
{
$array = array();
$pattern = '@\$(links|attachments|links_attachments)\/?(title|href|link)?\/?([a-z]*)\$@';
$pattern = '@\$(link|links|attachments|links_attachments)\/?(title|href|link)?\/?([a-z]*)\$@';
static $link_cache;
if(preg_match_all($pattern, $content, $matches))
{
@ -361,6 +361,33 @@ abstract class bo_merge
}
switch($matches[1][$i])
{
case 'link':
// Link to current record
$title = egw_link::title($app, $id);
if(class_exists('stylite_links_stream_wrapper') && $app != egw_link::VFS_APPNAME)
{
$title = stylite_links_stream_wrapper::entry2name($app, $id, $title);
}
$link = egw_link::view($app, $id);
if($app != egw_link::VFS_APPNAME)
{
// Set app to false so we always get an external link
$link = str_replace(',','%2C',egw::link('/index.php',$link, false));
}
else
{
$link = egw::link($link, array());
}
// Prepend site
if ($link{0} == '/')
{
$link = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$link;
}
$title = html::a_href(html::htmlspecialchars($title), $link);
$array[($prefix?$prefix.'/':'').$placeholder] = $title;
break;
case 'links':
$array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, '!'.egw_link::VFS_APPNAME, array(),$matches[2][$i]);
break;

View File

@ -218,6 +218,7 @@ hour etemplate en Hour
hours etemplate en Hours
how many entries should the list show etemplate en How many entries should the list show
html etemplate en HTML
html link to the current record etemplate en HTML link to the current record
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell etemplate en If field is disabled an empty table cell is displayed
if you specify a directory (full vfs path) here, %1 displays an action for each document. that action allows to download the specified document with the data inserted. preferences en If you specify a directory, full vfs path, %1 displays an action for each document. That action allows to download the specified document with the data inserted.
if you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. that icon allows to download the specified document with the data inserted. preferences en If you specify a document, full vfs path, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.

View File

@ -206,7 +206,8 @@ class infolog_merge extends bo_merge
echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>";
foreach(array(
'links' => lang('Titles of any entries linked to the current record'),
'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/[appname]' => lang('Links to specified application. Example: {{links/infolog}}'),
'links/href' => lang('Links wrapped in an HREF tag with download link'),

View File

@ -195,6 +195,7 @@ class timesheet_merge extends bo_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'),