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