From 6bfd3d80bb675d81a52203a9682cfc5ab8faf57c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 5 Sep 2016 18:28:56 +0300 Subject: [PATCH] Absolute urls in plugins. --- apps/common/main/lib/controller/Plugins.js | 9 ++++++--- apps/common/main/lib/model/Plugin.js | 3 ++- apps/common/main/lib/view/Plugins.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 3 ++- apps/presentationeditor/main/app/controller/Main.js | 3 ++- apps/spreadsheeteditor/main/app/controller/Main.js | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 05a40c768..cc111a1fb 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -219,8 +219,12 @@ define([ onPluginShow: function(plugin, variationIndex) { var variation = plugin.get_Variations()[variationIndex]; if (variation.get_Visual()) { + var url = variation.get_Url(); + if (!/(^https?:\/\/)/i.test(url) && !/(^www.)/i.test(url)) + url = ((plugin.get_BaseUrl().length == 0) ? this.panelPlugins.pluginsPath : plugin.get_BaseUrl()) + url; + if (variation.get_InsideMode()) { - this.panelPlugins.openInsideMode(plugin.get_Name(), ((plugin.get_BaseUrl().length == 0) ? this.panelPlugins.pluginsPath : plugin.get_BaseUrl()) + variation.get_Url()); + this.panelPlugins.openInsideMode(plugin.get_Name(), url); } else { var me = this, arrBtns = variation.get_Buttons(), @@ -234,12 +238,11 @@ define([ }); } - var _baseUrl = (plugin.get_BaseUrl().length == 0) ? me.panelPlugins.pluginsPath : plugin.get_BaseUrl(); me.pluginDlg = new Common.Views.PluginDlg({ title: plugin.get_Name(), width: size[0], // inner width height: size[1], // inner height - url: _baseUrl + variation.get_Url(), + url: url, buttons: newBtns, toolcallback: _.bind(this.onToolClose, this) }); diff --git a/apps/common/main/lib/model/Plugin.js b/apps/common/main/lib/model/Plugin.js index 8c0ace1d0..82c22f5ed 100644 --- a/apps/common/main/lib/model/Plugin.js +++ b/apps/common/main/lib/model/Plugin.js @@ -65,7 +65,8 @@ define([ isUpdateOleOnResize: false, buttons: [], size: [800, 600], - initOnSelectionChanged: false + initOnSelectionChanged: false, + isRelativeUrl: true } } }); diff --git a/apps/common/main/lib/view/Plugins.js b/apps/common/main/lib/view/Plugins.js index 9a360a09c..8a21c18e2 100644 --- a/apps/common/main/lib/view/Plugins.js +++ b/apps/common/main/lib/view/Plugins.js @@ -92,7 +92,7 @@ define([ enableKeyEvents: false, itemTemplate: _.template([ '
', - '
' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);">
', + '
' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);">
', '<% if (variations.length>1) { %>', '
', '<% } %>', diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 7c46f711a..c3e5f62f4 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1806,7 +1806,8 @@ define([ isUpdateOleOnResize : itemVar.isUpdateOleOnResize, buttons: itemVar.buttons, size: itemVar.size, - initOnSelectionChanged: itemVar.initOnSelectionChanged + initOnSelectionChanged: itemVar.initOnSelectionChanged, + isRelativeUrl: !(/(^https?:\/\/)/i.test(itemVar.url) || /(^www.)/i.test(itemVar.url)) })); }); if (variationsArr.length>0) diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 90619832a..a757db4bc 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1580,7 +1580,8 @@ define([ isUpdateOleOnResize : itemVar.isUpdateOleOnResize, buttons: itemVar.buttons, size: itemVar.size, - initOnSelectionChanged: itemVar.initOnSelectionChanged + initOnSelectionChanged: itemVar.initOnSelectionChanged, + isRelativeUrl: !(/(^https?:\/\/)/i.test(itemVar.url) || /(^www.)/i.test(itemVar.url)) })); }); if (variationsArr.length>0) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 440f0c073..c67ed6301 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1809,7 +1809,8 @@ define([ isUpdateOleOnResize : itemVar.isUpdateOleOnResize, buttons: itemVar.buttons, size: itemVar.size, - initOnSelectionChanged: itemVar.initOnSelectionChanged + initOnSelectionChanged: itemVar.initOnSelectionChanged, + isRelativeUrl: !(/(^https?:\/\/)/i.test(itemVar.url) || /(^www.)/i.test(itemVar.url)) })); }); if (variationsArr.length>0)