Refactoring signatures: enable adding invisible signature when document is signed.
This commit is contained in:
parent
dbc71821ae
commit
16c1af8a2b
|
@ -74,7 +74,7 @@ define([
|
||||||
this._state = {};
|
this._state = {};
|
||||||
|
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.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) {
|
setConfig: function (data, api) {
|
||||||
this.setApi(api);
|
this.setApi(api);
|
||||||
|
@ -96,7 +96,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
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);
|
this.view && this.view.onDocumentPassword(hasPassword);
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(state) {
|
SetDisabled: function(state, canProtect) {
|
||||||
this.view && this.view.SetDisabled(state);
|
this.view && this.view.SetDisabled(state, canProtect);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPasswordClick: function(btn, opts){
|
onPasswordClick: function(btn, opts){
|
||||||
|
@ -148,9 +148,6 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onAppReady: function (config) {
|
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() {
|
addPassword: function() {
|
||||||
|
@ -244,7 +241,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiUpdateSignatures: function(valid, requested){
|
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 || {}));
|
}, Common.Controllers.Protection || {}));
|
||||||
|
|
|
@ -94,7 +94,7 @@ define([
|
||||||
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
||||||
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
|
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.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) {
|
setConfig: function (data, api) {
|
||||||
this.setApi(api);
|
this.setApi(api);
|
||||||
|
@ -111,7 +111,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
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_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));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -626,6 +626,10 @@ define([
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onCoAuthoringDisconnect: function() {
|
||||||
|
this.SetDisabled(true);
|
||||||
|
},
|
||||||
|
|
||||||
textInserted: '<b>Inserted:</b>',
|
textInserted: '<b>Inserted:</b>',
|
||||||
textDeleted: '<b>Deleted:</b>',
|
textDeleted: '<b>Deleted:</b>',
|
||||||
textParaInserted: '<b>Paragraph Inserted</b> ',
|
textParaInserted: '<b>Paragraph Inserted</b> ',
|
||||||
|
|
|
@ -189,7 +189,8 @@ define([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
caption: me.txtSignatureLine,
|
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._state.disabled = state;
|
||||||
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
||||||
if ( button ) {
|
if ( button ) {
|
||||||
button.setDisabled(state);
|
button.setDisabled(state && !canProtect);
|
||||||
}
|
}
|
||||||
}, this);
|
}, 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) {
|
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
|
||||||
if ( button ) {
|
if ( button ) {
|
||||||
button.setDisabled(state);
|
button.setDisabled(state);
|
||||||
|
|
|
@ -281,9 +281,6 @@ define([
|
||||||
this.onFocusObject(selectedElements, !Common.localStorage.getBool("de-hide-right-settings"));
|
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) {
|
onDoubleClickOnObject: function(obj) {
|
||||||
|
|
|
@ -289,8 +289,6 @@ define([
|
||||||
this.onFocusObject(selectedElements, !Common.localStorage.getBool("pe-hide-right-settings"));
|
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) {
|
onDoubleClickOnObject: function(obj) {
|
||||||
|
|
|
@ -291,9 +291,6 @@ define([
|
||||||
this.rightmenu.shapeSettings.createDelayedElements();
|
this.rightmenu.shapeSettings.createDelayedElements();
|
||||||
this.onSelectionChanged(this.api.asc_getCellInfo());
|
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) {
|
onDoubleClickOnObject: function(obj) {
|
||||||
|
|
Loading…
Reference in a new issue