[DE] Lock/unlock accept/reject buttons for selected text
This commit is contained in:
parent
f5cc227192
commit
302c220ccf
|
@ -179,20 +179,51 @@ define([
|
|||
});
|
||||
},
|
||||
|
||||
onApiShowChange: function (sdkchange) {
|
||||
isSelectedChangesLocked: function(changes, fromSelection) {
|
||||
if (!changes || changes.length<1) return true;
|
||||
|
||||
if (!fromSelection)
|
||||
return changes[0].get('lock') || !changes[0].get('editable');
|
||||
|
||||
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;
|
||||
},
|
||||
|
||||
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) {
|
||||
this.dlgChanges.btnAccept.setDisabled(btnlock);
|
||||
this.dlgChanges.btnReject.setDisabled(btnlock);
|
||||
}
|
||||
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) {
|
||||
if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0 && !fromSelection) { // show changes balloon only for current position, not selection
|
||||
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');
|
||||
lockUser = this.getUserName(sdkchange[0].get_LockUserId());
|
||||
|
||||
this.getPopover().hideTips();
|
||||
this.popoverChanges.reset(changes);
|
||||
this.popoverChanges.reset(changes || this.readSDKChange(sdkchange));
|
||||
|
||||
if (animate) {
|
||||
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
||||
|
@ -200,18 +231,6 @@ define([
|
|||
}
|
||||
|
||||
this.getPopover().showReview(animate, lock, lockUser);
|
||||
|
||||
var btnlock = lock || !editable;
|
||||
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== btnlock) {
|
||||
this.view.btnAccept.setDisabled(btnlock);
|
||||
this.view.btnReject.setDisabled(btnlock);
|
||||
if (this.dlgChanges) {
|
||||
this.dlgChanges.btnAccept.setDisabled(btnlock);
|
||||
this.dlgChanges.btnReject.setDisabled(btnlock);
|
||||
}
|
||||
this._state.lock = btnlock;
|
||||
Common.Utils.InternalSettings.set(this.view.appPrefix + "accept-reject-lock", btnlock);
|
||||
}
|
||||
this._state.posx = posX;
|
||||
this._state.posy = posY;
|
||||
this._state.changes_length = sdkchange.length;
|
||||
|
|
Loading…
Reference in a new issue