forked from extern/egroupware
Add missing parts from last commit
This commit is contained in:
commit
adaa1074b3
119
home/inc/class.home_tutorial_ui.inc.php
Normal file
119
home/inc/class.home_tutorial_ui.inc.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Tutorial
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package home
|
||||
* @author Hadi Nategh [hn@stylite.de]
|
||||
* @copyright (c) 2015 by Stylite AG <info-AT-stylite.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
class home_tutorial_ui {
|
||||
|
||||
/**
|
||||
* Methods callable via menuaction
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $public_functions = array(
|
||||
'popup' => true
|
||||
);
|
||||
|
||||
/**
|
||||
* Popup window to display youtube video
|
||||
* @param type $content
|
||||
*/
|
||||
function popup ($content=null)
|
||||
{
|
||||
//Allow youtube frame to pass the CSP check
|
||||
egw_framework::csp_frame_src_attrs(array('www.youtube.com'));
|
||||
|
||||
$tmpl = new etemplate_new('home.tutorial');
|
||||
if (!is_array($content))
|
||||
{
|
||||
// Get tutorial object id
|
||||
$tuid_indx = explode('-',$_GET['tuid']);
|
||||
$appName = $tuid_indx[0];
|
||||
$lang = $tuid_indx[1];
|
||||
$id = $tuid_indx[2];
|
||||
}
|
||||
else // set the first video of selected app
|
||||
{
|
||||
$appName = $content['list']['apps'];
|
||||
$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
|
||||
$id ="0";
|
||||
}
|
||||
// read tutorials json file to fetch data
|
||||
$tutorials = json_decode(self::getJsonData(), true);
|
||||
$apps = array('introduction' => lang('Introduction'));
|
||||
foreach ($tutorials as $app => $val)
|
||||
{
|
||||
// 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,
|
||||
);
|
||||
// Check if the user has right to see the app's tutorial
|
||||
if (in_array($appName, array_keys($GLOBALS['egw_info']['user']['apps'])) || $appName === "introduction")
|
||||
{
|
||||
// fallback to english video
|
||||
$tutorial = $tutorials[$appName][$lang][$id]? $tutorials[$appName][$lang][$id]:
|
||||
$tutorials[$appName]['en'][$id];
|
||||
|
||||
$list = array(
|
||||
'apps' => $appName,
|
||||
'0' => ''
|
||||
);
|
||||
foreach ($tutorials[$appName][$lang] as $v)
|
||||
{
|
||||
$v ['onclick'] = 'app.home.tutorial_videoOnClick("'.$v['src'].'")';
|
||||
array_push($list, $v);
|
||||
}
|
||||
$content = array (
|
||||
'src' => $tutorial['src'],
|
||||
'title' => $tutorial['title'],
|
||||
'desc' => $tutorial['desc'],
|
||||
'list' => $list
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = array();
|
||||
egw_framework::message(lang('You do not have permission to see this tutorial!'));
|
||||
}
|
||||
|
||||
$tmpl->exec('home.home_tutorial_ui.popup', $content,$sel_options,array(),array(),array(),2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax function to get videos links as json
|
||||
*/
|
||||
function ajax_data()
|
||||
{
|
||||
$response = egw_json_response::get();
|
||||
$response->data(json_decode(self::getJsonData()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to fetch data from tutorials.json file
|
||||
* @return string returns json string
|
||||
*
|
||||
* @TODO: implement tree level caching
|
||||
*/
|
||||
static function getJsonData()
|
||||
{
|
||||
if (!($json = egw_cache::getCache(egw_cache::TREE, 'home', 'egw_tutorial_json')))
|
||||
{
|
||||
$json = file_get_contents('http://www.egroupware.de/videos/tutorials.json');
|
||||
// Fallback tutorials.json
|
||||
if (!$json) $json = file_get_contents('home/setup/tutorials.json');
|
||||
// Cache the json object for two hours
|
||||
egw_cache::setCache(egw_cache::TREE, 'home', 'egw_tutorial_json', $json, 720);
|
||||
}
|
||||
|
||||
return $json;
|
||||
}
|
||||
}
|
@ -746,6 +746,36 @@ app.classes.home = AppJS.extend(
|
||||
nm.div.toggleClass('header_hidden');
|
||||
nm.set_hide_header(nm.div.hasClass('header_hidden'));
|
||||
nm.resize();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function to set video iframe base on selected tutorial from
|
||||
* tutorials box
|
||||
*
|
||||
* @param {type} url
|
||||
*/
|
||||
tutorial_videoOnClick: function (_url)
|
||||
{
|
||||
var frame = etemplate2.getByApplication('home')[0].widgetContainer.getWidgetById('src');
|
||||
if (frame)
|
||||
{
|
||||
frame.set_value(_url);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 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('common', 'egw_tutorial_autoload', widget.get_value());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -27,6 +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';
|
||||
|
||||
/* Dependencies for this app to work */
|
||||
$setup_info['home']['depends'][] = array(
|
||||
|
89
home/setup/tutorials.json
Normal file
89
home/setup/tutorials.json
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"introduction":{
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/iPrtjeEnXeU?rel=0&autoplay=1", "thumbnail":"https://img.youtube.com/vi/iPrtjeEnXeU/0.jpg", "title":"EGroupware Basics", "desc":"Some of EGroupwares most important basic features and functions in all apps."}
|
||||
]
|
||||
},
|
||||
"mail":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/wUdHb6Zha60?rel=0&autoplay=1","title":"EGroupware E-Mail Basics","thumbnail":"https://img.youtube.com/vi/wUdHb6Zha60/0.jpg", "desc":"Hier zeigen wir einige praktische Funktionen der Anwendung Mail. Beipiele: Benutzung des Kontextmenüs und Anpassen des Vorschaudialogs für Emails."},
|
||||
{"src":"https://www.youtube.com/embed/7DZKPKa_Rj0?rel=0&autoplay=1","title":"EGroupware E-Mail Account Management","thumbnail":"https://img.youtube.com/vi/7DZKPKa_Rj0/0.jpg", "desc":"In diesem Tutorial erklären wir, wie einfach Sie sich selbst einen neuen Mailaccount anlegen und wie schnell das geht."},
|
||||
{"src":"https://www.youtube.com/embed/vml4Ok1qdGM?rel=0&autoplay=1","title":"EGroupware Admin Mail","thumbnail":"https://img.youtube.com/vi/vml4Ok1qdGM/0.jpg", "desc":"Hier zeigen wir - für alle Admins - wichtige Einstellungen in EGroupware Mail!"},
|
||||
{"src":"https://www.youtube.com/embed/A_tkKYaW_iI?rel=0&autoplay=1","title":"EGroupware 14.2 neue Features","thumbnail":"https://img.youtube.com/vi/A_tkKYaW_iI/0.jpg", "desc":"In diesem Video werden die drei wichtigsten Neuerungen der neuen EGroupware Version 14.2. beschrieben."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/5ukeZd-kEMo?rel=0&autoplay=1","title":"EGroupware E-Mail Basics","thumbnail":"https://img.youtube.com/vi/5ukeZd-kEMo/0.jpg", "desc":"Here we show some useful features of mail application. E.g. we explain how to use context menu or how you can customize preview dialog."},
|
||||
{"src":"https://www.youtube.com/embed/LkWOL8PkgvU?rel=0&autoplay=1","title":"EGroupware E-Mail account management","thumbnail":"https://img.youtube.com/vi/LkWOL8PkgvU/0.jpg", "desc":"In this tutorial we explain, how fast and how easy you create your own mail account."},
|
||||
{"src":"https://www.youtube.com/embed/8CTF7w3K8kA?rel=0&autoplay=1","title":"EGroupware Admin Mail","thumbnail":"https://img.youtube.com/vi/8CTF7w3K8kA/0.jpg", "desc":"We show, how you – as an admin – change settings for one user in Stylite Mail Hosting."},
|
||||
{"src":"https://www.youtube.com/embed/mCDJndpjO40?rel=0&autoplay=1","title":"EGroupware 14.2 new features","thumbnail":"https://img.youtube.com/vi/mCDJndpjO40/0.jpg", "desc":"This video shows the three main features of upcoming new EGroupware version 14.2."}
|
||||
]
|
||||
},
|
||||
"admin":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/a-VYyo7rQxA?rel=0&autoplay=1","title":"EGroupware Admin Basics","thumbnail":"https://img.youtube.com/vi/a-VYyo7rQxA/0.jpg", "desc":"Grundlagen der EGroupware Administration: Benutzer und Gruppen anlegen, Kategorien anlegen, Zugriffsrechte vergeben und benutzerdefinierte Felder erstellen."},
|
||||
{"src":"https://www.youtube.com/embed/vml4Ok1qdGM?rel=0&autoplay=1","title":"EGroupware Admin Mail","thumbnail":"https://img.youtube.com/vi/vml4Ok1qdGM/0.jpg", "desc":"Hier zeigen wir - für alle Admins - wichtige Einstellungen in EGroupware Mail!"},
|
||||
{"src":"https://www.youtube.com/embed/7DZKPKa_Rj0?rel=0&autoplay=1","title":"EGroupware E-Mail Account Management","thumbnail":"https://img.youtube.com/vi/7DZKPKa_Rj0/0.jpg", "desc":"In diesem Tutorial erklären wir, wie einfach Sie sich selbst einen neuen Mailaccount anlegen und wie schnell das geht."},
|
||||
{"src":"https://www.youtube.com/embed/e_X2InMcBao?rel=0&autoplay=1","title":"EGroupware Synchronisation - Apple","thumbnail":"https://img.youtube.com/vi/e_X2InMcBao/0.jpg", "desc":"In diesem Video erklären wir Schritt für Schritt die Synchronisation mit Ihrem Mobilgerät - für alle Apple-Geräte."},
|
||||
{"src":"https://www.youtube.com/embed/hJWQYzxC9MA?rel=0&autoplay=1","title":"EGroupware Synchronisation - Android","thumbnail":"https://img.youtube.com/vi/hJWQYzxC9MA/0.jpg", "desc":"In diesem Video erklären wir Schritt für Schritt die Synchronisation mit Ihrem Mobilgerät - für alle Android-Geräte."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/W0q2HyT6tQU?rel=0&autoplay=1","title":"EGroupware Admin Basics","thumbnail":"https://img.youtube.com/vi/W0q2HyT6tQU/0.jpg", "desc":"Basics of EGroupware Administration: create users and groups, add categories, define access rights and custom fields."},
|
||||
{"src":"https://www.youtube.com/embed/8CTF7w3K8kA?rel=0&autoplay=1","title":"EGroupware Admin Mail","thumbnail":"https://img.youtube.com/vi/8CTF7w3K8kA/0.jpg", "desc":"We show, how you – as an admin – change settings for one user in Stylite Mail Hosting."},
|
||||
{"src":"https://www.youtube.com/embed/LkWOL8PkgvU?rel=0&autoplay=1","title":"EGroupware E-Mail account management","thumbnail":"https://img.youtube.com/vi/LkWOL8PkgvU/0.jpg", "desc":"In this tutorial we explain, how fast and how easy you create your own mail account."},
|
||||
{"src":"https://www.youtube.com/embed/hHxjjQ_MqnY?rel=0&autoplay=1","title":"EGroupware Synchronisation - Apple","thumbnail":"https://img.youtube.com/vi/hHxjjQ_MqnY/0.jpg", "desc":"We explain step by step, how to synchronise EGroupware with your smartphone or tablet - for all Apple devices."},
|
||||
{"src":"https://www.youtube.com/embed/-NdgyI7BDpY?rel=0&autoplay=1","title":"EGroupware Synchronisation - Android","thumbnail":"https://img.youtube.com/vi/-NdgyI7BDpY/0.jpg", "desc":"We explain step by step, how to synchronise EGroupware with your smartphone or tablet - for all Android devices."}
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
"filemanager":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/scB_l7OjdJI?rel=0&autoplay=1","title":"EGroupware Dateimanager","thumbnail":"https://img.youtube.com/vi/scB_l7OjdJI/0.jpg", "desc":"In diesem Tutorial gibt es praktische Tipps und Erklärungen zur Nutzung des Dateimanagers."},
|
||||
{"src":"https://www.youtube.com/embed/A_tkKYaW_iI?rel=0&autoplay=1","title":"EGroupware 14.2 neue Features","thumbnail":"https://img.youtube.com/vi/A_tkKYaW_iI/0.jpg", "desc":"In diesem Video werden die drei wichtigsten Neuerungen der neuen EGroupware Version 14.2. beschrieben."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/lOR3vo6hMwA?rel=0&autoplay=1","title":"EGroupware File Manager","thumbnail":"https://img.youtube.com/vi/lOR3vo6hMwA/0.jpg", "desc":"We here give some useful tips concerning the usage of filemanager. We talk about handling and usability and the new sharing options that are available with version 14.2."},
|
||||
{"src":"https://www.youtube.com/embed/mCDJndpjO40?rel=0&autoplay=1","title":"EGroupware 14.2 new features","thumbnail":"https://img.youtube.com/vi/mCDJndpjO40/0.jpg", "desc":"This video shows the three main features of upcoming new EGroupware version 14.2."}
|
||||
]
|
||||
},
|
||||
"infolog":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/fiPjk49HtMY?rel=0&autoplay=1","title":"EGroupware - CRM","thumbnail":"https://img.youtube.com/vi/fiPjk49HtMY/0.jpg", "desc":"Customer Relationship Management - Hier zeigen wir, wie Kontakte und Termine von Kunden oder Partnern mit Adressbuch, Kalender und InfoLog abgebildet werden können."},
|
||||
{"src":"https://www.youtube.com/embed/A_tkKYaW_iI?rel=0&autoplay=1","title":"EGroupware 14.2 neue Features","thumbnail":"https://img.youtube.com/vi/A_tkKYaW_iI/0.jpg", "desc":"In diesem Video werden die drei wichtigsten Neuerungen der neuen EGroupware Version 14.2. beschrieben."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/HwjZFnitqRQ?rel=0&autoplay=1","title":"EGroupware - CRM","thumbnail":"https://img.youtube.com/vi/HwjZFnitqRQ/0.jpg", "desc":"Customer Relationship Management - We show, how contacts and events of customers or partners can be edited with Addressbook, Calendar and InfoLog."},
|
||||
{"src":"https://www.youtube.com/embed/mCDJndpjO40?rel=0&autoplay=1","title":"EGroupware 14.2 new features","thumbnail":"https://img.youtube.com/vi/mCDJndpjO40/0.jpg", "desc":"This video shows the three main features of upcoming new EGroupware version 14.2."}
|
||||
]
|
||||
},
|
||||
"calendar":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/fiPjk49HtMY?rel=0&autoplay=1","title":"EGroupware - CRM","thumbnail":"https://img.youtube.com/vi/fiPjk49HtMY/0.jpg", "desc":"Customer Relationship Management - Hier zeigen wir, wie Kontakte und Termine von Kunden oder Partnern mit Adressbuch, Kalender und InfoLog abgebildet werden können."},
|
||||
{"src":"https://www.youtube.com/embed/rP_fK7Dk42s?rel=0&autoplay=1","title":"EGroupware für Universitäten und Schulen ","thumbnail":"https://img.youtube.com/vi/rP_fK7Dk42s/0.jpg", "desc":"Die EGroupware Ressourcen-Verwaltung ersetzt einzelne Listen und Aushänge und kann den Verleih von Beamern oder Laptops sowie die Nutzung von Sportplatz oder Sitzungssaal übersichtlich abbilden."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/HwjZFnitqRQ?rel=0&autoplay=1","title":"EGroupware - CRM","thumbnail":"https://img.youtube.com/vi/HwjZFnitqRQ/0.jpg", "desc":"Customer Relationship Management - We show, how contacts and events of customers or partners can be edited with Addressbook, Calendar and InfoLog."}
|
||||
]
|
||||
},
|
||||
"home":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/A_tkKYaW_iI?rel=0&autoplay=1","title":"EGroupware 14.2 neue Features","thumbnail":"https://img.youtube.com/vi/A_tkKYaW_iI/0.jpg", "desc":"In diesem Video werden die drei wichtigsten Neuerungen der neuen EGroupware Version 14.2. beschrieben."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/mCDJndpjO40?rel=0&autoplay=1","title":"EGroupware 14.2 new features","thumbnail":"https://img.youtube.com/vi/mCDJndpjO40/0.jpg", "desc":"This video shows the three main features of upcoming new EGroupware version 14.2."}
|
||||
]
|
||||
},
|
||||
"ressources":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/rP_fK7Dk42s?rel=0&autoplay=1","title":"EGroupware für Universitäten und Schulen ","thumbnail":"https://img.youtube.com/vi/rP_fK7Dk42s/0.jpg", "desc":"Die EGroupware Ressourcen-Verwaltung ersetzt einzelne Listen und Aushänge und kann den Verleih von Beamern oder Laptops sowie die Nutzung von Sportplatz oder Sitzungssaal übersichtlich abbilden."}
|
||||
]
|
||||
},
|
||||
"addressbook":{
|
||||
"de":[
|
||||
{"src":"https://www.youtube.com/embed/0JqoFhAGLwo?rel=0&autoplay=1","title":"EGroupware Basics","thumbnail":"https://img.youtube.com/vi/0JqoFhAGLwo/0.jpg", "desc":"Die wichtigsten Basics von EGroupware und die grundlegenden Funktionen der Software."}
|
||||
],
|
||||
"en":[
|
||||
{"src":"https://www.youtube.com/embed/iPrtjeEnXeU?rel=0&autoplay=1","title":"EGroupware Basics","thumbnail":"https://img.youtube.com/vi/iPrtjeEnXeU/0.jpg", "desc":"Some of EGroupwares most important basic features and functions in all apps."}
|
||||
]
|
||||
}
|
||||
}
|
39
home/templates/default/tutorial.xet
Normal file
39
home/templates/default/tutorial.xet
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="home.tutorial" template="" lang="" group="0" version="15.1">
|
||||
<hbox height="90%" class="tutorial_popup">
|
||||
<hbox class="tutorial_videoList" width="220px">
|
||||
<grid id="list" classs="egwGridView_grid" resize_ratio="0" width="220px">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th" part="header">
|
||||
<menulist>
|
||||
<menupopup id="apps" label="Applications" statustext="Please select application name" onchange="1"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row>
|
||||
<vbox onclick="$row_cont[onclick]" align="center" statustext="$row_cont[desc]">
|
||||
<hbox background="$row_cont[thumbnail]" height="130px" width="210px" class="egw_tutorial_thumb">
|
||||
<description value = "$row_cont[title]" class="egw_tutorial_title"/>
|
||||
<hbox id="play" class="egw_tutorial_playBtn">
|
||||
<hbox></hbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</hbox>
|
||||
<hbox class="tutorial_iframe_wrapper">
|
||||
<iframe id="src" height="100%" seamless="true" width="100%" fullscreen="true"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox class="dialogFooterToolbar">
|
||||
<button align="left" statustext="Close this window" label="Close" id="button[close]" onclick="window.close()" image="close" background_image="1"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user