diff --git a/home/inc/class.home_tutorial_ui.inc.php b/home/inc/class.home_tutorial_ui.inc.php
index 9de291e660..fb16226a87 100644
--- a/home/inc/class.home_tutorial_ui.inc.php
+++ b/home/inc/class.home_tutorial_ui.inc.php
@@ -25,7 +25,7 @@ class home_tutorial_ui {
* Popup window to display youtube video
* @param type $content
*/
- function popup ($content)
+ function popup ($content=null)
{
//Allow youtube frame to pass the CSP check
egw_framework::csp_frame_src_attrs(array('www.youtube.com'));
@@ -38,7 +38,7 @@ class home_tutorial_ui {
{
// read tutorials json file to fetch data
$tutorials = json_decode(self::getJsonData(), true);
- $apps = array();
+ $apps = array('introduction' => lang('Introduction'));
foreach ($tutorials as $app => $val)
{
// show only apps user has access to them
@@ -48,11 +48,15 @@ class home_tutorial_ui {
'apps' => $apps,
);
// 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'])))
+ if (in_array($tuid_indx[0], array_keys($GLOBALS['egw_info']['user']['apps'])) || $tuid_indx[0] === "introduction")
{
+ // fallback to english video
+ $tutorial = $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]? $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]:
+ $tutorials[$tuid_indx[0]]['en'][$tuid_indx[2]];
+
$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'],
+ 'src' => $tutorial['src'],
+ 'title' => $tutorial['title']
);
}
else
@@ -80,7 +84,7 @@ class home_tutorial_ui {
$tutorials = json_decode(self::getJsonData(), true);
$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
$response = egw_json_response::get();
- $response->data($tutorials[$_app][$lang]);
+ $response->data($tutorials[$_app][$lang]?$tutorials[$_app][$lang]:$tutorials[$_app]['en']);
}
/**
@@ -103,8 +107,8 @@ class home_tutorial_ui {
if (!($json = egw_cache::getCache(egw_cache::TREE, 'home', 'egw_tutorial_json')))
{
$json = file_get_contents('http://www.egroupware.de/videos/tutorials.json');
- // Cache the json object for one month
- egw_cache::addCache(egw_cache::TREE, 'home', 'egw_tutorial_json', $json, 3600 * 720);
+ // Cache the json object for two hours
+ egw_cache::setCache(egw_cache::TREE, 'home', 'egw_tutorial_json', $json, 720);
}
return $json;
diff --git a/home/js/app.js b/home/js/app.js
index 1ae16e9eb1..ef11669748 100644
--- a/home/js/app.js
+++ b/home/js/app.js
@@ -99,8 +99,6 @@ 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']);
@@ -790,20 +788,6 @@ app.classes.home = AppJS.extend(
}
},
- /**
- * 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
@@ -815,7 +799,7 @@ app.classes.home = AppJS.extend(
{
if (widget)
{
- this.egw.set_preference('home', 'egw_tutorial_autoload', widget.get_value());
+ this.egw.set_preference('common', 'egw_tutorial_autoload', widget.get_value());
}
}
});
diff --git a/home/templates/default/tutorial.xet b/home/templates/default/tutorial.xet
index d9136bc683..9c3217ff9c 100644
--- a/home/templates/default/tutorial.xet
+++ b/home/templates/default/tutorial.xet
@@ -10,10 +10,10 @@
-
+
-
+
diff --git a/phpgwapi/js/framework/fw_browser.js b/phpgwapi/js/framework/fw_browser.js
index d4faab33c8..86eb520405 100644
--- a/phpgwapi/js/framework/fw_browser.js
+++ b/phpgwapi/js/framework/fw_browser.js
@@ -172,6 +172,14 @@ var fw_browser = Class.extend({
// Remove escape timeout
clearTimeout(self.ajaxLoaderDivTimeout);
}
+
+ // Open tutorial popup with an introduction video about egroupware
+ // the popup can be discarded for the next time show if user
+ // check the discard checkbox
+ if (!egw.preference('egw_tutorial_autoload', 'common'))
+ {
+ egw.open_link(egw.link('/index.php', 'menuaction=home.home_tutorial_ui.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','750x580');
+ }
});
// Check whether the given url is a pseudo url which should be executed