mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
register home hooks if tutorial_menu hook is not registered eg. on call of intro video, moved hook to tutorial class
This commit is contained in:
parent
ad6cfe4871
commit
979a910e7f
@ -28,6 +28,15 @@ class home_tutorial_ui
|
||||
*/
|
||||
function popup ($content=null)
|
||||
{
|
||||
// check and if not done register tutorial_menu hook
|
||||
if (!$GLOBALS['egw']->hooks->hook_exists('sidebox_all', 'home') ||
|
||||
$GLOBALS['egw']->hooks->locations['sidebox_all']['home'] != 'home_tutorial_ui::tutorial_menu')
|
||||
{
|
||||
$setup_info = array();
|
||||
include(EGW_SERVER_ROOT.'/home/setup/setup.inc.php');
|
||||
$GLOBALS['egw']->hooks->register_hooks('home', $setup_info['home']['hooks']);
|
||||
}
|
||||
|
||||
//Allow youtube frame to pass the CSP check
|
||||
egw_framework::csp_frame_src_attrs(array('www.youtube.com'));
|
||||
|
||||
@ -116,4 +125,28 @@ class home_tutorial_ui
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to build egw tutorial sidebox menu
|
||||
*
|
||||
*/
|
||||
public static function tutorial_menu()
|
||||
{
|
||||
$tutorials = json_decode(self::getJsonData(),true);
|
||||
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
if (!is_array($tutorials[$appname])) return false;
|
||||
if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'])
|
||||
{
|
||||
$file = Array (
|
||||
array(
|
||||
'text' => '<div id="egw_tutorial_'.$appname.'_sidebox" class="egwTutorial"/>',
|
||||
'no_lang' => true,
|
||||
'link' => false,
|
||||
'icon' => false,
|
||||
),
|
||||
'menuOpened' => true
|
||||
);
|
||||
display_sidebox($appname, lang('Video Tutorials'), $file);
|
||||
}
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ $setup_info['home']['maintainer'] = array(
|
||||
/* The hooks this app includes, needed for hooks registration */
|
||||
$setup_info['home']['hooks']['hasUpdates'] = 'home.updates.hasUpdates';
|
||||
$setup_info['home']['hooks']['showUpdates'] = 'home.updates.showUpdates';
|
||||
$setup_info['home']['hooks']['sidebox_all'] = 'hooks::egw_tutorial_menu';
|
||||
$setup_info['home']['hooks']['sidebox_all'] = 'home_tutorial_ui::tutorial_menu';
|
||||
|
||||
/* Dependencies for this app to work */
|
||||
$setup_info['home']['depends'][] = array(
|
||||
|
@ -383,24 +383,10 @@ class hooks
|
||||
/**
|
||||
* Static function to build egw tutorial sidebox menu
|
||||
*
|
||||
* @deprecated can be removed 2016, as replaced by home_tutorial_ui::tutorial_menu
|
||||
*/
|
||||
public static function egw_tutorial_menu()
|
||||
{
|
||||
$tutorials = json_decode(home_tutorial_ui::getJsonData(),true);
|
||||
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
if (!is_array($tutorials[$appname])) return false;
|
||||
if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'])
|
||||
{
|
||||
$file = Array (
|
||||
array(
|
||||
'text' => '<div id="egw_tutorial_'.$appname.'_sidebox" class="egwTutorial"/>',
|
||||
'no_lang' => true,
|
||||
'link' => false,
|
||||
'icon' => false,
|
||||
),
|
||||
'menuOpened' => true
|
||||
);
|
||||
display_sidebox($appname, lang('Video Tutorials'), $file);
|
||||
}
|
||||
home_tutorial_ui::tutorial_menu();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user