diff --git a/home/inc/class.home_tutorial_ui.inc.php b/home/inc/class.home_tutorial_ui.inc.php index 86dacc5a0e..9de291e660 100644 --- a/home/inc/class.home_tutorial_ui.inc.php +++ b/home/inc/class.home_tutorial_ui.inc.php @@ -41,15 +41,30 @@ class home_tutorial_ui { $apps = array(); foreach ($tutorials as $app => $val) { - $apps [$app] = $app; + // show only apps user has access to them + if (in_array($app, array_keys($GLOBALS['egw_info']['user']['apps']))) $apps [$app] = $app; } $sel_options = array( 'apps' => $apps, ); - $content = array ( - 'src' => $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]['src'], - 'title' => $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]['title'], - ); + // Check if the user has right to see the app's tutorial + if (in_array($tuid_indx[0], array_keys($GLOBALS['egw_info']['user']['apps']))) + { + $content = array ( + 'src' => $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]['src'], + 'title' => $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]['title'], + ); + } + else + { + $content = array(); + egw_framework::message(lang('You do not have permission to see this tutorial!')); + } + // If its the autoloading tutorial + if ($tuid_indx[3] === 'a') + { + $content ['discardbox'] = true; + } } $tmpl->exec('home.home_tutorial_ui.popup', $content,$sel_options,array(),array(),array(),2); diff --git a/home/js/app.js b/home/js/app.js index 74a89c5934..1ae16e9eb1 100644 --- a/home/js/app.js +++ b/home/js/app.js @@ -98,7 +98,9 @@ app.classes.home = AppJS.extend( { // call parent this._super.apply(this, arguments); - + + this.tutorial_autoload_popup(); + this.et2.set_id('home.index'); this.et2.set_actions(this.et2.getArrayMgr('modifications').getEntry('home.index')['actions']); @@ -786,6 +788,35 @@ app.classes.home = AppJS.extend( { frame.set_value(widget.get_value()); } + }, + + /** + * Open tutorial popup with a general video about egroupware + * the popup can be discarded for the next time show if user + * check the discard checkbox + */ + tutorial_autoload_popup:function() + { + var discarded = this.egw.preference('egw_tutorial_autoload', 'home'); + if (!discarded) + { + this.egwTutorialPopup('home-'+this.egw.preference('lang')+'-0-a'); + } + }, + + /** + * Function calls on discard checkbox and will set + * the egw_tutorial_autoload preference + * + * @param {type} egw + * @param {type} widget + */ + tutorial_autoloadDiscard: function (egw, widget) + { + if (widget) + { + this.egw.set_preference('home', 'egw_tutorial_autoload', widget.get_value()); + } } }); diff --git a/home/templates/default/tutorial.xet b/home/templates/default/tutorial.xet index 8cfbbf2352..d9136bc683 100644 --- a/home/templates/default/tutorial.xet +++ b/home/templates/default/tutorial.xet @@ -8,7 +8,7 @@