Commit b88afb82 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

Исправлена ошибка с блокировкой объекта при СР

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48546 954022d7-b5bf-4e40-9824-e11837661b57
parent 362f8bad
......@@ -1518,7 +1518,8 @@ function DrawingObjects() {
var userId = null;
var documentId = null;
_this.objectLocker = null;
_this.drawingDocument = null;
_this.asyncImageEndLoaded = null;
_this.asyncImagesDocumentEndLoaded = null;
......@@ -1893,6 +1894,7 @@ function DrawingObjects() {
autoShapeTrack = new CAutoshapeTrack();
autoShapeTrack.init( trackOverlay, 0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix, shapeOverlayCtx.m_dWidthMM, shapeOverlayCtx.m_dHeightMM );
_this.objectLocker = new ObjectLocker(worksheet);
_this.drawingDocument = new CDrawingDocument(this);
_this.drawingDocument.AutoShapesTrack = autoShapeTrack;
_this.drawingDocument.TargetHtmlElement = document.getElementById('id_target_cursor');
......@@ -3078,7 +3080,12 @@ function DrawingObjects() {
_this.sendGraphicObjectProps();
worksheet.model.workbook.handlers.trigger("asc_onEndAddShape");
_this.lockDrawingObject(obj.id, true, true);
//_this.lockDrawingObject(obj.id, true, true);
_this.objectLocker.reset();
_this.objectLocker.addObjectId(obj.id);
_this.objectLocker.checkObjects( function(result){ return result; } );
return ret;
}
......@@ -3865,3 +3872,55 @@ function DrawingObjects() {
return tmp;
}
}
//-----------------------------------------------------------------------------------
// Universal object locker/checker
//-----------------------------------------------------------------------------------
function ObjectLocker(ws) {
var _t = this;
var aObjectId = [];
var worksheet = ws;
_t.reset = function() {
aObjectId = [];
}
_t.addObjectId = function(id) {
aObjectId.push(id);
}
_t.checkObjects = function(callback) {
if (false === worksheet.collaborativeEditing.isCoAuthoringExcellEnable()) {
// Запрещено совместное редактирование
if ($.isFunction(callback)) {callback(true);}
return;
}
var sheetId = worksheet.model.getId();
worksheet.collaborativeEditing.onStartCheckLock();
for ( var i = 0; i < aObjectId.length; i++ ) {
var lockInfo = worksheet.collaborativeEditing.getLockInfo( c_oAscLockTypeElem.Object, /*subType*/null, sheetId, aObjectId[i] );
if ( false === worksheet.collaborativeEditing.getCollaborativeEditing() ) {
// Пользователь редактирует один: не ждем ответа, а сразу продолжаем редактирование
if ($.isFunction(callback)) {callback(true);}
}
else if ( false !== worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine) ) {
// Редактируем сами
if ($.isFunction(callback)) {callback(true);}
return;
}
else if ( false !== worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther) ) {
// Уже ячейку кто-то редактирует
if ($.isFunction(callback)) {callback(false);}
return;
}
worksheet.collaborativeEditing.addCheckLock(lockInfo);
}
worksheet.collaborativeEditing.onEndCheckLock(callback);
}
}
\ No newline at end of file
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