mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-09 00:14:57 +02:00
Drop tutorials
This commit is contained in:
@ -568,18 +568,6 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
|
||||
*/
|
||||
_init_sidebox: function(sidebox)
|
||||
{
|
||||
// Initialize egw tutorial sidebox, but only for non-popups, as calendar edit app.js has this.et2 set to tutorial et2 object
|
||||
if (!this.egw.is_popup())
|
||||
{
|
||||
var egw_fw = egw_getFramework();
|
||||
var tutorial = jQuery('#egw_tutorial_'+this.appname+'_sidebox', egw_fw ? egw_fw.sidemenuDiv : document);
|
||||
// _init_sidebox gets currently called multiple times, which needs to be fixed
|
||||
if (tutorial.length && !this.tutorial_initialised)
|
||||
{
|
||||
this.egwTutorial_init(tutorial[0]);
|
||||
this.tutorial_initialised = true;
|
||||
}
|
||||
}
|
||||
if(sidebox.length)
|
||||
{
|
||||
var self = this;
|
||||
@ -1185,137 +1173,6 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get json data for videos from the given url
|
||||
*
|
||||
* @return {Promise, object} return Promise, json object as resolved result and error message in case of failure
|
||||
*/
|
||||
egwTutorialGetData: function(){
|
||||
var self = this;
|
||||
return new Promise (function(_resolve, _reject)
|
||||
{
|
||||
var resolve = _resolve;
|
||||
var reject = _reject;
|
||||
// delay the execution and let the rendering catches up. Seems only FF problem
|
||||
window.setTimeout(function(){
|
||||
self.egw.json('EGroupware\\Api\\Framework\\Tutorial::ajax_data', [self.egw.app_name()], function(_data){
|
||||
resolve(_data);
|
||||
}).sendRequest();
|
||||
},0);
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Create and Render etemplate2 for egroupware tutorial
|
||||
* sidebox option. The .xet file is stored in api/templates/default/egw_tutorials
|
||||
*
|
||||
* @description tutorials json object should have the following structure:
|
||||
* object:
|
||||
* {
|
||||
* [app name]:{
|
||||
* [language tag]:[
|
||||
* {src:"",thumbnail:"",title:"",desc:""}
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* *Note: "desc" and "title" are optional attributes, which "desc" would appears as tooltip for the video.
|
||||
*
|
||||
* example:
|
||||
* {
|
||||
* "mail":{
|
||||
* "en":[
|
||||
* {src:"https://www.youtube.com/embed/mCDJndpjO40", thumbnail:"http://img.youtube.com/vi/mCDJndpjO40/0.jpg", "title":"PGP Encryption", "desc":""},
|
||||
* {src:"https://www.youtube.com/embed/mCDJndpjO", thumbnail:"http://img.youtube.com/vi/mCDJndpjO/0.jpg", "title":"Subscription", "desc":""},
|
||||
* ],
|
||||
* "de":[
|
||||
* {src:"https://www.youtube.com/embed/m40", thumbnail:"http://img.youtube.com/vi/m40/0.jpg", "title":"PGP Verschlüsselung", "desc":""},
|
||||
* {src:"https://www.youtube.com/embed/mpjO", thumbnail:"http://img.youtube.com/vi/mpjO/0.jpg", "title":"Ordner Abonnieren", "desc":""},
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @param {DOMNode} div
|
||||
*/
|
||||
egwTutorial_init: function(div)
|
||||
{
|
||||
// et2 object
|
||||
var etemplate = new etemplate2 (div, false);
|
||||
var template = egw.webserverUrl+'/api/templates/default/egw_tutorial.xet?1';
|
||||
|
||||
this.egwTutorialGetData().then(function(_data){
|
||||
var lang = egw.preference('lang');
|
||||
var content = {content:{list:[]}};
|
||||
if (_data && _data[egw.app_name()])
|
||||
{
|
||||
if (!_data[egw.app_name()][lang]) lang = 'en';
|
||||
if (typeof _data[egw.app_name()][lang] !='undefined'
|
||||
&& _data[egw.app_name()][lang].length > 0)
|
||||
{
|
||||
for (var i=0;i < _data[egw.app_name()][lang].length;i++)
|
||||
{
|
||||
var tuid = egw.app_name() + '-' +lang + '-' + i;
|
||||
_data[egw.app_name()][lang][i]['onclick'] = 'app.'+egw.app_name()+'.egwTutorialPopup("'+tuid+'")';
|
||||
}
|
||||
content.content.list = _data[egw.app_name()][lang];
|
||||
|
||||
if (template.indexOf('.xet') >0)
|
||||
{
|
||||
etemplate.load ('',template , content, function(){});
|
||||
}
|
||||
else
|
||||
{
|
||||
etemplate.load (template, '', content);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
function(_err){
|
||||
console.log(_err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Open popup to show given tutorial id
|
||||
* @param {string} _tuid tutorial object id
|
||||
* - tuid: appname-lang-index
|
||||
*/
|
||||
egwTutorialPopup: function (_tuid)
|
||||
{
|
||||
var url = egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid='+_tuid);
|
||||
egw.open_link(url,'_blank','960x580');
|
||||
},
|
||||
|
||||
/**
|
||||
* Function to set video iframe base on selected tutorial from tutorials box
|
||||
*
|
||||
* @param {string} _url
|
||||
*/
|
||||
tutorial_videoOnClick: function (_url)
|
||||
{
|
||||
var frame = etemplate2.getByApplication('api')[0].widgetContainer.getWidgetById('src');
|
||||
if (frame)
|
||||
{
|
||||
frame.set_value(_url);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Function calls on discard checkbox and will set
|
||||
* the egw_tutorial_noautoload preference
|
||||
*
|
||||
* @param {type} egw
|
||||
* @param {type} widget
|
||||
*/
|
||||
tutorial_autoloadDiscard: function (egw, widget)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
this.egw.set_preference('common', 'egw_tutorial_noautoload', widget.get_value());
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if Mailvelope is available, open (or create) "egroupware" keyring and call callback with it
|
||||
*
|
||||
|
Reference in New Issue
Block a user