[DE] Request signature before sign document.

This commit is contained in:
Julia Radzhabova 2017-11-17 11:44:36 +03:00
parent 36ee2b867f
commit 66fe289633
3 changed files with 11 additions and 10 deletions

View file

@ -90,9 +90,9 @@ define([
if (this.appConfig.isDesktopApp && this.appConfig.isOffline) { if (this.appConfig.isDesktopApp && this.appConfig.isOffline) {
this.api.asc_registerCallback('asc_onDocumentPassword', _.bind(this.onDocumentPassword, this)); this.api.asc_registerCallback('asc_onDocumentPassword', _.bind(this.onDocumentPassword, this));
if (this.appConfig.canProtect) { if (this.appConfig.canProtect) {
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onApiSignatureClick, this)); Common.NotificationCenter.on('protect:sign', _.bind(this.onSignatureRequest, this));
Common.NotificationCenter.on('protect:sign', _.bind(this.onApiSignatureClick, this)); Common.NotificationCenter.on('protect:signature', _.bind(this.onSignatureClick, this));
Common.NotificationCenter.on('protect:signature', _.bind(this.onSignatureClick, this)); this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onSignatureSign, this));
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this)); this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
} }
} }
@ -127,9 +127,13 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
}, },
onSignatureRequest: function(guid){
this.api.asc_RequestSign(guid);
},
onSignatureClick: function(type, signed, guid){ onSignatureClick: function(type, signed, guid){
switch (type) { switch (type) {
case 'invisible': this.addInvisibleSignature(); break; case 'invisible': this.onSignatureRequest('invisibleAdd'); break;
case 'visible': this.addVisibleSignature(signed, guid); break; case 'visible': this.addVisibleSignature(signed, guid); break;
} }
}, },
@ -242,8 +246,8 @@ define([
win.show(); win.show();
}, },
onApiSignatureClick: function(guid, width, height) { onSignatureSign: function(guid, width, height, isVisible) {
this.signVisibleSignature(guid, width, height); (isVisible) ? this.signVisibleSignature(guid, width, height) : this.addInvisibleSignature();
}, },
onApiUpdateSignatures: function(valid, requested){ onApiUpdateSignatures: function(valid, requested){

View file

@ -49,7 +49,6 @@ define([
'common/main/lib/component/Menu', 'common/main/lib/component/Menu',
'common/main/lib/view/InsertTableDialog', 'common/main/lib/view/InsertTableDialog',
'common/main/lib/view/CopyWarningDialog', 'common/main/lib/view/CopyWarningDialog',
'common/main/lib/view/SignDialog',
'documenteditor/main/app/view/DropcapSettingsAdvanced', 'documenteditor/main/app/view/DropcapSettingsAdvanced',
'documenteditor/main/app/view/HyperlinkSettingsDialog', 'documenteditor/main/app/view/HyperlinkSettingsDialog',
'documenteditor/main/app/view/ParagraphSettingsAdvanced', 'documenteditor/main/app/view/ParagraphSettingsAdvanced',

View file

@ -43,9 +43,7 @@ define([
'jquery', 'jquery',
'underscore', 'underscore',
'backbone', 'backbone',
'common/main/lib/component/Button', 'common/main/lib/component/Button'
'common/main/lib/view/SignDialog',
'common/main/lib/view/SignSettingsDialog'
], function (menuTemplate, $, _, Backbone) { ], function (menuTemplate, $, _, Backbone) {
'use strict'; 'use strict';