[DE] Lock/unlock accept/reject buttons for selected text
This commit is contained in:
parent
f5cc227192
commit
302c220ccf
|
@ -179,30 +179,29 @@ define([
|
|||
});
|
||||
},
|
||||
|
||||
onApiShowChange: function (sdkchange) {
|
||||
if (this.getPopover()) {
|
||||
if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0) {
|
||||
var i = 0,
|
||||
changes = this.readSDKChange(sdkchange),
|
||||
posX = sdkchange[0].get_X(),
|
||||
posY = sdkchange[0].get_Y(),
|
||||
animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length),
|
||||
lock = (sdkchange[0].get_LockUserId()!==null),
|
||||
lockUser = this.getUserName(sdkchange[0].get_LockUserId()),
|
||||
editable = changes[0].get('editable');
|
||||
isSelectedChangesLocked: function(changes, fromSelection) {
|
||||
if (!changes || changes.length<1) return true;
|
||||
|
||||
this.getPopover().hideTips();
|
||||
this.popoverChanges.reset(changes);
|
||||
if (!fromSelection)
|
||||
return changes[0].get('lock') || !changes[0].get('editable');
|
||||
|
||||
if (animate) {
|
||||
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
for (var i=0; i<changes.length; i++) {
|
||||
var change = changes[i];
|
||||
if (change.get('lock') || !change.get('editable'))
|
||||
return true; // lock button if at least one change is locked
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
this.getPopover().showReview(animate, lock, lockUser);
|
||||
|
||||
var btnlock = lock || !editable;
|
||||
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== btnlock) {
|
||||
onApiShowChange: function (sdkchange, fromSelection) {
|
||||
var btnlock = true,
|
||||
changes;
|
||||
if (this.appConfig.canReview && !this.appConfig.isReviewOnly) {
|
||||
if (sdkchange && sdkchange.length>0) {
|
||||
changes = this.readSDKChange(sdkchange);
|
||||
btnlock = this.isSelectedChangesLocked(changes, fromSelection);
|
||||
}
|
||||
if (this._state.lock !== btnlock) {
|
||||
this.view.btnAccept.setDisabled(btnlock);
|
||||
this.view.btnReject.setDisabled(btnlock);
|
||||
if (this.dlgChanges) {
|
||||
|
@ -212,6 +211,26 @@ define([
|
|||
this._state.lock = btnlock;
|
||||
Common.Utils.InternalSettings.set(this.view.appPrefix + "accept-reject-lock", btnlock);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getPopover()) {
|
||||
if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0 && !fromSelection) { // show changes balloon only for current position, not selection
|
||||
var i = 0,
|
||||
posX = sdkchange[0].get_X(),
|
||||
posY = sdkchange[0].get_Y(),
|
||||
animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length),
|
||||
lock = (sdkchange[0].get_LockUserId()!==null),
|
||||
lockUser = this.getUserName(sdkchange[0].get_LockUserId());
|
||||
|
||||
this.getPopover().hideTips();
|
||||
this.popoverChanges.reset(changes || this.readSDKChange(sdkchange));
|
||||
|
||||
if (animate) {
|
||||
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
|
||||
this.getPopover().showReview(animate, lock, lockUser);
|
||||
this._state.posx = posX;
|
||||
this._state.posy = posY;
|
||||
this._state.changes_length = sdkchange.length;
|
||||
|
|
Loading…
Reference in a new issue