Skip to content

Commit

Permalink
Merge branch 'hotfix/0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh committed Jul 4, 2018
2 parents c2d0f2f + 201a265 commit 52f7dd6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 33 deletions.
62 changes: 32 additions & 30 deletions js/app.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,31 @@
// pass php xivo config to javascript
var xivo_config = $xivoconfig;
// config requirejs for xivo xuc libs (some have dependencies)
require.config({
paths: {
"xivo_plugin": '../plugins/xivo/js',
"store2": '../plugins/xivo/js/store2.min',
"xuc_lib": xivo_config.xuc_url + '/xucassets/javascripts',
},
shim: {
'xuc_lib/xc_webrtc': {
deps: ['xuc_lib/cti', 'xuc_lib/SIPml-api'],
$(function() {
// config requirejs for xivo xuc libs (some have dependencies)
require.config({
paths: {
"xivo_plugin": '../plugins/xivo/js',
"store2": '../plugins/xivo/js/store2.min',
"xuc_lib": xivo_config.xuc_url + '/xucassets/javascripts',
"jstree": '../lib/jqueryplugins/jstree/jstree.min'
},
shim: {
'xuc_lib/xc_webrtc': {
deps: ['xuc_lib/cti', 'xuc_lib/SIPml-api'],
}
}
}
});
// define an array of xuc libraries for future usage
var xuc_libs = [
'xuc_lib/shotgun',
'xuc_lib/cti',
'xuc_lib/callback',
'xuc_lib/membership',
'xuc_lib/SIPml-api',
'xuc_lib/xc_webrtc',
'xivo_plugin/xuc',
];
});
$(function() {
if (typeof xivo_config != "object"
|| !xivo_config.enable_xuc) {
return false;
}
// register the current jQuery to avoid trying loading it with requirejs
// without it, jstree (entity selector) fails (see https://github.com/pluginsGLPI/xivo/issues/10)
define('jquery', [], function () {
return jQuery;
});
// finally call jstree directly (on all page :/)
require(['jstree']);
// load session storage
require(['store2'], function(store) {
if (xivo_config.xuc_local_store) {
console.log("xivo plugin use local storage");
Expand All @@ -62,7 +55,16 @@
}
});
require(xuc_libs, function() {
// init xuc features
require([
'xuc_lib/shotgun',
'xuc_lib/cti',
'xuc_lib/callback',
'xuc_lib/membership',
'xuc_lib/SIPml-api',
'xuc_lib/xc_webrtc',
'xivo_plugin/xuc',
], function() {
// call xuc integration
var xuc_obj = new Xuc();
xuc_obj.init();
Expand Down
9 changes: 6 additions & 3 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
--------------------------------------------------------------------------
*/

define('PLUGIN_XIVO_VERSION', '0.3.4');
define('PLUGIN_XIVO_VERSION', '0.3.5');

if (!defined("PLUGINXIVO_DIR")) {
define("PLUGINXIVO_DIR", GLPI_ROOT . "/plugins/xivo");
Expand Down Expand Up @@ -73,11 +73,14 @@ function plugin_init_xivo() {
'css/animation.css',
'css/main.css'
];

$PLUGIN_HOOKS['add_javascript']['xivo'] = [
'js/require.js',
'js/app.js.php',
'js/common.js',
];
if ($xivoconfig['enable_xuc']) {
$PLUGIN_HOOKS['add_javascript']['xivo'][] = 'js/require.js';
$PLUGIN_HOOKS['add_javascript']['xivo'][] = 'js/app.js.php';
}

// standard hooks
$PLUGIN_HOOKS['item_purge']['xivo'] = [
Expand Down

0 comments on commit 52f7dd6

Please sign in to comment.