[DE] Check server version

This commit is contained in:
Julia Radzhabova 2017-04-11 14:37:45 +03:00
parent c35d3c544a
commit 73525ef2b2
3 changed files with 28 additions and 1 deletions

View file

@ -135,6 +135,7 @@ define([
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this)); 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_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(this.onUpdateVersion, 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_onAdvancedOptions', _.bind(this.onAdvancedOptions, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, 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_onPrintUrl', _.bind(this.onPrintUrl, this));
@ -984,6 +985,8 @@ define([
return; return;
} }
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review; this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review;
if (params.asc_getRights() !== Asc.c_oRights.Edit) 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 **/ /** coauthoring begin **/
// fillUserStore: function(users){ // fillUserStore: function(users){
// if (!_.isEmpty(users)){ // if (!_.isEmpty(users)){
@ -2087,7 +2109,9 @@ define([
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.', 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.', 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.', 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 || {})) })(), DE.Controllers.Main || {}))
}); });

View file

@ -189,6 +189,7 @@ require([
,'common/main/lib/controller/ExternalMergeEditor' ,'common/main/lib/controller/ExternalMergeEditor'
,'common/main/lib/controller/ReviewChanges' ,'common/main/lib/controller/ReviewChanges'
], function() { ], function() {
window.compareVersions = true;
app.start(); app.start();
}); });
}, function(err) { }, function(err) {

View file

@ -315,6 +315,8 @@
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "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.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.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.textHasChanges": "New changes have been tracked",
"DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled", "DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled",
"DE.Controllers.Statusbar.zoomText": "Zoom {0}%", "DE.Controllers.Statusbar.zoomText": "Zoom {0}%",