forked from extern/egroupware
Change all merges to use common get_all_links() function
This commit is contained in:
parent
0dc3e5ab6f
commit
ef826ee2b9
@ -57,15 +57,7 @@ class addressbook_merge extends bo_merge
|
||||
}
|
||||
|
||||
// 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)
|
||||
);
|
||||
foreach(array_keys($GLOBALS['egw_info']['user']['apps']) as $app)
|
||||
{
|
||||
$replacements['$$links/'.$app.'$$'] = $this->get_links('addressbook',$id, $app);
|
||||
}
|
||||
$replacements += $this->get_all_links('addressbook', $id, $prefix, $content);
|
||||
if (!(strpos($content,'$$calendar/') === false))
|
||||
{
|
||||
$replacements += $this->calendar_replacements($id,!(strpos($content,'$$calendar/-1/') === false));
|
||||
|
@ -216,13 +216,7 @@ class calendar_merge extends bo_merge
|
||||
}
|
||||
|
||||
// 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']);
|
||||
foreach(array_keys($GLOBALS['egw_info']['user']['apps']) as $app)
|
||||
{
|
||||
$replacements["$$".($prefix?$prefix.'/':'')."links/{$app}$$"] = $this->get_links('calendar',$event['id'], $app);
|
||||
}
|
||||
$replacements += $this->get_all_links('calendar', $event['id'], $prefix, $content);
|
||||
|
||||
return $replacements;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ abstract class bo_merge
|
||||
* @param id String ID of record
|
||||
* @param content String document content
|
||||
*/
|
||||
protected function get_all_links($app, $id, &$content)
|
||||
protected function get_all_links($app, $id, $prefix, &$content)
|
||||
{
|
||||
$array = array();
|
||||
$pattern = '@\$(links|attachments|links_attachments)\/?(title|href|link)?\/?([a-z]*)\$@';
|
||||
@ -361,18 +361,23 @@ abstract class bo_merge
|
||||
switch($matches[1][$i])
|
||||
{
|
||||
case 'links':
|
||||
$array[$placeholder] = $this->get_links($app, $id, '!'.egw_link::VFS_APPNAME, array(),$matches[2][$i]);
|
||||
$array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, '!'.egw_link::VFS_APPNAME, array(),$matches[2][$i]);
|
||||
break;
|
||||
case 'attachments':
|
||||
$array[$placeholder] = $this->get_links($app, $id, egw_link::VFS_APPNAME,array(),$matches[2][$i]);
|
||||
$array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, egw_link::VFS_APPNAME,array(),$matches[2][$i]);
|
||||
break;
|
||||
default:
|
||||
$array[$placeholder] = $this->get_links($app, $id, $matches[3][$i], array(), $matches[2][$i]);
|
||||
$array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, $matches[3][$i], array(), $matches[2][$i]);
|
||||
break;
|
||||
}
|
||||
$link_cache[$id][$placeholder] = $array[$placeholder];
|
||||
}
|
||||
}
|
||||
// Need to set each app, to make sure placeholders are removed
|
||||
foreach(array_keys($GLOBALS['egw_info']['user']['apps']) as $_app)
|
||||
{
|
||||
$array[($prefix?$prefix.'/':'')."links/$app"] = $this->get_links($app,$id,$_app);
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
@ -125,9 +125,7 @@ class infolog_merge extends bo_merge
|
||||
}
|
||||
|
||||
// Links
|
||||
$array['links'] = $this->get_links('infolog', $id, '!'.egw_link::VFS_APPNAME, array($array['info_link']['id']));
|
||||
$array['attachments'] = $this->get_links('infolog', $id, egw_link::VFS_APPNAME);
|
||||
$array['links_attachments'] = $this->get_links('infolog', $id, '', array($array['info_link']['id']));
|
||||
$array += $this->get_all_links('infolog', $id, $content);
|
||||
// Need to set each app, to make sure placeholders are removed
|
||||
foreach(array_keys($GLOBALS['egw_info']['user']['apps']) as $app)
|
||||
{
|
||||
|
@ -136,13 +136,7 @@ class timesheet_merge extends bo_merge
|
||||
}
|
||||
|
||||
// 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);
|
||||
foreach(array_keys($GLOBALS['egw_info']['user']['apps']) as $app)
|
||||
{
|
||||
$array["links/{$app}"] = $this->get_links('timesheet',$id, $app);
|
||||
}
|
||||
$array += $this->get_all_links('timesheet', $id, $prefix, $content);
|
||||
|
||||
// Add markers
|
||||
foreach($array as $key => &$value)
|
||||
|
Loading…
Reference in New Issue
Block a user