mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
WIP EGroupware tutorial:
- Open autoload introduction tutorial from all apps - Provide fallback tutorial
This commit is contained in:
parent
5a08713cbc
commit
61db4b7559
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -10,10 +10,10 @@
|
||||
<button align="left" statustext="Close this window" label="Close" id="button[close]" onclick="window.close()" image="close" background_image="1"/>
|
||||
<hbox disabled="@discardbox">
|
||||
<menulist>
|
||||
<menupopup id="apps" label="Applications" statustext="Please select application name" options="Please select" onchange="app.home.tutorial_appChange"/>
|
||||
<menupopup id="apps" label="Applications" statustext="Please select application name" onchange="app.home.tutorial_appChange"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup id="tutorials" label="Tutorilas" statustext="Please select a tutorial" options="Please select" onchange="app.home.tutorial_tutorialsChange"/>
|
||||
<menupopup id="tutorials" label="Tutorilas" statustext="Please select a tutorial" onchange="app.home.tutorial_tutorialsChange"/>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox disabled="!@discardbox" class="discard_checkbox">
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user