Commit 4549b770 authored by Julia Radzhabova's avatar Julia Radzhabova Committed by GitHub

Merge pull request #27 from ONLYOFFICE/hotfix/v4.1.1

Hotfix/v4.1.1
parents f4c85bf9 a92ae8bf
[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.1.0-blue.svg?style=flat) [![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.1.1-blue.svg?style=flat)
## web-apps ## web-apps
......
...@@ -219,8 +219,12 @@ define([ ...@@ -219,8 +219,12 @@ define([
onPluginShow: function(plugin, variationIndex) { onPluginShow: function(plugin, variationIndex) {
var variation = plugin.get_Variations()[variationIndex]; var variation = plugin.get_Variations()[variationIndex];
if (variation.get_Visual()) { 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()) { 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 { } else {
var me = this, var me = this,
arrBtns = variation.get_Buttons(), arrBtns = variation.get_Buttons(),
...@@ -234,12 +238,11 @@ define([ ...@@ -234,12 +238,11 @@ define([
}); });
} }
var _baseUrl = (plugin.get_BaseUrl().length == 0) ? me.panelPlugins.pluginsPath : plugin.get_BaseUrl();
me.pluginDlg = new Common.Views.PluginDlg({ me.pluginDlg = new Common.Views.PluginDlg({
title: plugin.get_Name(), title: plugin.get_Name(),
width: size[0], // inner width width: size[0], // inner width
height: size[1], // inner height height: size[1], // inner height
url: _baseUrl + variation.get_Url(), url: url,
buttons: newBtns, buttons: newBtns,
toolcallback: _.bind(this.onToolClose, this) toolcallback: _.bind(this.onToolClose, this)
}); });
......
...@@ -65,7 +65,8 @@ define([ ...@@ -65,7 +65,8 @@ define([
isUpdateOleOnResize: false, isUpdateOleOnResize: false,
buttons: [], buttons: [],
size: [800, 600], size: [800, 600],
initOnSelectionChanged: false initOnSelectionChanged: false,
isRelativeUrl: true
} }
} }
}); });
......
...@@ -92,7 +92,7 @@ define([ ...@@ -92,7 +92,7 @@ define([
enableKeyEvents: false, enableKeyEvents: false,
itemTemplate: _.template([ itemTemplate: _.template([
'<div id="<%= id %>" class="item-plugins" style="display: block;">', '<div id="<%= id %>" class="item-plugins" style="display: block;">',
'<div class="plugin-icon" style="background-image: url(' + '<% if (baseUrl !=="") { %>' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);"></div>', '<div class="plugin-icon" style="background-image: url(' + '<% if (variations[currentVariation].get("isRelativeUrl")) { if (baseUrl !=="") { %>' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);"></div>',
'<% if (variations.length>1) { %>', '<% if (variations.length>1) { %>',
'<div class="plugin-caret img-commonctrl"></div>', '<div class="plugin-caret img-commonctrl"></div>',
'<% } %>', '<% } %>',
...@@ -237,7 +237,7 @@ define([ ...@@ -237,7 +237,7 @@ define([
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
iframe.id = 'plugin_iframe'; iframe.id = 'plugin_iframe';
iframe.name = 'pluginFrameEditor', iframe.name = 'pluginFrameEditor';
iframe.width = '100%'; iframe.width = '100%';
iframe.height = '100%'; iframe.height = '100%';
iframe.align = "top"; iframe.align = "top";
...@@ -249,7 +249,7 @@ define([ ...@@ -249,7 +249,7 @@ define([
setTimeout(function(){ setTimeout(function(){
if (me.isLoaded) return; if (me.isLoaded) return;
me.loadMask = new Common.UI.LoadMask({owner: $('#id-plugin-placeholder')}); me.loadMask = new Common.UI.LoadMask({owner: $('#id-plugin-placeholder')});
me.loadMask.setTitle(this.textLoading); me.loadMask.setTitle(me.textLoading);
me.loadMask.show(); me.loadMask.show();
if (me.isLoaded) me.loadMask.hide(); if (me.isLoaded) me.loadMask.hide();
}, 500); }, 500);
......
...@@ -826,7 +826,7 @@ define([ ...@@ -826,7 +826,7 @@ define([
application.getController('Common.Controllers.ExternalMergeEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization}); application.getController('Common.Controllers.ExternalMergeEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
pluginsController.setApi(me.api); pluginsController.setApi(me.api);
me.updatePluginsList(me.plugins); me.updatePlugins(me.plugins);
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me)); me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
documentHolderController.setApi(me.api); documentHolderController.setApi(me.api);
...@@ -1721,6 +1721,60 @@ define([ ...@@ -1721,6 +1721,60 @@ define([
if (url) this.iframePrint.src = url; if (url) this.iframePrint.src = url;
}, },
updatePlugins: function(plugins) { // plugins from config
if (!plugins || !plugins.pluginsData || plugins.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 = plugins.url;
plugins.pluginsData.forEach(function(item){
var url = item;
if (!/(^https?:\/\/)/i.test(url) && !/(^www.)/i.test(item))
url = baseUrl + item;
var value = _getPluginJson(url);
if (value) arr.push(value);
});
if (arr.length>0)
this.updatePluginsList({
url: plugins.url,
pluginsData: arr
});
},
updatePluginsList: function(plugins) { updatePluginsList: function(plugins) {
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'), var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = this.appOptions.isEdit; isEdit = this.appOptions.isEdit;
...@@ -1752,7 +1806,8 @@ define([ ...@@ -1752,7 +1806,8 @@ define([
isUpdateOleOnResize : itemVar.isUpdateOleOnResize, isUpdateOleOnResize : itemVar.isUpdateOleOnResize,
buttons: itemVar.buttons, buttons: itemVar.buttons,
size: itemVar.size, size: itemVar.size,
initOnSelectionChanged: itemVar.initOnSelectionChanged initOnSelectionChanged: itemVar.initOnSelectionChanged,
isRelativeUrl: !(/(^https?:\/\/)/i.test(itemVar.url) || /(^www.)/i.test(itemVar.url))
})); }));
}); });
if (variationsArr.length>0) if (variationsArr.length>0)
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
"Common.Views.Plugins.strPlugins": "Plugins", "Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading", "Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start", "Common.Views.Plugins.textStart": "Start",
"Common.Views.PluginDlg.textLoading": "Loading",
"Common.Views.ReviewChanges.txtAccept": "Accept", "Common.Views.ReviewChanges.txtAccept": "Accept",
"Common.Views.ReviewChanges.txtAcceptAll": "Accept All Changes", "Common.Views.ReviewChanges.txtAcceptAll": "Accept All Changes",
"Common.Views.ReviewChanges.txtAcceptCurrent": "Accept Current Change", "Common.Views.ReviewChanges.txtAcceptCurrent": "Accept Current Change",
......
...@@ -617,7 +617,7 @@ define([ ...@@ -617,7 +617,7 @@ define([
application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization}); application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
pluginsController.setApi(me.api); pluginsController.setApi(me.api);
me.updatePluginsList(me.plugins); me.updatePlugins(me.plugins);
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me)); me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
documentHolderController.setApi(me.api); documentHolderController.setApi(me.api);
...@@ -1495,6 +1495,60 @@ define([ ...@@ -1495,6 +1495,60 @@ define([
if (url) this.iframePrint.src = url; if (url) this.iframePrint.src = url;
}, },
updatePlugins: function(plugins) { // plugins from config
if (!plugins || !plugins.pluginsData || plugins.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 = plugins.url;
plugins.pluginsData.forEach(function(item){
var url = item;
if (!/(^https?:\/\/)/i.test(url) && !/(^www.)/i.test(item))
url = baseUrl + item;
var value = _getPluginJson(url);
if (value) arr.push(value);
});
if (arr.length>0)
this.updatePluginsList({
url: plugins.url,
pluginsData: arr
});
},
updatePluginsList: function(plugins) { updatePluginsList: function(plugins) {
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'), var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = this.appOptions.isEdit; isEdit = this.appOptions.isEdit;
...@@ -1526,7 +1580,8 @@ define([ ...@@ -1526,7 +1580,8 @@ define([
isUpdateOleOnResize : itemVar.isUpdateOleOnResize, isUpdateOleOnResize : itemVar.isUpdateOleOnResize,
buttons: itemVar.buttons, buttons: itemVar.buttons,
size: itemVar.size, size: itemVar.size,
initOnSelectionChanged: itemVar.initOnSelectionChanged initOnSelectionChanged: itemVar.initOnSelectionChanged,
isRelativeUrl: !(/(^https?:\/\/)/i.test(itemVar.url) || /(^www.)/i.test(itemVar.url))
})); }));
}); });
if (variationsArr.length>0) if (variationsArr.length>0)
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
"Common.Views.Plugins.strPlugins": "Plugins", "Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading", "Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start", "Common.Views.Plugins.textStart": "Start",
"Common.Views.PluginDlg.textLoading": "Loading",
"PE.Controllers.LeftMenu.newDocumentTitle": "Unnamed presentation", "PE.Controllers.LeftMenu.newDocumentTitle": "Unnamed presentation",
"PE.Controllers.LeftMenu.requestEditRightsText": "Requesting editing rights...", "PE.Controllers.LeftMenu.requestEditRightsText": "Requesting editing rights...",
"PE.Controllers.LeftMenu.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.", "PE.Controllers.LeftMenu.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
......
...@@ -599,7 +599,7 @@ define([ ...@@ -599,7 +599,7 @@ define([
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) { if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
pluginsController.setApi(me.api); pluginsController.setApi(me.api);
me.updatePluginsList(me.plugins); me.updatePlugins(me.plugins);
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me)); me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
} }
...@@ -1724,6 +1724,60 @@ define([ ...@@ -1724,6 +1724,60 @@ define([
if (url) this.iframePrint.src = url; if (url) this.iframePrint.src = url;
}, },
updatePlugins: function(plugins) { // plugins from config
if (!plugins || !plugins.pluginsData || plugins.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 = plugins.url;
plugins.pluginsData.forEach(function(item){
var url = item;
if (!/(^https?:\/\/)/i.test(url) && !/(^www.)/i.test(item))
url = baseUrl + item;
var value = _getPluginJson(url);
if (value) arr.push(value);
});
if (arr.length>0)
this.updatePluginsList({
url: plugins.url,
pluginsData: arr
});
},
updatePluginsList: function(plugins) { updatePluginsList: function(plugins) {
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'), var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = this.appOptions.isEdit; isEdit = this.appOptions.isEdit;
...@@ -1755,7 +1809,8 @@ define([ ...@@ -1755,7 +1809,8 @@ define([
isUpdateOleOnResize : itemVar.isUpdateOleOnResize, isUpdateOleOnResize : itemVar.isUpdateOleOnResize,
buttons: itemVar.buttons, buttons: itemVar.buttons,
size: itemVar.size, size: itemVar.size,
initOnSelectionChanged: itemVar.initOnSelectionChanged initOnSelectionChanged: itemVar.initOnSelectionChanged,
isRelativeUrl: !(/(^https?:\/\/)/i.test(itemVar.url) || /(^www.)/i.test(itemVar.url))
})); }));
}); });
if (variationsArr.length>0) if (variationsArr.length>0)
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
"Common.Views.Plugins.strPlugins": "Plugins", "Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading", "Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start", "Common.Views.Plugins.textStart": "Start",
"Common.Views.PluginDlg.textLoading": "Loading",
"SSE.Controllers.DocumentHolder.errorInvalidLink": "The link reference does not exist. Please correct the link or delete it.", "SSE.Controllers.DocumentHolder.errorInvalidLink": "The link reference does not exist. Please correct the link or delete it.",
"SSE.Controllers.DocumentHolder.guestText": "Guest", "SSE.Controllers.DocumentHolder.guestText": "Guest",
"SSE.Controllers.DocumentHolder.notcriticalErrorTitle": "Warning", "SSE.Controllers.DocumentHolder.notcriticalErrorTitle": "Warning",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment