diff --git a/home/inc/class.home_tutorial_ui.inc.php b/home/inc/class.home_tutorial_ui.inc.php index da5fccd870..e922f11952 100644 --- a/home/inc/class.home_tutorial_ui.inc.php +++ b/home/inc/class.home_tutorial_ui.inc.php @@ -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' => '
', + 'no_lang' => true, + 'link' => false, + 'icon' => false, + ), + 'menuOpened' => true + ); + display_sidebox($appname, lang('Video Tutorials'), $file); + } + } } \ No newline at end of file diff --git a/home/setup/setup.inc.php b/home/setup/setup.inc.php index 7b4d98ef4b..11d9970040 100755 --- a/home/setup/setup.inc.php +++ b/home/setup/setup.inc.php @@ -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( diff --git a/phpgwapi/inc/class.hooks.inc.php b/phpgwapi/inc/class.hooks.inc.php index 8f7a97bd25..e499b12986 100644 --- a/phpgwapi/inc/class.hooks.inc.php +++ b/phpgwapi/inc/class.hooks.inc.php @@ -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' => '', - 'no_lang' => true, - 'link' => false, - 'icon' => false, - ), - 'menuOpened' => true - ); - display_sidebox($appname, lang('Video Tutorials'), $file); - } + home_tutorial_ui::tutorial_menu(); } }