[DE] Show tooltip and disable editing when document is signed.
This commit is contained in:
parent
5623c7dd3e
commit
0ccdf8b4e2
|
@ -909,14 +909,12 @@ define([
|
|||
me.api.UpdateInterfaceState();
|
||||
me.fillTextArt(me.api.asc_getTextArtPreviews());
|
||||
|
||||
if (me.appOptions.canBrandingExt)
|
||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||
}
|
||||
}, 50);
|
||||
} else {
|
||||
documentHolderController.getView().createDelayedElementsViewer();
|
||||
if (me.appOptions.canBrandingExt)
|
||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||
}
|
||||
|
||||
if (this.appOptions.canAnalytics && false)
|
||||
|
|
|
@ -325,7 +325,7 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
SetDisabled: function(disabled, allowMerge) {
|
||||
SetDisabled: function(disabled, allowMerge, allowSignature) {
|
||||
this.setMode({isEdit: !disabled});
|
||||
if (this.rightmenu) {
|
||||
this.rightmenu.paragraphSettings.disableControls(disabled);
|
||||
|
@ -340,7 +340,7 @@ define([
|
|||
}
|
||||
this.rightmenu.chartSettings.disableControls(disabled);
|
||||
|
||||
if (this.rightmenu.signatureSettings) {
|
||||
if (!allowSignature && this.rightmenu.signatureSettings) {
|
||||
this.rightmenu.signatureSettings.disableControls(disabled);
|
||||
this.rightmenu.btnSignature.setDisabled(disabled);
|
||||
}
|
||||
|
|
|
@ -1211,12 +1211,17 @@ define([
|
|||
var sign = {name: item.asc_getSigner1(), date: '18/05/2017'};
|
||||
(item.asc_getValid()==0) ? valid_arr.push(sign) : invalid_arr.push(sign);
|
||||
});
|
||||
|
||||
// requested_arr = ['Hammish Mitchell', 'Someone Somewhere', 'Mary White', 'John Black'];
|
||||
// valid_arr = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
|
||||
// invalid_arr = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
|
||||
|
||||
this.cntRequestedSign.html(this.templateRequested({signatures: requested_arr, header: this.strRequested}));
|
||||
this.cntValidSign.html(this.templateValid({signatures: valid_arr, header: this.strValid}));
|
||||
this.cntInvalidSign.html(this.templateValid({signatures: invalid_arr, header: this.strInvalid}));
|
||||
// this.cntRequestedSign.html(this.templateRequested({signatures: ['Hammish Mitchell', 'Someone Somewhere', 'Mary White', 'John Black'], header: this.strRequested}));
|
||||
// this.cntValidSign.html(this.templateValid({signatures: [{name: 'Hammish Mitchell', date: '18/05/2017'}, {name: 'Someone Somewhere', date: '18/05/2017'}], header: this.strValid}));
|
||||
// this.cntInvalidSign.html(this.templateValid({signatures: [{name: 'Mary White', date: '18/05/2017'}, {name: 'John Black', date: '18/05/2017'}], header: this.strInvalid}));
|
||||
|
||||
this.btnAddInvisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
||||
this.btnAddVisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
||||
},
|
||||
|
||||
strProtect: 'Protect Document',
|
||||
|
|
|
@ -66,10 +66,9 @@ define([
|
|||
initialize: function () {
|
||||
var me = this;
|
||||
|
||||
this._initSettings = true;
|
||||
|
||||
this._state = {
|
||||
DisabledControls: false,
|
||||
DisabledInsertControls: false,
|
||||
requestedSignatures: undefined,
|
||||
validSignatures: undefined,
|
||||
invalidSignatures: undefined
|
||||
|
@ -142,17 +141,11 @@ define([
|
|||
if (this.api) {
|
||||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onUpdateSignatures, this));
|
||||
}
|
||||
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||
return this;
|
||||
},
|
||||
|
||||
createDelayedControls: function() {
|
||||
this._initSettings = false;
|
||||
},
|
||||
|
||||
ChangeSettings: function(props) {
|
||||
if (this._initSettings)
|
||||
this.createDelayedControls();
|
||||
|
||||
if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures) {
|
||||
this.onUpdateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
|
||||
}
|
||||
|
@ -165,15 +158,20 @@ define([
|
|||
},
|
||||
|
||||
disableControls: function(disable) {
|
||||
if (this._initSettings) return;
|
||||
|
||||
if (this._state.DisabledControls!==disable) {
|
||||
this._state.DisabledControls = disable;
|
||||
this.$linksSign && this.$linksSign.toggleClass('disabled', disable);
|
||||
this.$linksView && this.$linksView.toggleClass('disabled', disable);
|
||||
}
|
||||
this.disableInsertControls(disable);
|
||||
},
|
||||
|
||||
disableInsertControls: function(disable) {
|
||||
if (this._state.DisabledInsertControls!==disable) {
|
||||
this._state.DisabledInsertControls = disable;
|
||||
_.each(this.lockedControls, function(item) {
|
||||
item.setDisabled(disable);
|
||||
});
|
||||
this.$linksSign.toggleClass('disabled', disable);
|
||||
this.$linksView.toggleClass('disabled', disable);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -194,12 +192,14 @@ define([
|
|||
var sign = {name: item.asc_getSigner1(), guid: item.asc_getId(), date: '18/05/2017'};
|
||||
(item.asc_getValid()==0) ? me._state.validSignatures.push(sign) : me._state.invalidSignatures.push(sign);
|
||||
});
|
||||
|
||||
// me._state.requestedSignatures = [{name: 'Hammish Mitchell', guid: '123'}, {name: 'Someone Somewhere', guid: '123'}, {name: 'Mary White', guid: '123'}, {name: 'John Black', guid: '123'}];
|
||||
// me._state.validSignatures = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
|
||||
// me._state.invalidSignatures = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
|
||||
|
||||
this.cntRequestedSign.html(this.templateRequested({signatures: me._state.requestedSignatures, header: this.strRequested}));
|
||||
this.cntValidSign.html(this.templateValid({signatures: me._state.validSignatures, header: this.strValid}));
|
||||
this.cntInvalidSign.html(this.templateValid({signatures: me._state.invalidSignatures, header: this.strInvalid}));
|
||||
// this.cntRequestedSign.html(this.templateRequested({signatures: [{name: 'Hammish Mitchell', guid: '123'}, {name: 'Someone Somewhere', guid: '123'}, {name: 'Mary White', guid: '123'}, {name: 'John Black', guid: '123'}], header: this.strRequested}));
|
||||
// this.cntValidSign.html(this.templateValid({signatures: [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}], header: this.strValid}));
|
||||
// this.cntInvalidSign.html(this.templateValid({signatures: [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}], header: this.strInvalid}));
|
||||
|
||||
this.$linksSign = $('.signature-sign-link', this.$el);
|
||||
var width = this.$linksSign.width();
|
||||
|
@ -282,6 +282,47 @@ define([
|
|||
this.api.asc_ViewCertificate(target.attr('data-value'));
|
||||
},
|
||||
|
||||
onDocumentReady: function() {
|
||||
this.ChangeSettings();
|
||||
|
||||
var me = this,
|
||||
hasSigned = (me._state.validSignatures.length>0 || me._state.invalidSignatures.length>0),
|
||||
hasRequested = (me._state.requestedSignatures.length>0);
|
||||
|
||||
hasSigned && this.disableEditing(hasSigned);
|
||||
|
||||
if (!this._state.tip && (hasSigned || hasRequested)) {
|
||||
this._state.tip = new Common.UI.SynchronizeTip({
|
||||
target : DE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
||||
text : (hasSigned) ? this.txtSignedDocument : this.txtRequestedSignatures,
|
||||
showLink: hasSigned,
|
||||
textLink: this.txtContinueEditing,
|
||||
placement: 'left'
|
||||
});
|
||||
this._state.tip.on({
|
||||
'dontshowclick': function() {
|
||||
me._state.tip.hide();
|
||||
// me.api.editSingedDoc();
|
||||
me.disableEditing(false);
|
||||
},
|
||||
'closeclick': function() {
|
||||
me._state.tip.hide();
|
||||
}
|
||||
});
|
||||
this._state.tip.show();
|
||||
}
|
||||
},
|
||||
|
||||
disableEditing: function(disable) {
|
||||
disable && DE.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||
DE.getController('Toolbar').DisableToolbar(disable, disable);
|
||||
DE.getController('RightMenu').SetDisabled(disable, false, true);
|
||||
DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||
DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||
DE.getController('LeftMenu').SetDisabled(disable, true);
|
||||
this.disableInsertControls(disable);
|
||||
},
|
||||
|
||||
strSignature: 'Signature',
|
||||
strInvisibleSign: 'Add invisible digital signature',
|
||||
strVisibleSign: 'Add visible signature',
|
||||
|
@ -289,7 +330,10 @@ define([
|
|||
strValid: 'Valid signatures',
|
||||
strInvalid: 'Invalid signatures',
|
||||
strSign: 'Sign',
|
||||
strView: 'View'
|
||||
strView: 'View',
|
||||
txtSignedDocument: 'This document has been signed. It should not be edited.',
|
||||
txtRequestedSignatures: 'This document has requested signatures.',
|
||||
txtContinueEditing: 'Edit anyway'
|
||||
|
||||
}, DE.Views.SignatureSettings || {}));
|
||||
});
|
Loading…
Reference in a new issue