diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 017417c59..59b0fdd72 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -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));
@@ -984,6 +985,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)
@@ -1538,6 +1541,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)){
@@ -2087,7 +2109,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.
Please contact your Document Server administrator.'
+ errorAccessDeny: 'You are trying to perform an action you do not have rights for.
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
diff --git a/apps/documenteditor/main/app_dev.js b/apps/documenteditor/main/app_dev.js
index e37fe92a4..d15f17707 100644
--- a/apps/documenteditor/main/app_dev.js
+++ b/apps/documenteditor/main/app_dev.js
@@ -189,6 +189,7 @@ require([
,'common/main/lib/controller/ExternalMergeEditor'
,'common/main/lib/controller/ReviewChanges'
], function() {
+ window.compareVersions = true;
app.start();
});
}, function(err) {
diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json
index c424049fc..5b83871eb 100644
--- a/apps/documenteditor/main/locale/en.json
+++ b/apps/documenteditor/main/locale/en.json
@@ -315,6 +315,8 @@
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.
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).
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}%",