Commit 37b61bf5 authored by Alexey Golubev's avatar Alexey Golubev

Merge

parents e7385210 f959680f
......@@ -286,7 +286,7 @@
_onAppReady();
}
if (handler) {
if (handler && typeof handler == "function") {
res = handler.call(_self, {target: _self, data: msg.data});
}
}
......
......@@ -58,6 +58,7 @@ define([
this.currentDocId = '';
this.currentDocIdPrev = '';
this.currentRev = 0;
this.currentServerVersion = 0;
},
events: {
......@@ -130,6 +131,7 @@ define([
this.currentDocId = record.get('docId');
this.currentDocIdPrev = record.get('docIdPrev');
this.currentRev = rev;
this.currentServerVersion = record.get('serverVersion');
if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) {
_.delay(function() {
......@@ -146,6 +148,7 @@ define([
hist.asc_setArrColors(this.currentArrColors);
hist.asc_setToken(token);
hist.asc_setIsRequested(false);
hist.asc_setServerVersion(this.currentServerVersion);
this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
......@@ -196,6 +199,7 @@ define([
hist.asc_setArrColors(this.currentArrColors);
hist.asc_setToken(token);
hist.asc_setIsRequested(true);
hist.asc_setServerVersion(this.currentServerVersion);
this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
......
......@@ -73,7 +73,8 @@ define([
isExpanded: true,
isVisible: true,
allowSelected: true,
selected: false
selected: false,
serverVersion: 0
}
}
});
......
......@@ -683,6 +683,40 @@ Common.Utils.fillUserInfo = function(info, lang, defname) {
return _user;
};
Common.Utils.createXhr = 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;
};
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;
};
// Extend javascript String type
String.prototype.strongMatch = function(regExp){
if (regExp && regExp instanceof RegExp) {
......
......@@ -183,7 +183,7 @@ define([
},
closeNotVisualMode: function() {
this.viewPluginsList.cmpEl.find('.selected').removeClass('selected');
this.viewPluginsList && this.viewPluginsList.cmpEl.find('.selected').removeClass('selected');
},
_onLoad: function() {
......
......@@ -300,9 +300,11 @@
"DE.Controllers.Main.txtStyle_Heading_7": "Cabeçalho 7",
"DE.Controllers.Main.txtStyle_Heading_8": "Cabeçalho 8",
"DE.Controllers.Main.txtStyle_Heading_9": "Cabeçalho 9",
"DE.Controllers.Main.txtStyle_Intense_Quote": "Citação intensa",
"DE.Controllers.Main.txtStyle_List_Paragraph": "Listar parágrafo",
"DE.Controllers.Main.txtStyle_No_Spacing": "Sem espaçamento",
"DE.Controllers.Main.txtStyle_Normal": "Normal",
"DE.Controllers.Main.txtStyle_Quote": "Citar",
"DE.Controllers.Main.txtStyle_Subtitle": "Legenda",
"DE.Controllers.Main.txtStyle_Title": "Titulo",
"DE.Controllers.Main.txtXAxis": "Eixo X",
......@@ -1389,6 +1391,7 @@
"DE.Views.TableSettingsAdvanced.textAllowSpacing": "Permitir espaçamento entre células",
"DE.Views.TableSettingsAdvanced.textAlt": "Texto alternativo",
"DE.Views.TableSettingsAdvanced.textAltDescription": "Descrição",
"DE.Views.TableSettingsAdvanced.textAltTip": "A representação alternativa baseada em texto da informação visual do objeto, que será lida para as pessoas com deficiências visuais ou cognitivas para ajudá-los a entender melhor que informação existe na imagem, auto-forma, gráfico ou tabela.",
"DE.Views.TableSettingsAdvanced.textAltTitle": "Título",
"DE.Views.TableSettingsAdvanced.textAnchorText": "Тexto",
"DE.Views.TableSettingsAdvanced.textAutofit": "Automaticamente redimensionado para ajustar conteúdo",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -635,8 +635,10 @@ define([
application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
pluginsController.setApi(me.api);
me.updatePlugins(me.plugins, false);
me.requestPlugins('../../../../plugins.json');
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
me.updatePlugins(me.plugins, false);
else
me.requestPlugins('../../../../plugins.json');
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
documentHolderController.setApi(me.api);
......@@ -1653,95 +1655,24 @@ 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
if (!plugins) return;
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 !== "");
......@@ -1749,11 +1680,17 @@ define([
}
});
if (arr.length>0)
if (arr.length>0) {
var autostart = plugins.autostart || plugins.autoStartGuid;
if (typeof (autostart) == 'string')
autostart = [autostart];
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
this.updatePluginsList({
autoStartGuid: plugins.autoStartGuid,
autostart: autostart,
pluginsData: arr
}, !!uiCustomize);
}
},
updatePluginsList: function(plugins, uiCustomize) {
......@@ -1762,18 +1699,9 @@ 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; i<itemVar.EditorsSupport.length; i++){
if (itemVar.EditorsSupport[i]=='slide') {
isSupported = true; break;
}
}
if (isSupported && (isEdit || itemVar.isViewer)){
var variationsArr = [];
item.variations.forEach(function(itemVar){
if (_.contains(itemVar.EditorsSupport, 'word') && (isEdit || itemVar.isViewer)) {
var icons = itemVar.icons;
if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
icons = [];
......@@ -1815,20 +1743,17 @@ define([
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.isEmpty();
}
} else if (!uiCustomize){
this.appOptions.canPlugins = false;
}
if (this.appOptions.canPlugins) {
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
if (plugins.autoStartGuid)
this.api.asc_pluginRun(plugins.autoStartGuid, 0, '');
if (plugins.autostart && plugins.autostart.length>0)
this.api.asc_pluginRun(plugins.autostart[0], 0, '');
}
if (!uiCustomize) this.getApplication().getController('LeftMenu').enablePlugins();
},
......
This diff is collapsed.
This diff is collapsed.
......@@ -617,8 +617,10 @@ define([
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
pluginsController.setApi(me.api);
me.updatePlugins(me.plugins, false);
me.requestPlugins('../../../../plugins.json');
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
me.updatePlugins(me.plugins, false);
else
me.requestPlugins('../../../../plugins.json');
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
}
......@@ -1843,43 +1845,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
......@@ -1888,49 +1854,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 !== "");
......@@ -1938,11 +1870,17 @@ define([
}
});
if (arr.length>0)
if (arr.length>0) {
var autostart = plugins.autostart || plugins.autoStartGuid;
if (typeof (autostart) == 'string')
autostart = [autostart];
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
this.updatePluginsList({
autoStartGuid: plugins.autoStartGuid,
autostart: autostart,
pluginsData: arr
}, !!uiCustomize);
}
},
updatePluginsList: function(plugins, uiCustomize) {
......@@ -1951,18 +1889,9 @@ 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; i<itemVar.EditorsSupport.length; i++){
if (itemVar.EditorsSupport[i]=='cell') {
isSupported = true; break;
}
}
if (isSupported && (isEdit || itemVar.isViewer)) {
var variationsArr = [];
item.variations.forEach(function(itemVar){
if (_.contains(itemVar.EditorsSupport, 'word') && (isEdit || itemVar.isViewer)) {
var icons = itemVar.icons;
if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
icons = [];
......@@ -2004,20 +1933,17 @@ define([
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.isEmpty();
}
} else if (!uiCustomize){
this.appOptions.canPlugins = false;
}
if (this.appOptions.canPlugins) {
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
if (plugins.autoStartGuid)
this.api.asc_pluginRun(plugins.autoStartGuid, 0, '');
if (plugins.autostart && plugins.autostart.length>0)
this.api.asc_pluginRun(plugins.autostart[0], 0, '');
}
if (!uiCustomize) this.getApplication().getController('LeftMenu').enablePlugins();
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
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