diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index e85fd867b..da546a159 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -702,6 +702,22 @@ Common.Utils.createXhr = function () { return xmlhttp; } +Common.Utils.getConfigJson = function (url) { + if ( url ) { + try { + var xhrObj = Common.Utils.createXhr(); + if ( xhrObj ) { + xhrObj.open('GET', url, false); + xhrObj.send(''); + + return JSON.parse(xhrObj.responseText); + } + } catch (e) {} + } + + return null; +} + Common.Utils.asyncCall = function (callback, scope, args) { (new Promise(function (resolve, reject) { resolve(); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 8629ebb17..baec6aa61 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1854,23 +1854,7 @@ define([ requestPlugins: function(pluginsPath) { // request plugins if (!pluginsPath) return; - var _getPluginJson = function(plugin) { - if ( plugin ) { - try { - var xhrObj = Common.Utils.createXhr(); - if (xhrObj && plugin) { - xhrObj.open('GET', plugin, false); - xhrObj.send(''); - return JSON.parse(xhrObj.responseText); - } - } catch (e) {} - } - return null; - }; - - var value = _getPluginJson(pluginsPath); - if (value) - this.updatePlugins(value, false); + this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false ); }, updatePlugins: function(plugins, uiCustomize) { // plugins from config @@ -1879,29 +1863,15 @@ define([ var pluginsData = (uiCustomize) ? plugins.UIpluginsData : plugins.pluginsData; if (!pluginsData || pluginsData.length<1) return; - var _getPluginJson = function(plugin) { - if ( plugin ) { - try { - var xhrObj = Common.Utils.createXhr(); - if (xhrObj && plugin) { - xhrObj.open('GET', plugin, false); - xhrObj.send(''); - return JSON.parse(xhrObj.responseText); - } - } catch (e) {} - } - return null; - }; - var arr = [], baseUrl = _.isEmpty(plugins.url) ? "" : plugins.url; if (baseUrl !== "") - console.log("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."); + console.warn("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."); pluginsData.forEach(function(item){ - item = baseUrl + item; // for compatibility with previouse version of server, where plugins.url is used. - var value = _getPluginJson(item); + item = baseUrl + item; // for compatibility with previous version of server, where plugins.url is used. + var value = Common.Utils.getConfigJson(item); if (value) { value.baseUrl = item.substring(0, item.lastIndexOf("config.json")); value.oldVersion = (baseUrl !== ""); @@ -1922,18 +1892,11 @@ define([ if (plugins) { var arr = [], arrUI = []; plugins.pluginsData.forEach(function(item){ - if (uiCustomize!==undefined && (pluginStore.findWhere({baseUrl : item.baseUrl}) || pluginStore.findWhere({guid : item.guid}))) return; - - var variations = item.variations, - variationsArr = []; - variations.forEach(function(itemVar){ - var isSupported = false; - for (var i=0; i0 && !item.isUICustomizer) arr.push(new Common.Models.Plugin({ name : item.name, @@ -1972,15 +1931,12 @@ define([ })); }); - if (uiCustomize!==false) // from ui customizer in editor config or desktop event + if ( uiCustomize!==false ) // from ui customizer in editor config or desktop event this.UICustomizePlugins = arrUI; - if (uiCustomize === undefined) { // for desktop + if ( !uiCustomize ) { if (pluginStore) pluginStore.reset(arr); - this.appOptions.canPlugins = (pluginStore.length>0); - } else if (!uiCustomize) { - if (pluginStore) pluginStore.add(arr); - this.appOptions.canPlugins = (pluginStore.length>0); + this.appOptions.canPlugins = (pluginStore.length > 0); } } else if (!uiCustomize){ this.appOptions.canPlugins = false; diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 83e35489e..1396e18c7 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -242,7 +242,7 @@ define([ this.panelHistory = panel.render('#left-panel-history'); } else if (name == 'plugins' && !this.panelPlugins) { - this.panelPlugins = panel.render('#left-panel-plugins'); + this.panelPlugins = panel.render(/*'#left-panel-plugins'*/); } }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 4e94ea4be..2675b073c 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1625,43 +1625,7 @@ define([ requestPlugins: function(pluginsPath) { // request plugins if (!pluginsPath) return; - var _createXMLHTTPObject = function() { - var xmlhttp; - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - catch (E) { - xmlhttp = false; - } - } - if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { - xmlhttp = new XMLHttpRequest(); - } - return xmlhttp; - }; - - var _getPluginJson = function(plugin) { - if (!plugin) return ''; - try { - var xhrObj = _createXMLHTTPObject(); - if (xhrObj && plugin) { - xhrObj.open('GET', plugin, false); - xhrObj.send(''); - var pluginJson = eval("(" + xhrObj.responseText + ")"); - return pluginJson; - } - } - catch (e) {} - return null; - }; - - var value = _getPluginJson(pluginsPath); - if (value) - this.updatePlugins(value, false); + this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false ); }, @@ -1671,49 +1635,15 @@ define([ var pluginsData = (uiCustomize) ? plugins.UIpluginsData : plugins.pluginsData; if (!pluginsData || pluginsData.length<1) return; - var _createXMLHTTPObject = function() { - var xmlhttp; - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - catch (E) { - xmlhttp = false; - } - } - if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { - xmlhttp = new XMLHttpRequest(); - } - return xmlhttp; - }; - - var _getPluginJson = function(plugin) { - if (!plugin) return ''; - try { - var xhrObj = _createXMLHTTPObject(); - if (xhrObj && plugin) { - xhrObj.open('GET', plugin, false); - xhrObj.send(''); - var pluginJson = eval("(" + xhrObj.responseText + ")"); - return pluginJson; - } - } - catch (e) {} - return null; - }; - var arr = [], baseUrl = _.isEmpty(plugins.url) ? "" : plugins.url; if (baseUrl !== "") - console.log("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."); + console.warn("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."); pluginsData.forEach(function(item){ item = baseUrl + item; // for compatibility with previouse version of server, where plugins.url is used. - var value = _getPluginJson(item); + var value = Common.Utils.getConfigJson(item); if (value) { value.baseUrl = item.substring(0, item.lastIndexOf("config.json")); value.oldVersion = (baseUrl !== ""); @@ -1739,13 +1669,9 @@ define([ var variations = item.variations, variationsArr = []; variations.forEach(function(itemVar){ - var isSupported = false; - for (var i=0; i0 && !item.isUICustomizer) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index dbbc2bf8d..9c1aaa252 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1811,43 +1811,7 @@ define([ requestPlugins: function(pluginsPath) { // request plugins if (!pluginsPath) return; - var _createXMLHTTPObject = function() { - var xmlhttp; - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - catch (E) { - xmlhttp = false; - } - } - if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { - xmlhttp = new XMLHttpRequest(); - } - return xmlhttp; - }; - - var _getPluginJson = function(plugin) { - if (!plugin) return ''; - try { - var xhrObj = _createXMLHTTPObject(); - if (xhrObj && plugin) { - xhrObj.open('GET', plugin, false); - xhrObj.send(''); - var pluginJson = eval("(" + xhrObj.responseText + ")"); - return pluginJson; - } - } - catch (e) {} - return null; - }; - - var value = _getPluginJson(pluginsPath); - if (value) - this.updatePlugins(value, false); + this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false ); }, updatePlugins: function(plugins, uiCustomize) { // plugins from config @@ -1856,49 +1820,15 @@ define([ var pluginsData = (uiCustomize) ? plugins.UIpluginsData : plugins.pluginsData; if (!pluginsData || pluginsData.length<1) return; - var _createXMLHTTPObject = function() { - var xmlhttp; - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - catch (E) { - xmlhttp = false; - } - } - if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { - xmlhttp = new XMLHttpRequest(); - } - return xmlhttp; - }; - - var _getPluginJson = function(plugin) { - if (!plugin) return ''; - try { - var xhrObj = _createXMLHTTPObject(); - if (xhrObj && plugin) { - xhrObj.open('GET', plugin, false); - xhrObj.send(''); - var pluginJson = eval("(" + xhrObj.responseText + ")"); - return pluginJson; - } - } - catch (e) {} - return null; - }; - var arr = [], baseUrl = _.isEmpty(plugins.url) ? "" : plugins.url; if (baseUrl !== "") - console.log("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."); + console.warn("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."); pluginsData.forEach(function(item){ item = baseUrl + item; // for compatibility with previouse version of server, where plugins.url is used. - var value = _getPluginJson(item); + var value = Common.Utils.getConfigJson(item); if (value) { value.baseUrl = item.substring(0, item.lastIndexOf("config.json")); value.oldVersion = (baseUrl !== ""); @@ -1924,13 +1854,9 @@ define([ var variations = item.variations, variationsArr = []; variations.forEach(function(itemVar){ - var isSupported = false; - for (var i=0; i0 && !item.isUICustomizer)