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