Refactoring signatures: enable adding invisible signature when document is signed.
This commit is contained in:
parent
084e254b42
commit
493a464076
|
@ -74,7 +74,7 @@ define([
|
|||
this._state = {};
|
||||
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
},
|
||||
setConfig: function (data, api) {
|
||||
this.setApi(api);
|
||||
|
@ -96,7 +96,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
||||
}
|
||||
}
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -114,8 +114,8 @@ define([
|
|||
this.view && this.view.onDocumentPassword(hasPassword);
|
||||
},
|
||||
|
||||
SetDisabled: function(state) {
|
||||
this.view && this.view.SetDisabled(state);
|
||||
SetDisabled: function(state, canProtect) {
|
||||
this.view && this.view.SetDisabled(state, canProtect);
|
||||
},
|
||||
|
||||
onPasswordClick: function(btn, opts){
|
||||
|
@ -148,9 +148,6 @@ define([
|
|||
},
|
||||
|
||||
onAppReady: function (config) {
|
||||
var me = this;
|
||||
// this.onApiUpdateSignatures([{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}], [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}]);
|
||||
// this.onDocumentPassword(true);
|
||||
},
|
||||
|
||||
addPassword: function() {
|
||||
|
@ -244,7 +241,11 @@ define([
|
|||
},
|
||||
|
||||
onApiUpdateSignatures: function(valid, requested){
|
||||
this.SetDisabled(valid && valid.length>0);
|
||||
this.SetDisabled(valid && valid.length>0, true);// can add invisible signature
|
||||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.SetDisabled(true);
|
||||
}
|
||||
|
||||
}, Common.Controllers.Protection || {}));
|
||||
|
|
|
@ -95,7 +95,7 @@ define([
|
|||
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
||||
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
},
|
||||
setConfig: function (data, api) {
|
||||
this.setApi(api);
|
||||
|
@ -112,7 +112,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
||||
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
|
||||
}
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -679,6 +679,10 @@ define([
|
|||
this.view && this.view.onLostEditRights();
|
||||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.SetDisabled(true);
|
||||
},
|
||||
|
||||
textInserted: '<b>Inserted:</b>',
|
||||
textDeleted: '<b>Deleted:</b>',
|
||||
textParaInserted: '<b>Paragraph Inserted</b> ',
|
||||
|
|
|
@ -189,7 +189,8 @@ define([
|
|||
},
|
||||
{
|
||||
caption: me.txtSignatureLine,
|
||||
value: 'visible'
|
||||
value: 'visible',
|
||||
disabled: me._state.disabled
|
||||
}
|
||||
]
|
||||
})
|
||||
|
@ -265,14 +266,17 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
SetDisabled: function (state) {
|
||||
SetDisabled: function (state, canProtect) {
|
||||
this._state.disabled = state;
|
||||
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
button.setDisabled(state && !canProtect);
|
||||
}
|
||||
}, this);
|
||||
this.btnSignature && this.btnSignature.setDisabled(state);
|
||||
if (this.btnSignature && this.btnSignature.menu) {
|
||||
this.btnSignature.menu.items && this.btnSignature.menu.items[1].setDisabled(state); // disable adding signature line
|
||||
this.btnSignature.setDisabled(state && !canProtect); // disable adding any signature
|
||||
}
|
||||
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
|
|
|
@ -281,9 +281,6 @@ define([
|
|||
this.onFocusObject(selectedElements, !Common.localStorage.getBool("de-hide-right-settings"));
|
||||
}
|
||||
}
|
||||
|
||||
//remove after sdk send event
|
||||
// this.onApiUpdateSignatures([{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}]);
|
||||
},
|
||||
|
||||
onDoubleClickOnObject: function(obj) {
|
||||
|
|
|
@ -289,8 +289,6 @@ define([
|
|||
this.onFocusObject(selectedElements, !Common.localStorage.getBool("pe-hide-right-settings"));
|
||||
}
|
||||
}
|
||||
//remove after sdk send event
|
||||
// this.onApiUpdateSignatures([{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}]);
|
||||
},
|
||||
|
||||
onDoubleClickOnObject: function(obj) {
|
||||
|
|
|
@ -300,9 +300,6 @@ define([
|
|||
this.rightmenu.shapeSettings.createDelayedElements();
|
||||
this.onSelectionChanged(this.api.asc_getCellInfo());
|
||||
}
|
||||
|
||||
//remove after sdk send event
|
||||
// this.onApiUpdateSignatures([{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}]);
|
||||
},
|
||||
|
||||
onDoubleClickOnObject: function(obj) {
|
||||
|
|
Loading…
Reference in a new issue