* Add {{links}}, {{attachments}}, {{links_attachments}} placeholders for merging

This commit is contained in:
Nathan Gray 2011-10-27 16:21:15 +00:00
parent 1733081d37
commit 6da51ecbdb
6 changed files with 59 additions and 0 deletions

View File

@ -48,6 +48,12 @@ class addressbook_merge extends bo_merge
{
return false;
}
// Links
$replacements += array(
'$$links$$' => $this->get_links('addressbook', $id, '!'.egw_link::VFS_APPNAME),
'$$attachments$$' => $this->get_links('addressbook', $id, egw_link::VFS_APPNAME),
'$$links_attachments$$' => $this->get_links('addressbook', $id)
);
if (!(strpos($content,'$$calendar/') === false))
{
$replacements += $this->calendar_replacements($id,!(strpos($content,'$$calendar/-1/') === false));
@ -173,6 +179,9 @@ class addressbook_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, excluding attached files'),
'attachments' => lang('List of files linked to the current record'),
'links_attachments' => lang('Links and attached files'),
'date' => lang('Date'),
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
'user/account_lid' => lang('Username'),

View File

@ -207,6 +207,12 @@ class calendar_merge extends bo_merge
{
$replacements['$$'.($prefix?$prefix.'/':'').'#'.$name.'$$'] = $event['#'.$name];
}
// Links
$replacements['$$'.($prefix?$prefix.'/':'').'links$$'] = $this->get_links('calendar', $event['id'], '!'.egw_link::VFS_APPNAME);
$replacements['$$'.($prefix?$prefix.'/':'').'attachments$$'] = $this->get_links('calendar', $event['id'], egw_link::VFS_APPNAME);
$replacements['$$'.($prefix?$prefix.'/':'').'links_attachments$$'] = $this->get_links('calendar', $event['id']);
return $replacements;
}
@ -563,6 +569,9 @@ class calendar_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, excluding attached files'),
'attachments' => lang('List of files linked to the current record'),
'links_attachments' => lang('Links and attached files'),
'date' => lang('Date'),
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
'user/account_lid' => lang('Username'),

View File

@ -296,6 +296,31 @@ abstract class bo_merge
return $replacements;
}
/**
* Get links for the given record
*
* Uses egw_link system to get link titles
*/
protected function get_links($app, $id, $only_app)
{
$links = egw_link::get_links($app, $id, $only_app);
$link_titles = array();
foreach($links as $link_id => $link_info)
{
$title = egw_link::title($link_info['app'], $link_info['id']);
if(class_exists('stylite_links_stream_wrapper') && $link_info['app'] != egw_link::VFS_APPNAME)
{
if (!($shortcut = array_search($link_info['app'],stylite_links_stream_wrapper::$shortcut2app)))
{
$shortcut = $link_info['app'].':';
}
$title .= ' ('.$shortcut.$link_info['id'].')';
}
$link_titles[] = $title;
}
return implode("\n",$link_titles);
}
/**
* Format a datetime
*

View File

@ -252,6 +252,7 @@ linkentry etemplate en Link entry
linklist etemplate en Link list
linkstring etemplate en Link string
linkto etemplate en Link to
list of files linked to the current record preferences en List of files linked to the current record
load this template into the editor etemplate en Load template to the editor
maximum size for uploads filemanager en Maximum upload size
message ... etemplate en Message ...
@ -405,6 +406,7 @@ the document can contain placeholder like {{%3}}, to be replaced with the data (
the following document-types are supported: preferences en The following document types are supported:
this text gets displayed if the input-field is empty and has no focus (blur) etemplate en Text gets displayed if the input field is empty and has no focus (blur)
time etemplate en Time
titles of any entries linked to the current record preferences en Titles of any entries linked to the current record
to disable: [! = not]<value>[=<check>] eg: '!@data' disables if content of data is empty etemplate en To disable: [! = not]<value>[=<check>] eg: '!@data' disables if content of data is empty
to start the db-tools etemplate en To start DB tools
to start the etemplate editor etemplate en To start eTemplate editor

View File

@ -109,6 +109,10 @@ class infolog_merge extends bo_merge
if(!$array['#'.$name]) $array['#'.$name] = '';
}
// Links
$array['links'] = $this->get_links('infolog', $id);
$array['attachments'] = $this->get_links('infolog', $id, egw_link::VFS_APPNAME);
// Add markers
foreach($array as $key => &$value)
{
@ -181,6 +185,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'),
'attachments' => lang('List of files linked to the current record'),
'date' => lang('Date'),
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
'user/account_lid' => lang('Username'),

View File

@ -124,6 +124,11 @@ class timesheet_merge extends bo_merge
if(!$array['#'.$name]) $array['#'.$name] = '';
}
// Links
$array['links'] = $this->get_links('timesheet', $id, '!'.egw_link::VFS_APPNAME);
$array['attachments'] = $this->get_links('timesheet', $id, egw_link::VFS_APPNAME);
$array['links_attachments'] = $this->get_links('timesheet', $id);
// Add markers
foreach($array as $key => &$value)
{
@ -182,6 +187,9 @@ class timesheet_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, excluding attached files'),
'attachments' => lang('List of files linked to the current record'),
'links_attachments' => lang('Links and attached files'),
'date' => lang('Date'),
'user/n_fn' => lang('Name of current user, all other contact fields are valid too'),
'user/account_lid' => lang('Username'),