Commit bc2c1501 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add asc_onServerVersion event

add build number
delete check server version -> check version in the interface
parent 046c74c8
......@@ -43,6 +43,7 @@ AscCommon.baseEditorsApi.prototype._onEndPermissions = function () {
oResult.setTrial(this.licenseResult['trial']);
oResult.setRights(this.licenseResult['rights']);
oResult.setBuildVersion(this.licenseResult['buildVersion']);
oResult.setBuildNumber(this.licenseResult['buildNumber']);
}
this.sendEvent('asc_onGetEditorPermissions', oResult);
}
......
......@@ -546,6 +546,9 @@
{
t.sendEvent('asc_onCoAuthoringChatReceiveMessage', e, clear);
};
this.CoAuthoringApi.onServerVersion = function (buildVersion, buildNumber) {
t.sendEvent('asc_onServerVersion', buildVersion, buildNumber);
};
this.CoAuthoringApi.onAuthParticipantsChanged = function(e, count)
{
t.sendEvent("asc_onAuthParticipantsChanged", e, count);
......
......@@ -140,6 +140,7 @@
this.AutosaveMinInterval = 300;
this.isAnalyticsEnable = false;
this.buildVersion = null;
this.buildNumber = null;
return this;
}
......@@ -176,6 +177,9 @@
asc_CAscEditorPermissions.prototype.asc_getBuildVersion = function () {
return this.buildVersion;
};
asc_CAscEditorPermissions.prototype.asc_getBuildNumber = function () {
return this.buildNumber;
};
asc_CAscEditorPermissions.prototype.setLicenseType = function (v) {
this.licenseType = v;
......@@ -195,6 +199,9 @@
asc_CAscEditorPermissions.prototype.setBuildVersion = function (v) {
this.buildVersion = v;
};
asc_CAscEditorPermissions.prototype.setBuildNumber = function (v) {
this.buildNumber = v;
};
/** @constructor */
function asc_ValAxisSettings() {
......@@ -2864,6 +2871,7 @@
prot["asc_getTrial"] = prot.asc_getTrial;
prot["asc_getRights"] = prot.asc_getRights;
prot["asc_getBuildVersion"] = prot.asc_getBuildVersion;
prot["asc_getBuildNumber"] = prot.asc_getBuildNumber;
window["AscCommon"].asc_ValAxisSettings = asc_ValAxisSettings;
prot = asc_ValAxisSettings.prototype;
......
......@@ -35,7 +35,6 @@
(function(window, undefined) {
'use strict';
var asc_coAuthV = '4.3.0';
var ConnectionState = AscCommon.ConnectionState;
var c_oEditorId = AscCommon.c_oEditorId;
var c_oCloseCode = AscCommon.c_oCloseCode;
......@@ -51,6 +50,7 @@
this.onAuthParticipantsChanged = options.onAuthParticipantsChanged;
this.onParticipantsChanged = options.onParticipantsChanged;
this.onMessage = options.onMessage;
this.onServerVersion = options.onServerVersion;
this.onCursor = options.onCursor;
this.onMeta = options.onMeta;
this.onSession = options.onSession;
......@@ -87,6 +87,9 @@
this._CoAuthoringApi.onMessage = function(e, clear) {
t.callback_OnMessage(e, clear);
};
this._CoAuthoringApi.onServerVersion = function(e) {
t.callback_OnServerVersion(e);
};
this._CoAuthoringApi.onCursor = function(e) {
t.callback_OnCursor(e);
};
......@@ -379,6 +382,12 @@
}
};
CDocsCoApi.prototype.callback_OnServerVersion = function(e) {
if (this.onServerVersion) {
this.onServerVersion(e);
}
};
CDocsCoApi.prototype.callback_OnCursor = function(e) {
if (this.onCursor) {
this.onCursor(e);
......@@ -515,6 +524,7 @@
this.onAuthParticipantsChanged = options.onAuthParticipantsChanged;
this.onParticipantsChanged = options.onParticipantsChanged;
this.onMessage = options.onMessage;
this.onServerVersion = options.onServerVersion;
this.onCursor = options.onCursor;
this.onMeta = options.onMeta;
this.onSession = options.onSession;
......@@ -921,6 +931,12 @@
}
};
DocsCoApi.prototype._onServerVersion = function (data) {
if (this.onServerVersion) {
this.onServerVersion(data['buildVersion'], data['buildNumber']);
}
};
DocsCoApi.prototype._onCursor = function(data) {
if (this.check_state() && data["messages"] && this.onCursor) {
this.onCursor(data["messages"]);
......@@ -1315,8 +1331,11 @@
if (true === this._isAuth) {
this._state = ConnectionState.Authorized;
// Мы должны только соединиться для получения файла. Совместное редактирование уже было отключено.
if (this.isCloseCoAuthoring)
if (this.isCloseCoAuthoring) {
return;
}
this._onServerVersion(data);
// Мы уже авторизовывались, нужно обновить пользователей (т.к. пользователи могли входить и выходить пока у нас не было соединения)
this._onAuthParticipantsChanged(data['participants']);
......@@ -1451,8 +1470,7 @@
'mode': this.mode,
'permissions': this.permissions,
'jwtOpen': this.jwtOpen,
'jwtSession': this.jwtSession,
'version': asc_coAuthV
'jwtSession': this.jwtSession
});
};
......
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