[DE] Signature - use certificates.
This commit is contained in:
parent
1828f40de5
commit
015a11bc62
|
@ -137,6 +137,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this));
|
this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this));
|
||||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true));
|
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this));
|
||||||
|
this.api.asc_registerCallback('on_signature_defaultcertificate_ret', _.bind(this.onDefaultCertificate, this));
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
if (this.mode.canCoAuthoring) {
|
if (this.mode.canCoAuthoring) {
|
||||||
if (this.mode.canChat)
|
if (this.mode.canChat)
|
||||||
|
@ -694,6 +695,12 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
addInvisibleSign: function(menu) {
|
addInvisibleSign: function(menu) {
|
||||||
|
this.api.asc_GetDefaultCertificate();
|
||||||
|
menu.hide();
|
||||||
|
this.leftMenu.btnFile.toggle(false, true);
|
||||||
|
},
|
||||||
|
|
||||||
|
onDefaultCertificate: function(certificate) {
|
||||||
var me = this,
|
var me = this,
|
||||||
win = new DE.Views.SignDialog({
|
win = new DE.Views.SignDialog({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
|
@ -701,18 +708,14 @@ define([
|
||||||
handler: function(dlg, result) {
|
handler: function(dlg, result) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
var props = dlg.getSettings();
|
var props = dlg.getSettings();
|
||||||
me.api.asc_Sign();
|
me.api.asc_Sign(props.certificateId);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete');
|
Common.NotificationCenter.trigger('edit:complete');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
win.show();
|
win.show();
|
||||||
win.setSettings({});
|
win.setSettings(certificate);
|
||||||
// win.setSettings(me.api.asc_getCertificateSettings());
|
|
||||||
|
|
||||||
menu.hide();
|
|
||||||
this.leftMenu.btnFile.toggle(false, true);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
textNoTextFound : 'Text not found',
|
textNoTextFound : 'Text not found',
|
||||||
|
|
|
@ -52,7 +52,8 @@ define([
|
||||||
'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',
|
||||||
'documenteditor/main/app/view/TableSettingsAdvanced'
|
'documenteditor/main/app/view/TableSettingsAdvanced',
|
||||||
|
'documenteditor/main/app/view/SignDialog'
|
||||||
], function ($, _, Backbone, gateway) { 'use strict';
|
], function ($, _, Backbone, gateway) { 'use strict';
|
||||||
|
|
||||||
DE.Views.DocumentHolder = Backbone.View.extend(_.extend({
|
DE.Views.DocumentHolder = Backbone.View.extend(_.extend({
|
||||||
|
@ -80,6 +81,7 @@ define([
|
||||||
me._currentMathObj = undefined;
|
me._currentMathObj = undefined;
|
||||||
me._currentParaObjDisabled = false;
|
me._currentParaObjDisabled = false;
|
||||||
me._isDisabled = false;
|
me._isDisabled = false;
|
||||||
|
me._currentSignGuid = null;
|
||||||
|
|
||||||
var showPopupMenu = function(menu, value, event, docElement, eOpts){
|
var showPopupMenu = function(menu, value, event, docElement, eOpts){
|
||||||
if (!_.isUndefined(menu) && menu !== null){
|
if (!_.isUndefined(menu) && menu !== null){
|
||||||
|
@ -724,6 +726,28 @@ define([
|
||||||
me.mode.isEdit = false;
|
me.mode.isEdit = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onSignatureClick = function(guid) {
|
||||||
|
me._currentSignGuid = guid;
|
||||||
|
me.api.asc_GetDefaultCertificate();
|
||||||
|
};
|
||||||
|
|
||||||
|
var onDefaultCertificate = function(certificate) {
|
||||||
|
var win = new DE.Views.SignDialog({
|
||||||
|
api: me.api,
|
||||||
|
signType: 'visible',
|
||||||
|
handler: function(dlg, result) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
var props = dlg.getSettings();
|
||||||
|
me.api.asc_Sign(props.certificateId, me._currentSignGuid, props.image);
|
||||||
|
}
|
||||||
|
Common.NotificationCenter.trigger('edit:complete');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
win.show();
|
||||||
|
win.setSettings(certificate);
|
||||||
|
};
|
||||||
|
|
||||||
var onTextLanguage = function(langid) {
|
var onTextLanguage = function(langid) {
|
||||||
me._currLang.id = langid;
|
me._currLang.id = langid;
|
||||||
};
|
};
|
||||||
|
@ -1528,6 +1552,8 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, this));
|
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, this));
|
||||||
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, this));
|
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, this));
|
||||||
|
|
||||||
|
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(onSignatureClick, this));
|
||||||
|
this.api.asc_registerCallback('on_signature_defaultcertificate_ret', _.bind(onDefaultCertificate, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1188,10 +1188,20 @@ define([
|
||||||
|
|
||||||
updateSignatures: function(){
|
updateSignatures: function(){
|
||||||
var requested = this.api.asc_getRequestSignatures(),
|
var requested = this.api.asc_getRequestSignatures(),
|
||||||
valid = this.api.asc_getSignatures();
|
requested_arr = [],
|
||||||
// this.cntRequestedSign.html(this.templateRequested({signatures: this.api.asc_getRequestSignatures(), header: this.strRequested}));
|
valid = this.api.asc_getSignatures(),
|
||||||
// this.cntValidSign.html(this.templateValid({signatures: this.api.asc_getValidSignatures(), header: this.strValid}));
|
valid_arr = [], invalid_arr = [];
|
||||||
// this.cntInvalidSign.html(this.templateInvalid({signatures: this.api.asc_getInvalidSignatures(), header: this.strInvalid}));
|
|
||||||
|
_.each(requested, function(item, index){
|
||||||
|
requested_arr.push(item.asc_getSigner1());
|
||||||
|
});
|
||||||
|
_.each(valid, function(item, index){
|
||||||
|
var sign = {name: item.asc_getSigner1(), date: '18/05/2017'};
|
||||||
|
(item.asc_getValid()) ? valid_arr.push(sign) : invalid_arr.push(sign);
|
||||||
|
});
|
||||||
|
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.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.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.cntInvalidSign.html(this.templateValid({signatures: [{name: 'Mary White', date: '18/05/2017'}, {name: 'John Black', date: '18/05/2017'}], header: this.strInvalid}));
|
||||||
|
|
|
@ -62,6 +62,7 @@ define([
|
||||||
|
|
||||||
this.api = this.options.api;
|
this.api = this.options.api;
|
||||||
this.signType = this.options.signType || 'invisible';
|
this.signType = this.options.signType || 'invisible';
|
||||||
|
this.certificateId = null;
|
||||||
|
|
||||||
this.template = [
|
this.template = [
|
||||||
'<div class="box" style="height: ' + ((this.signType == 'invisible') ? '132px;' : '260px;') + '">',
|
'<div class="box" style="height: ' + ((this.signType == 'invisible') ? '132px;' : '260px;') + '">',
|
||||||
|
@ -152,18 +153,23 @@ define([
|
||||||
setSettings: function (props) {
|
setSettings: function (props) {
|
||||||
if (props) {
|
if (props) {
|
||||||
var me = this,
|
var me = this,
|
||||||
name = 'Hammish Mitchell',//props.asc_getName(),
|
name = (props.name) ? props.name : '',
|
||||||
from = '1/02/2011',//props.asc_getFrom(),
|
date = props.date,
|
||||||
to = '1/02/2021';//props.asc_getTo();
|
arr_date = (typeof date == 'string') ? date.split(' - ') : ['', ''];
|
||||||
|
this.cntCertificate.html(this.templateCertificate({name: name, valid: this.textValid.replace('%1', arr_date[0]).replace('%2', arr_date[1])}));
|
||||||
this.cntCertificate.html(this.templateCertificate({name: name, valid: this.textValid.replace('%1', from).replace('%2', to)}));
|
this.certificateId = props.id;
|
||||||
|
}
|
||||||
|
if (this.api) {
|
||||||
|
this.api.asc_unregisterCallback('on_signature_selectsertificate_ret', _.bind(this.onCertificateChanged, this));
|
||||||
|
this.api.asc_registerCallback('on_signature_selectsertificate_ret', _.bind(this.onCertificateChanged, this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getSettings: function () {
|
getSettings: function () {
|
||||||
var me = this, props;
|
var props = {};
|
||||||
if (me.signType == 'invisible') {
|
props.certificateId = this.certificateId;
|
||||||
// props.asc_putPurpose(me.inputPurpose.getValue());
|
if (this.signType == 'invisible') {
|
||||||
|
props.purpose(this.inputPurpose.getValue());
|
||||||
} else {
|
} else {
|
||||||
// props.asc_putName(me.inputName.getValue());
|
// props.asc_putName(me.inputName.getValue());
|
||||||
}
|
}
|
||||||
|
@ -189,7 +195,14 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeCertificate: function() {
|
onChangeCertificate: function() {
|
||||||
// this.api.asc_changeCertificate();
|
this.api.asc_SelectCertificate();
|
||||||
|
},
|
||||||
|
|
||||||
|
onCertificateChanged: function(certificate) {
|
||||||
|
this.certificateId = certificate.id;
|
||||||
|
var date = certificate.date,
|
||||||
|
arr_date = (typeof date == 'string') ? date.split(' - ') : ['', ''];
|
||||||
|
this.cntCertificate.html(this.templateCertificate({name: certificate.name, valid: this.textValid.replace('%1', arr_date[0]).replace('%2', arr_date[1])}));
|
||||||
},
|
},
|
||||||
|
|
||||||
textTitle: 'Sign Document',
|
textTitle: 'Sign Document',
|
||||||
|
|
|
@ -146,15 +146,15 @@ define([
|
||||||
if (props) {
|
if (props) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
// var value = props.asc_getName();
|
// var value = props.asc_getSigner1();
|
||||||
// me.inputName.setValue(value ? value : '');
|
// me.inputName.setValue(value ? value : '');
|
||||||
// value = props.asc_getTitle();
|
// value = props.asc_getSigner2();
|
||||||
// me.inputTitle.setValue(value ? value : '');
|
// me.inputTitle.setValue(value ? value : '');
|
||||||
// value = props.asc_getEmail();
|
// value = props.asc_getEmail();
|
||||||
// me.inputEmail.setValue(value ? value : '');
|
// me.inputEmail.setValue(value ? value : '');
|
||||||
// value = props.asc_getInstructions();
|
// value = props.asc_getInstructions();
|
||||||
// me.textareaInstructions.val(value ? value : '');
|
// me.textareaInstructions.val(value ? value : '');
|
||||||
// me.chDate.setValue(props.asc_getDate());
|
// me.chDate.setValue(props.asc_getShowDate());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue