Commit e42b95d8 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Обновления после снятия lock-ов делаем только в конце, а не на каждый снятый...

Обновления после снятия lock-ов делаем только в конце, а не на каждый снятый lock (добавил функция onLocksReleasedEnd)
Баг http://bugzserver/show_bug.cgi?id=20498

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49855 954022d7-b5bf-4e40-9824-e11837661b57
parent ba207da5
......@@ -16,6 +16,7 @@
this.onMessage = options.onMessage;
this.onLocksAcquired = options.onLocksAcquired;
this.onLocksReleased = options.onLocksReleased;
this.onLocksReleasedEnd = options.onLocksReleasedEnd; // ToDo переделать на массив release locks
this.onDisconnect = options.onDisconnect;
this.onFirstLoadChanges = options.onFirstLoadChanges;
this.onConnectionStateChanged = options.onConnectionStateChanged;
......@@ -34,6 +35,7 @@
this._CoAuthoringApi.onMessage = function (e) {t.callback_OnMessage(e);};
this._CoAuthoringApi.onLocksAcquired = function (e) {t.callback_OnLocksAcquired(e);};
this._CoAuthoringApi.onLocksReleased = function (e, bChanges) {t.callback_OnLocksReleased(e, bChanges);};
this._CoAuthoringApi.onLocksReleasedEnd = function () {t.callback_OnLocksReleasedEnd();};
this._CoAuthoringApi.onDisconnect = function (e, isDisconnectAtAll, isCloseCoAuthoring) {t.callback_OnDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring);};
this._CoAuthoringApi.onFirstLoadChanges = function (e) {t.callback_OnFirstLoadChanges(e);};
this._CoAuthoringApi.onConnectionStateChanged = function (e) {t.callback_OnConnectionStateChanged(e);};
......@@ -169,6 +171,11 @@
return this.onLocksReleased (e, bChanges);
};
CDocsCoApi.prototype.callback_OnLocksReleasedEnd = function () {
if (this.onLocksReleasedEnd)
return this.onLocksReleasedEnd ();
};
/**
* Event об отсоединении от сервера
* @param {jQuery} e event об отсоединении с причиной
......@@ -224,6 +231,7 @@
this.onMessage = options.onMessage;
this.onLocksAcquired = options.onLocksAcquired;
this.onLocksReleased = options.onLocksReleased;
this.onLocksReleasedEnd = options.onLocksReleasedEnd; // ToDo переделать на массив release locks
this.onRelockFailed = options.onRelockFailed;
this.onDisconnect = options.onDisconnect;
this.onConnect = options.onConnect;
......@@ -498,6 +506,7 @@
DocsCoApi.prototype._onReleaseLock = function (data) {
if (data["locks"]) {
var bSendEnd = false;
for (var block in data["locks"]) {
if (data["locks"].hasOwnProperty(block)) {
var lock = data["locks"][block],
......@@ -507,15 +516,19 @@
if (this.onLocksReleased) {
// false - user not save changes
this.onLocksReleased(this._locks[blockTmp], false);
bSendEnd = true;
}
}
}
}
if (bSendEnd && this.onLocksReleasedEnd)
this.onLocksReleasedEnd();
}
};
DocsCoApi.prototype._onSaveChanges = function (data) {
if (data["locks"]) {
var bSendEnd = false;
for (var block in data["locks"]) {
if (data["locks"].hasOwnProperty(block)) {
var lock = data["locks"][block],
......@@ -525,10 +538,13 @@
if (this.onLocksReleased) {
// true - lock with save
this.onLocksReleased(this._locks[blockTmp], true);
bSendEnd = true;
}
}
}
}
if (bSendEnd && this.onLocksReleasedEnd)
this.onLocksReleasedEnd();
}
if (data["changes"]) {
if (this.onSaveChanges) {
......
......@@ -1338,19 +1338,22 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
if (t.wb) {
// Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно сбросить блокировку toolbar
t.wb._onWSSelectionChanged(/*info*/null);
// Шлем update для листов
t._onUpdateSheetsLock(lockElem);
var worksheet = t.wb.getWorksheet();
worksheet._drawSelection();
worksheet.objectRender.showDrawingObjects(true);
worksheet.cellCommentator.unlockComments();
}
}
};
this.CoAuthoringApi.onLocksReleasedEnd = function () {
if (t.wb) {
// Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно сбросить блокировку toolbar
t.wb._onWSSelectionChanged(/*info*/null);
var worksheet = t.wb.getWorksheet();
worksheet._drawSelection();
worksheet.objectRender.showDrawingObjects(true);
worksheet.cellCommentator.unlockComments();
}
};
this.CoAuthoringApi.onSaveChanges = function (e, bSendEvent) {
// bSendEvent = false - это означает, что мы загружаем имеющиеся изменения при открытии
var bAddChanges = false;
......
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