forked from extern/egroupware
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
b978aa102e
commit
d1e48df951
@ -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(
|
||||
|
@ -366,28 +366,14 @@ 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