Commit 2cdd3350 authored by konovalovsergey's avatar konovalovsergey

force save initiator notification

parent 94925eaa
...@@ -578,9 +578,9 @@ ...@@ -578,9 +578,9 @@
t.isOnLoadLicense = true; t.isOnLoadLicense = true;
t._onEndPermissions(); t._onEndPermissions();
}; };
this.CoAuthoringApi.onWarning = function(e) this.CoAuthoringApi.onWarning = function(code)
{ {
t.sendEvent('asc_onError', c_oAscError.ID.Warning, c_oAscError.Level.NoCritical); t.sendEvent('asc_onError', code || c_oAscError.ID.Warning, c_oAscError.Level.NoCritical);
}; };
this.CoAuthoringApi.onMeta = function(data) this.CoAuthoringApi.onMeta = function(data)
{ {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
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;
var c_oAscServerCommandErrors = AscCommon.c_oAscServerCommandErrors;
// Класс надстройка, для online и offline работы // Класс надстройка, для online и offline работы
function CDocsCoApi(options) { function CDocsCoApi(options) {
...@@ -539,6 +540,7 @@ ...@@ -539,6 +540,7 @@
this.jwtTimeOutId = null; this.jwtTimeOutId = null;
this._id = null; this._id = null;
this._sessionTimeConnect = null; this._sessionTimeConnect = null;
this._lastForceSaveId = null;
this._indexUser = -1; this._indexUser = -1;
// Если пользователей больше 1, то совместно редактируем // Если пользователей больше 1, то совместно редактируем
this.isCoAuthoring = false; this.isCoAuthoring = false;
...@@ -828,7 +830,7 @@ ...@@ -828,7 +830,7 @@
}; };
DocsCoApi.prototype.forceSave = function() { DocsCoApi.prototype.forceSave = function() {
this._send({'type': 'forcesave'}); this._send({'type': 'forcesave', 'saveid': new Date().getTime()});
}; };
DocsCoApi.prototype.openDocument = function(data) { DocsCoApi.prototype.openDocument = function(data) {
...@@ -928,6 +930,14 @@ ...@@ -928,6 +930,14 @@
}, timeout); }, timeout);
} }
}; };
DocsCoApi.prototype._onForceSave = function(data) {
if (data['code'] === c_oAscServerCommandErrors.NoError) {
this._lastForceSaveId = data['saveid'];
} else if (data['code'] !== c_oAscServerCommandErrors.NotModified) {
this.onWarning(c_oAscError.ID.Unknown);
}
};
DocsCoApi.prototype._onGetLock = function(data) { DocsCoApi.prototype._onGetLock = function(data) {
if (data["locks"]) { if (data["locks"]) {
...@@ -1229,7 +1239,7 @@ ...@@ -1229,7 +1239,7 @@
}; };
DocsCoApi.prototype._onWarning = function(data) { DocsCoApi.prototype._onWarning = function(data) {
this.onWarning(data ? data['description'] : ''); this.onWarning(c_oAscError.ID.Warning);
}; };
DocsCoApi.prototype._onLicense = function(data) { DocsCoApi.prototype._onLicense = function(data) {
...@@ -1469,6 +1479,9 @@ ...@@ -1469,6 +1479,9 @@
case 'refreshToken' : case 'refreshToken' :
t._onRefreshToken(dataObject["messages"]); t._onRefreshToken(dataObject["messages"]);
break; break;
case 'forcesave' :
t._onForceSave(dataObject["messages"]);
break;
} }
}; };
sockjs.onclose = function(evt) { sockjs.onclose = function(evt) {
......
This diff is collapsed.
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