Use new sidebox_all hook to add importexport links to other apps' sideboxes

This commit is contained in:
Nathan Gray 2011-02-03 16:32:03 +00:00
parent 40f8600bc5
commit ae07ff2331
2 changed files with 43 additions and 0 deletions

View File

@ -70,4 +70,46 @@ class importexport_admin_prefs_sidebox_hooks
}
}
}
/**
* Called from framework so Import / Export can add links into other apps' sidebox.
*/
public static function other_apps() {
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
$cache = egw_cache::getCache(egw_cache::SESSION, 'importexport', 'sidebox_links');
if(!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport']) {
$cache[$appname]['import'] = importexport_helper_functions::has_definitions($appname, 'import');
$cache[$appname]['export'] = importexport_helper_functions::has_definitions($appname, 'export');
egw_cache::setCache(egw_cache::SESSION, 'importexport', 'sidebox_links', $cache);
}
// Add in import / export, if available
$file = array();
if($cache[$appname]['import'])
{
$file['Import'] = array('link' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php',array(
'menuaction' => 'importexport.importexport_import_ui.import_dialog',
'appname'=>$appname
),false)."','_blank',500,220,'yes')",
'icon' => 'import',
'app' => 'importexport',
'text' => 'import'
);
}
if($cache[$appname]['export'])
{
$file['Export'] = array('link' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php',array(
'menuaction' => 'importexport.importexport_export_ui.export_dialog',
'appname'=>$appname
),false)."','_blank',850,440,'yes')",
'icon' => 'export',
'app' => 'importexport',
'text' => 'export'
);
}
if($file) display_sidebox($appname,lang('importexport'),$file);
}
}

View File

@ -30,6 +30,7 @@ $setup_info['importexport']['note'] =
$setup_info['importexport']['hooks']['preferences'] =
$setup_info['importexport']['hooks']['admin'] =
$setup_info['importexport']['hooks']['sidebox_menu'] = 'importexport_admin_prefs_sidebox_hooks::all_hooks';
$setup_info['importexport']['hooks']['sidebox_all'] = 'importexport_admin_prefs_sidebox_hooks::other_apps';
/* Dependencies for this app to work */
$setup_info['importexport']['depends'][] = array(