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