[DE] Show tooltip and disable editing when document is signed.
This commit is contained in:
parent
802cbac017
commit
6ab02ed9f8
|
@ -948,14 +948,12 @@ define([
|
||||||
me.api.UpdateInterfaceState();
|
me.api.UpdateInterfaceState();
|
||||||
me.fillTextArt(me.api.asc_getTextArtPreviews());
|
me.fillTextArt(me.api.asc_getTextArtPreviews());
|
||||||
|
|
||||||
if (me.appOptions.canBrandingExt)
|
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
} else {
|
} else {
|
||||||
documentHolderController.getView().createDelayedElementsViewer();
|
documentHolderController.getView().createDelayedElementsViewer();
|
||||||
if (me.appOptions.canBrandingExt)
|
Common.NotificationCenter.trigger('document:ready', 'main');
|
||||||
Common.NotificationCenter.trigger('document:ready', 'main');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.appOptions.canAnalytics && false)
|
if (this.appOptions.canAnalytics && false)
|
||||||
|
|
|
@ -325,7 +325,7 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disabled, allowMerge) {
|
SetDisabled: function(disabled, allowMerge, allowSignature) {
|
||||||
this.setMode({isEdit: !disabled});
|
this.setMode({isEdit: !disabled});
|
||||||
if (this.rightmenu) {
|
if (this.rightmenu) {
|
||||||
this.rightmenu.paragraphSettings.disableControls(disabled);
|
this.rightmenu.paragraphSettings.disableControls(disabled);
|
||||||
|
@ -340,7 +340,7 @@ define([
|
||||||
}
|
}
|
||||||
this.rightmenu.chartSettings.disableControls(disabled);
|
this.rightmenu.chartSettings.disableControls(disabled);
|
||||||
|
|
||||||
if (this.rightmenu.signatureSettings) {
|
if (!allowSignature && this.rightmenu.signatureSettings) {
|
||||||
this.rightmenu.signatureSettings.disableControls(disabled);
|
this.rightmenu.signatureSettings.disableControls(disabled);
|
||||||
this.rightmenu.btnSignature.setDisabled(disabled);
|
this.rightmenu.btnSignature.setDisabled(disabled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1208,12 +1208,17 @@ define([
|
||||||
var sign = {name: item.asc_getSigner1(), date: '18/05/2017'};
|
var sign = {name: item.asc_getSigner1(), date: '18/05/2017'};
|
||||||
(item.asc_getValid()==0) ? valid_arr.push(sign) : invalid_arr.push(sign);
|
(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.cntRequestedSign.html(this.templateRequested({signatures: requested_arr, header: this.strRequested}));
|
||||||
this.cntValidSign.html(this.templateValid({signatures: valid_arr, header: this.strValid}));
|
this.cntValidSign.html(this.templateValid({signatures: valid_arr, header: this.strValid}));
|
||||||
this.cntInvalidSign.html(this.templateValid({signatures: invalid_arr, header: this.strInvalid}));
|
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.btnAddInvisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
||||||
// this.cntInvalidSign.html(this.templateValid({signatures: [{name: 'Mary White', date: '18/05/2017'}, {name: 'John Black', date: '18/05/2017'}], header: this.strInvalid}));
|
this.btnAddVisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
||||||
},
|
},
|
||||||
|
|
||||||
strProtect: 'Protect Document',
|
strProtect: 'Protect Document',
|
||||||
|
|
|
@ -66,10 +66,9 @@ define([
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this._initSettings = true;
|
|
||||||
|
|
||||||
this._state = {
|
this._state = {
|
||||||
DisabledControls: false,
|
DisabledControls: false,
|
||||||
|
DisabledInsertControls: false,
|
||||||
requestedSignatures: undefined,
|
requestedSignatures: undefined,
|
||||||
validSignatures: undefined,
|
validSignatures: undefined,
|
||||||
invalidSignatures: undefined
|
invalidSignatures: undefined
|
||||||
|
@ -142,17 +141,11 @@ define([
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onUpdateSignatures, this));
|
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onUpdateSignatures, this));
|
||||||
}
|
}
|
||||||
|
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
createDelayedControls: function() {
|
|
||||||
this._initSettings = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
ChangeSettings: function(props) {
|
ChangeSettings: function(props) {
|
||||||
if (this._initSettings)
|
|
||||||
this.createDelayedControls();
|
|
||||||
|
|
||||||
if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures) {
|
if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures) {
|
||||||
this.onUpdateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
|
this.onUpdateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
|
||||||
}
|
}
|
||||||
|
@ -165,15 +158,20 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableControls: function(disable) {
|
disableControls: function(disable) {
|
||||||
if (this._initSettings) return;
|
|
||||||
|
|
||||||
if (this._state.DisabledControls!==disable) {
|
if (this._state.DisabledControls!==disable) {
|
||||||
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) {
|
_.each(this.lockedControls, function(item) {
|
||||||
item.setDisabled(disable);
|
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'};
|
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);
|
(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.cntRequestedSign.html(this.templateRequested({signatures: me._state.requestedSignatures, header: this.strRequested}));
|
||||||
this.cntValidSign.html(this.templateValid({signatures: me._state.validSignatures, header: this.strValid}));
|
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.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);
|
this.$linksSign = $('.signature-sign-link', this.$el);
|
||||||
var width = this.$linksSign.width();
|
var width = this.$linksSign.width();
|
||||||
|
@ -282,6 +282,47 @@ define([
|
||||||
this.api.asc_ViewCertificate(target.attr('data-value'));
|
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',
|
strSignature: 'Signature',
|
||||||
strInvisibleSign: 'Add invisible digital signature',
|
strInvisibleSign: 'Add invisible digital signature',
|
||||||
strVisibleSign: 'Add visible signature',
|
strVisibleSign: 'Add visible signature',
|
||||||
|
@ -289,7 +330,10 @@ define([
|
||||||
strValid: 'Valid signatures',
|
strValid: 'Valid signatures',
|
||||||
strInvalid: 'Invalid signatures',
|
strInvalid: 'Invalid signatures',
|
||||||
strSign: 'Sign',
|
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 || {}));
|
}, DE.Views.SignatureSettings || {}));
|
||||||
});
|
});
|
Loading…
Reference in a new issue