Commit 21407bba authored by Julia Radzhabova's avatar Julia Radzhabova

Check server version.

parent faa1d536
......@@ -135,6 +135,7 @@ define([
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(this.onUpdateVersion, this));
this.api.asc_registerCallback('asc_onServerVersion', _.bind(this.onServerVersion, this));
this.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(this.onAdvancedOptions, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
......@@ -975,6 +976,8 @@ define([
return;
}
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review;
if (params.asc_getRights() !== Asc.c_oRights.Edit)
......@@ -1515,6 +1518,25 @@ define([
});
},
onServerVersion: function(buildVersion) {
if (this.changeServerVersion) return true;
if (DocsAPI.DocEditor.version() !== buildVersion && !window.compareVersions) {
this.changeServerVersion = true;
Common.UI.warning({
title: this.titleServerVersion,
msg: this.errorServerVersion,
callback: function() {
_.defer(function() {
Common.Gateway.updateVersion();
})
}
});
return true;
}
return false;
},
/** coauthoring begin **/
// fillUserStore: function(users){
// if (!_.isEmpty(users)){
......@@ -2061,7 +2083,9 @@ define([
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.',
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
......@@ -189,6 +189,7 @@ require([
,'common/main/lib/controller/ExternalMergeEditor'
,'common/main/lib/controller/ReviewChanges'
], function() {
window.compareVersions = true;
app.start();
});
}, function(err) {
......
......@@ -298,6 +298,8 @@
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"DE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Main.titleServerVersion": "Editor updated",
"DE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked",
"DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled",
"DE.Controllers.Statusbar.zoomText": "Zoom {0}%",
......
......@@ -220,6 +220,7 @@ require([
'documenteditor/mobile/app/controller/add/AddImage',
'documenteditor/mobile/app/controller/add/AddOther'
], function() {
window.compareVersions = true;
app.start();
});
}, function(err) {
......
......@@ -131,6 +131,7 @@ define([
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onDocumentContentReady, me));
me.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(me.onOpenDocument, me));
me.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(me.onUpdateVersion, me));
me.api.asc_registerCallback('asc_onServerVersion', _.bind(me.onServerVersion, me));
me.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(me.onAdvancedOptions, me));
me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onDocumentName, me));
me.api.asc_registerCallback('asc_onPrintUrl', _.bind(me.onPrintUrl, me));
......@@ -589,6 +590,8 @@ define([
return;
}
if ( me.onServerVersion(params.asc_getBuildVersion()) ) return;
me.permissions.review = (me.permissions.review === undefined) ? (me.permissions.edit !== false) : me.permissions.review;
me.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
me.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success);
......@@ -959,6 +962,25 @@ define([
});
},
onServerVersion: function(buildVersion) {
var me = this;
if (me.changeServerVersion) return true;
if (DocsAPI.DocEditor.version() !== buildVersion && !window.compareVersions) {
me.changeServerVersion = true;
uiApp.alert(
me.errorServerVersion,
me.titleServerVersion,
function () {
_.defer(function() {
Common.Gateway.updateVersion();
})
});
return true;
}
return false;
},
onCollaborativeChanges: function() {
//
},
......@@ -1207,7 +1229,9 @@ define([
textPassword: 'Password',
textBack: 'Back',
textClose: 'Close',
textDone: 'Done'
textDone: 'Done',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
......@@ -127,6 +127,8 @@
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"DE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Main.titleServerVersion": "Editor updated",
"DE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"DE.Controllers.Search.textNoTextFound": "Text not Found",
"DE.Controllers.Search.textReplaceAll": "Replace All",
"DE.Controllers.Settings.notcriticalErrorTitle": "Warning",
......
......@@ -130,6 +130,7 @@ define([
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
this.api.asc_registerCallback('asc_onThumbnailsShow', _.bind(this.onThumbnailsShow, this));
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(this.onUpdateVersion, this));
this.api.asc_registerCallback('asc_onServerVersion', _.bind(this.onServerVersion, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
......@@ -755,6 +756,8 @@ define([
return;
}
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
if (params.asc_getRights() !== Asc.c_oRights.Edit)
this.permissions.edit = false;
......@@ -1265,6 +1268,25 @@ define([
});
},
onServerVersion: function(buildVersion) {
if (this.changeServerVersion) return true;
if (DocsAPI.DocEditor.version() !== buildVersion && !window.compareVersions) {
this.changeServerVersion = true;
Common.UI.warning({
title: this.titleServerVersion,
msg: this.errorServerVersion,
callback: function() {
_.defer(function() {
Common.Gateway.updateVersion();
})
}
});
return true;
}
return false;
},
/** coauthoring begin **/
fillUserStore: function(users){
if (!_.isEmpty(users)){
......@@ -1852,7 +1874,9 @@ define([
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.',
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.'
}
})(), PE.Controllers.Main || {}))
});
......@@ -181,6 +181,7 @@ require([
'presentationeditor/main/app/view/ChartSettings',
'common/main/lib/controller/ExternalDiagramEditor'
], function() {
window.compareVersions = true;
app.start();
});
}, function(err) {
......
......@@ -245,6 +245,8 @@
"PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"PE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Main.titleServerVersion": "Editor updated",
"PE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"PE.Controllers.Statusbar.zoomText": "Zoom {0}%",
"PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",
"PE.Controllers.Toolbar.textAccent": "Accents",
......
......@@ -223,6 +223,7 @@ require([
'presentationeditor/mobile/app/controller/add/AddSlide'
], function() {
window.compareVersions = true;
app.start();
});
}, function(err) {
......
......@@ -123,6 +123,7 @@ define([
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onDocumentContentReady, me));
me.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(me.onOpenDocument, me));
me.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(me.onUpdateVersion, me));
me.api.asc_registerCallback('asc_onServerVersion', _.bind(me.onServerVersion, me));
me.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(me.onAdvancedOptions, me));
me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onDocumentName, me));
me.api.asc_registerCallback('asc_onPrintUrl', _.bind(me.onPrintUrl, me));
......@@ -544,6 +545,8 @@ define([
return;
}
if ( me.onServerVersion(params.asc_getBuildVersion()) ) return;
me.permissions.review = (me.permissions.review === undefined) ? (me.permissions.edit !== false) : me.permissions.review;
me.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
me.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success);
......@@ -919,6 +922,25 @@ define([
});
},
onServerVersion: function(buildVersion) {
var me = this;
if (me.changeServerVersion) return true;
if (DocsAPI.DocEditor.version() !== buildVersion && !window.compareVersions) {
me.changeServerVersion = true;
uiApp.alert(
me.errorServerVersion,
me.titleServerVersion,
function () {
_.defer(function() {
Common.Gateway.updateVersion();
})
});
return true;
}
return false;
},
onCollaborativeChanges: function() {
//
},
......@@ -1209,7 +1231,9 @@ define([
textPassword: 'Password',
textBack: 'Back',
textClose: 'Close',
textDone: 'Done'
textDone: 'Done',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.'
}
})(), PE.Controllers.Main || {}))
});
\ No newline at end of file
......@@ -140,6 +140,8 @@
"PE.Controllers.Main.textBack": "Back",
"PE.Controllers.Main.textClose": "Close",
"PE.Controllers.Main.textDone": "Done",
"PE.Controllers.Main.titleServerVersion": "Editor updated",
"PE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"PE.Controllers.DocumentHolder.menuCut": "Cut",
"PE.Controllers.DocumentHolder.menuCopy": "Copy",
......
......@@ -129,6 +129,7 @@ define([
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(this.onAdvancedOptions, this));
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(this.onUpdateVersion, this));
this.api.asc_registerCallback('asc_onServerVersion', _.bind(this.onServerVersion, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
......@@ -776,6 +777,8 @@ define([
return;
}
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
if (params.asc_getRights() !== Asc.c_oRights.Edit)
this.permissions.edit = false;
......@@ -1404,6 +1407,25 @@ define([
});
},
onServerVersion: function(buildVersion) {
if (this.changeServerVersion) return true;
if (DocsAPI.DocEditor.version() !== buildVersion && !window.compareVersions) {
this.changeServerVersion = true;
Common.UI.warning({
title: this.titleServerVersion,
msg: this.errorServerVersion,
callback: function() {
_.defer(function() {
Common.Gateway.updateVersion();
})
}
});
return true;
}
return false;
},
onAdvancedOptions: function(advOptions) {
var type = advOptions.asc_getOptionId(),
me = this, dlg;
......@@ -2067,7 +2089,9 @@ define([
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.',
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.'
}
})(), SSE.Controllers.Main || {}))
});
......@@ -177,6 +177,7 @@ require([
'common/main/lib/controller/Chat',
'common/main/lib/controller/Plugins'
], function() {
window.compareVersions = true;
app.start();
});
}, function(err) {
......
......@@ -338,6 +338,8 @@
"SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"SSE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.titleServerVersion": "Editor updated",
"SSE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textWarning": "Warning",
"SSE.Controllers.Print.warnCheckMargings": "Margins are incorrect",
......
......@@ -206,6 +206,7 @@ require([
,'spreadsheeteditor/mobile/app/controller/add/AddOther'
,'spreadsheeteditor/mobile/app/controller/add/AddLink'
], function() {
window.compareVersions = true;
app.start();
});
}, function(err) {
......
......@@ -125,6 +125,7 @@ define([
me.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(me.onOpenDocument, me));
me.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(me.onAdvancedOptions, me));
me.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(me.onUpdateVersion, me));
me.api.asc_registerCallback('asc_onServerVersion', _.bind(me.onServerVersion, me));
me.api.asc_registerCallback('asc_onPrintUrl', _.bind(me.onPrintUrl, me));
me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onDocumentName, me));
me.api.asc_registerCallback('asc_onEndAction', _.bind(me.onLongActionEnd, me));
......@@ -631,6 +632,8 @@ define([
return;
}
if ( me.onServerVersion(params.asc_getBuildVersion()) ) return;
if (params.asc_getRights() !== Asc.c_oRights.Edit) {
me.permissions.edit = false;
}
......@@ -1115,6 +1118,25 @@ define([
});
},
onServerVersion: function(buildVersion) {
var me = this;
if (me.changeServerVersion) return true;
if (DocsAPI.DocEditor.version() !== buildVersion && !window.compareVersions) {
me.changeServerVersion = true;
uiApp.alert(
me.errorServerVersion,
me.titleServerVersion,
function () {
_.defer(function() {
Common.Gateway.updateVersion();
})
});
return true;
}
return false;
},
onCollaborativeChanges: function() {
//
},
......@@ -1421,7 +1443,9 @@ define([
textPassword: 'Password',
textBack: 'Back',
textClose: 'Close',
textDone: 'Done'
textDone: 'Done',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.'
}
})(), SSE.Controllers.Main || {}))
});
\ No newline at end of file
......@@ -195,6 +195,8 @@
"SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"SSE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.titleServerVersion": "Editor updated",
"SSE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"SSE.Controllers.Search.textNoTextFound": "Text not found",
"SSE.Controllers.Search.textReplaceAll": "Replace All",
"SSE.Controllers.Settings.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