changes for new hooks

This commit is contained in:
Ralf Becker 2003-04-27 22:35:39 +00:00
parent 72072a90aa
commit 037eb08667
5 changed files with 153 additions and 1040 deletions

View File

@ -27,7 +27,10 @@
*/
class bolink extends solink
{
var $app_register = array( // this should be setup/extended by setup
// other apps can participate in the linking by implementing a search_link hook, which
// has to return an array in the format of an app_register entry
//
var $app_register = array(
'addressbook' => array(
'query' => 'addressbook_query',
'title' => 'addressbook_title',
@ -40,7 +43,7 @@
'query' => 'projects_query',
'title' => 'projects_title',
'view' => array (
'menuaction' => 'projects.uiprocject.view_project'
'menuaction' => 'projects.uiprojects.view_project'
),
'view_id' => 'project_id'
),
@ -76,7 +79,7 @@
function bolink( )
{
$this->solink( ); // call constructor of derived class
$this->solink( ); // call constructor of derived class
$this->public_functions += array( // extend the public_functions of solink
'query' => True,
'title' => True,
@ -93,6 +96,21 @@
$this->send_file_ips = $config->config_data['send_file_ips'];
}
unset($config);
// other apps can participate in the linking by implementing a search_link hook, which
// has to return an array in the format of an app_register entry
//
$search_link_hooks = $GLOBALS['phpgw']->hooks->process('search_link');
if (is_array($search_link_hooks))
{
foreach($search_link_hooks as $app => $data)
{
if (is_array($data))
{
$this->app_register[$app] = $data;
}
}
}
}
/*!
@ -120,7 +138,7 @@
*/
function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 )
{
if ($this->debug)
//if ($this->debug)
{
echo "<p>bolink.link('$app1',$id1,'$app2',$id2,'$remark',$owner,$lastmod)</p>\n";
}
@ -318,7 +336,7 @@
{
if ($GLOBALS['phpgw_info']['user']['apps'][$app])
{
$apps[$app] = lang($app);
$apps[$app] = $GLOBALS['phpgw_info']['apps'][$app]['title'];
}
}
return $apps;
@ -445,8 +463,7 @@
if (empty($app) || empty($id) || empty($filename) /* || !$this->bo->check_access($info_id,PHPGW_ACL_READ)*/)
{
Header('Location: ' . $GLOBALS['phpgw']->link('/'));
exit();
$GLOBALS['phpgw']->redirect_link('/');
}
$browser = CreateObject('phpgwapi.browser');
@ -456,13 +473,14 @@
if ($local)
{
Header('Location: ' . $local);
exit();
}
$info = $this->info_attached($app,$id,$filename);
$browser->content_header($filename,$info['mime_type']);
echo $this->read_attached($app,$id,$filename);
exit();
else
{
$info = $this->info_attached($app,$id,$filename);
$browser->content_header($filename,$info['type']);
echo $this->read_attached($app,$id,$filename);
}
$GLOBALS['phpgw']->common->phpgw_exit();
}
/*!

File diff suppressed because it is too large Load Diff

View File

@ -11,18 +11,18 @@
/* $Id$ */
global $phpgw_info,$phpgw;
$save_app = $phpgw_info['flags']['currentapp'];
$phpgw_info['flags']['currentapp'] = 'infolog';
$save_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog';
$phpgw->translation->add_app('infolog');
$GLOBALS['phpgw']->translation->add_app('infolog');
$GLOBALS['phpgw_info']['etemplate']['hooked'] = True;
$project_id = $_GET['project_id'];
echo "<p>hook_projects: project_id='$project_id'</p>\n";
$infolog = CreateObject('infolog.uiinfolog');
$infolog->index(0,'calendar',$GLOBALS['project_id'],array(
$infolog->index(0,'projects',$project_id,array(
'menuaction' => 'projects.uiprojects.view',
'project_id' => $GLOBALS['project_id']
'project_id' => $project_id
));
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
unset($GLOBALS['phpgw_info']['etemplate']['hooked']);

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@
$setup_info['infolog']['name'] = 'infolog';
$setup_info['infolog']['title'] = 'InfoLog'; // still needed to run in 0.9.14/6
$setup_info['infolog']['version'] = '0.9.15.004';
$setup_info['infolog']['app_order'] = 20;
$setup_info['infolog']['app_order'] = 4;
$setup_info['infolog']['tables'] = array('phpgw_infolog','phpgw_links');
$setup_info['infolog']['enable'] = 1;
@ -52,9 +52,10 @@
$setup_info['infolog']['hooks'][] = 'deleteaccount';
$setup_info['infolog']['hooks'][] = 'about';
$setup_info['infolog']['hooks'][] = 'home';
$setup_info['infolog']['hooks'][] = 'addressbook_view';
$setup_info['infolog']['hooks'][] = 'projects_view';
$setup_info['infolog']['hooks'][] = 'calendar_view';
$setup_info['infolog']['hooks']['addressbook_view'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['projects_view'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['calendar_view'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['infolog'] = 'infolog.uiinfolog.hook_view';
/* Dependencies for this app to work */
$setup_info['infolog']['depends'][] = array(