Commit 95d85289 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@49865 954022d7-b5bf-4e40-9824-e11837661b57
parent b4fad434
...@@ -520,8 +520,10 @@ function asc_CCellCommentator(currentSheet) { ...@@ -520,8 +520,10 @@ function asc_CCellCommentator(currentSheet) {
// Public methods // Public methods
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
_this.lockComment = function(oComment, callbackFunc) {
_this.isLockedComment = function(oComment, lockByDefault, callbackFunc) {
var _this = this; var _this = this;
var c1, r1, c2, r2, lockInfo; var c1, r1, c2, r2, lockInfo;
...@@ -533,40 +535,7 @@ function asc_CCellCommentator(currentSheet) { ...@@ -533,40 +535,7 @@ function asc_CCellCommentator(currentSheet) {
c2 = mergedRange ? mergedRange.c2 : oComment.asc_getCol(); c2 = mergedRange ? mergedRange.c2 : oComment.asc_getCol();
r2 = mergedRange ? mergedRange.r2 : oComment.asc_getRow(); r2 = mergedRange ? mergedRange.r2 : oComment.asc_getRow();
// Комментарий к документу блокируем как Range {
if ( !oComment.asc_getDocumentFlag() ) {
/*
if (false === _this.worksheet.collaborativeEditing.isCoAuthoringExcellEnable()) {
// Запрещено совместное редактирование
if ($.isFunction(callbackFunc)) { callbackFunc(true); }
return;
}
_this.worksheet.collaborativeEditing.onStartCheckLock();
lockInfo = _this.worksheet.collaborativeEditing.getLockInfo( c_oAscLockTypeElem.Range, null, sheetId, new asc_CCollaborativeRange(c1, r1, c2, r2) );
if ( false === _this.worksheet.collaborativeEditing.getCollaborativeEditing() ) {
// Пользователь редактирует один: не ждем ответа, а сразу продолжаем редактирование
if ($.isFunction(callbackFunc)) { callbackFunc(true); }
callbackFunc = undefined;
}
else if (false !== _this.worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeMine, false)) {
// Редактируем сами
if ($.isFunction(callbackFunc)) { callbackFunc(true); }
return;
}
else if (false !== _this.worksheet.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false)) {
// Уже ячейку кто-то редактирует
if ($.isFunction(callbackFunc)) { callbackFunc(false); }
return;
}*/
// Блокируем
_this.worksheet._isLockedCells(new asc_Range(c1, r1, c2, r2), null, callbackFunc);
}
else {
var objectGuid = oComment.asc_getId(); var objectGuid = oComment.asc_getId();
if (objectGuid) { if (objectGuid) {
...@@ -576,8 +545,14 @@ function asc_CCellCommentator(currentSheet) { ...@@ -576,8 +545,14 @@ function asc_CCellCommentator(currentSheet) {
return; return;
} }
_this.worksheet.collaborativeEditing.onStartCheckLock(); if ( lockByDefault )
lockInfo = _this.worksheet.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, /*subType*/null, sheetId, objectGuid); _this.worksheet.collaborativeEditing.onStartCheckLock();
// Комментарий к документу блокируем как Range
if ( !oComment.asc_getDocumentFlag() )
lockInfo = _this.worksheet.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, /*subType*/null, sheetId, new asc_CCollaborativeRange(c1, r1, c2, r2));
else
lockInfo = _this.worksheet.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, /*subType*/null, sheetId, objectGuid);
if (false === _this.worksheet.collaborativeEditing.getCollaborativeEditing()) { if (false === _this.worksheet.collaborativeEditing.getCollaborativeEditing()) {
// Пользователь редактирует один: не ждем ответа, а сразу продолжаем редактирование // Пользователь редактирует один: не ждем ответа, а сразу продолжаем редактирование
...@@ -596,19 +571,14 @@ function asc_CCellCommentator(currentSheet) { ...@@ -596,19 +571,14 @@ function asc_CCellCommentator(currentSheet) {
} }
// Блокируем // Блокируем
_this.worksheet.collaborativeEditing.addCheckLock(lockInfo); if ( lockByDefault ) {
_this.worksheet.collaborativeEditing.onEndCheckLock(callbackFunc); _this.worksheet.collaborativeEditing.addCheckLock(lockInfo);
_this.worksheet.collaborativeEditing.onEndCheckLock(callbackFunc);
}
else if ($.isFunction(callbackFunc)) { callbackFunc(true); }
} }
} }
} }
_this.isLockedComment = function(oComment, callbackFunc) {
var _this = this;
_this.lockComment(oComment, callbackFunc);
return;
}
_this.callLockComments = function(range) { _this.callLockComments = function(range) {
...@@ -1295,7 +1265,7 @@ asc_CCellCommentator.prototype = { ...@@ -1295,7 +1265,7 @@ asc_CCellCommentator.prototype = {
_this.lastSelectedId = id; _this.lastSelectedId = id;
} }
_this.isLockedComment(comment, callbackFunc); _this.isLockedComment(comment, false, callbackFunc);
} }
else else
_this.lastSelectedId = null; _this.lastSelectedId = null;
...@@ -1404,7 +1374,7 @@ asc_CCellCommentator.prototype = { ...@@ -1404,7 +1374,7 @@ asc_CCellCommentator.prototype = {
} }
} }
_this.isLockedComment(oComment, callbackFunc); _this.isLockedComment(oComment, true, callbackFunc);
}, },
asc_changeComment: function(id, oComment, bChangeCoords) { asc_changeComment: function(id, oComment, bChangeCoords) {
...@@ -1462,7 +1432,7 @@ asc_CCellCommentator.prototype = { ...@@ -1462,7 +1432,7 @@ asc_CCellCommentator.prototype = {
} }
} }
_this.isLockedComment(comment, callbackFunc); _this.isLockedComment(comment, true, callbackFunc);
}, },
asc_removeComment: function(id) { asc_removeComment: function(id) {
...@@ -1516,7 +1486,7 @@ asc_CCellCommentator.prototype = { ...@@ -1516,7 +1486,7 @@ asc_CCellCommentator.prototype = {
} }
} }
_this.isLockedComment(comment, callbackFunc); _this.isLockedComment(comment, true, callbackFunc);
}, },
// Extra functions // Extra functions
......
...@@ -3205,8 +3205,6 @@ ...@@ -3205,8 +3205,6 @@
if (drawLeftSideFormula) {ctx.dashLine(xFormula1, yFormula1, xFormula1, yFormula2, c_oAscCoAuthoringDottedWidth, c_oAscCoAuthoringDottedDistance);} if (drawLeftSideFormula) {ctx.dashLine(xFormula1, yFormula1, xFormula1, yFormula2, c_oAscCoAuthoringDottedWidth, c_oAscCoAuthoringDottedDistance);}
if (drawRightSideFormula) {ctx.dashLine(xFormula2, yFormula1, xFormula2, yFormula2, c_oAscCoAuthoringDottedWidth, c_oAscCoAuthoringDottedDistance);} if (drawRightSideFormula) {ctx.dashLine(xFormula2, yFormula1, xFormula2, yFormula2, c_oAscCoAuthoringDottedWidth, c_oAscCoAuthoringDottedDistance);}
} }
if ( c_oAscLockTypes.kLockTypeOther == type )
this.cellCommentator.callLockComments(arrayCells[i]);
} }
ctx.stroke(); ctx.stroke();
......
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