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:
Ralf Becker
2015-10-28 08:36:37 +00:00
parent ad6cfe4871
commit 979a910e7f
3 changed files with 36 additions and 17 deletions

View File

@ -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);
}
}
}