[DE] View signatures in the right panel.
This commit is contained in:
parent
9a0f2cdab1
commit
2f92c81749
|
@ -101,7 +101,8 @@ Common.Utils = _.extend(new(function() {
|
||||||
Shape : 5,
|
Shape : 5,
|
||||||
Slide : 6,
|
Slide : 6,
|
||||||
Chart : 7,
|
Chart : 7,
|
||||||
MailMerge : 8
|
MailMerge : 8,
|
||||||
|
Signature : 9
|
||||||
},
|
},
|
||||||
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
|
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
|
||||||
me = this,
|
me = this,
|
||||||
|
|
|
@ -687,44 +687,12 @@ define([
|
||||||
});
|
});
|
||||||
|
|
||||||
win.show();
|
win.show();
|
||||||
// win.setSettings(me.api.asc_getSignatureSettings());
|
|
||||||
|
|
||||||
menu.hide();
|
menu.hide();
|
||||||
this.leftMenu.btnFile.toggle(false, true);
|
this.leftMenu.btnFile.toggle(false, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
addInvisibleSign: function(menu) {
|
addInvisibleSign: function(menu) {
|
||||||
/*
|
|
||||||
var me = this;
|
|
||||||
if (_.isUndefined(me.fontStore)) {
|
|
||||||
me.fontStore = new Common.Collections.Fonts();
|
|
||||||
var fonts = DE.getController('Toolbar').getView('Toolbar').cmbFontName.store.toJSON();
|
|
||||||
var arr = [];
|
|
||||||
_.each(fonts, function(font, index){
|
|
||||||
if (!font.cloneid) {
|
|
||||||
arr.push(_.clone(font));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
me.fontStore.add(arr);
|
|
||||||
}
|
|
||||||
var win = new DE.Views.SignDialog({
|
|
||||||
api: me.api,
|
|
||||||
signType: 'visible',
|
|
||||||
fontStore: me.fontStore,
|
|
||||||
handler: function(dlg, result) {
|
|
||||||
if (result == 'ok') {
|
|
||||||
var props = dlg.getSettings();
|
|
||||||
me.api.asc_Sign(props.certificateId, 'guid', props.images[0], props.images[1]);
|
|
||||||
}
|
|
||||||
Common.NotificationCenter.trigger('edit:complete');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
win.show();
|
|
||||||
|
|
||||||
menu.hide();
|
|
||||||
this.leftMenu.btnFile.toggle(false, true);
|
|
||||||
*/
|
|
||||||
|
|
||||||
var me = this,
|
var me = this,
|
||||||
win = new DE.Views.SignDialog({
|
win = new DE.Views.SignDialog({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
|
|
|
@ -79,6 +79,7 @@ define([
|
||||||
this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false};
|
this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false};
|
||||||
this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false};
|
this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false};
|
||||||
this._settings[Common.Utils.documentSettingsType.MailMerge] = {panelId: "id-mail-merge-settings", panel: rightMenu.mergeSettings, btn: rightMenu.btnMailMerge, hidden: 1, props: {}, locked: false};
|
this._settings[Common.Utils.documentSettingsType.MailMerge] = {panelId: "id-mail-merge-settings", panel: rightMenu.mergeSettings, btn: rightMenu.btnMailMerge, hidden: 1, props: {}, locked: false};
|
||||||
|
this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 0, props: {}, locked: false};
|
||||||
},
|
},
|
||||||
|
|
||||||
setApi: function(api) {
|
setApi: function(api) {
|
||||||
|
@ -96,7 +97,7 @@ define([
|
||||||
var panel = this._settings[type].panel;
|
var panel = this._settings[type].panel;
|
||||||
var props = this._settings[type].props;
|
var props = this._settings[type].props;
|
||||||
if (props && panel)
|
if (props && panel)
|
||||||
panel.ChangeSettings.call(panel, (type==Common.Utils.documentSettingsType.MailMerge) ? undefined : props);
|
panel.ChangeSettings.call(panel, (type==Common.Utils.documentSettingsType.MailMerge || type==Common.Utils.documentSettingsType.Signature) ? undefined : props);
|
||||||
} else if (minimized && type==Common.Utils.documentSettingsType.MailMerge) {
|
} else if (minimized && type==Common.Utils.documentSettingsType.MailMerge) {
|
||||||
this.rightmenu.mergeSettings.disablePreviewMode();
|
this.rightmenu.mergeSettings.disablePreviewMode();
|
||||||
}
|
}
|
||||||
|
@ -112,13 +113,14 @@ define([
|
||||||
in_equation = false,
|
in_equation = false,
|
||||||
needhide = true;
|
needhide = true;
|
||||||
for (var i=0; i<this._settings.length; i++) {
|
for (var i=0; i<this._settings.length; i++) {
|
||||||
if (i==Common.Utils.documentSettingsType.MailMerge) continue;
|
if (i==Common.Utils.documentSettingsType.MailMerge || i==Common.Utils.documentSettingsType.Signature) continue;
|
||||||
if (this._settings[i]) {
|
if (this._settings[i]) {
|
||||||
this._settings[i].hidden = 1;
|
this._settings[i].hidden = 1;
|
||||||
this._settings[i].locked = false;
|
this._settings[i].locked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._settings[Common.Utils.documentSettingsType.MailMerge].locked = false;
|
this._settings[Common.Utils.documentSettingsType.MailMerge].locked = false;
|
||||||
|
this._settings[Common.Utils.documentSettingsType.Signature].locked = false;
|
||||||
|
|
||||||
var isChart = false;
|
var isChart = false;
|
||||||
for (i=0; i<SelectedObjects.length; i++)
|
for (i=0; i<SelectedObjects.length; i++)
|
||||||
|
@ -179,7 +181,7 @@ define([
|
||||||
currentactive = -1;
|
currentactive = -1;
|
||||||
} else {
|
} else {
|
||||||
if (pnl.btn.isDisabled()) pnl.btn.setDisabled(false);
|
if (pnl.btn.isDisabled()) pnl.btn.setDisabled(false);
|
||||||
if (i!=Common.Utils.documentSettingsType.MailMerge) lastactive = i;
|
if (i!=Common.Utils.documentSettingsType.MailMerge && i!=Common.Utils.documentSettingsType.Signature) lastactive = i;
|
||||||
if ( pnl.needShow ) {
|
if ( pnl.needShow ) {
|
||||||
pnl.needShow = false;
|
pnl.needShow = false;
|
||||||
priorityactive = i;
|
priorityactive = i;
|
||||||
|
@ -336,6 +338,11 @@ define([
|
||||||
}
|
}
|
||||||
this.rightmenu.chartSettings.disableControls(disabled);
|
this.rightmenu.chartSettings.disableControls(disabled);
|
||||||
|
|
||||||
|
if (this.rightmenu.signatureSettings) {
|
||||||
|
this.rightmenu.signatureSettings.disableControls(disabled);
|
||||||
|
this.rightmenu.btnSignature.setDisabled(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
this.rightmenu.btnText.setDisabled(disabled);
|
this.rightmenu.btnText.setDisabled(disabled);
|
||||||
this.rightmenu.btnTable.setDisabled(disabled);
|
this.rightmenu.btnTable.setDisabled(disabled);
|
||||||
|
@ -343,7 +350,6 @@ define([
|
||||||
this.rightmenu.btnHeaderFooter.setDisabled(disabled);
|
this.rightmenu.btnHeaderFooter.setDisabled(disabled);
|
||||||
this.rightmenu.btnShape.setDisabled(disabled);
|
this.rightmenu.btnShape.setDisabled(disabled);
|
||||||
this.rightmenu.btnTextArt.setDisabled(disabled);
|
this.rightmenu.btnTextArt.setDisabled(disabled);
|
||||||
|
|
||||||
this.rightmenu.btnChart.setDisabled(disabled);
|
this.rightmenu.btnChart.setDisabled(disabled);
|
||||||
} else {
|
} else {
|
||||||
var selectedElements = this.api.getSelectedElements();
|
var selectedElements = this.api.getSelectedElements();
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="id-textart-settings" class="settings-panel">
|
<div id="id-textart-settings" class="settings-panel">
|
||||||
</div>
|
</div>
|
||||||
|
<div id="id-signature-settings" class="settings-panel">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tool-menu-btns">
|
<div class="tool-menu-btns">
|
||||||
<div class="ct-btn-category arrow-left" />
|
<div class="ct-btn-category arrow-left" />
|
||||||
|
@ -27,5 +29,6 @@
|
||||||
<button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><i class="icon img-toolbarmenu btn-menu-chart"> </i></button>
|
<button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><i class="icon img-toolbarmenu btn-menu-chart"> </i></button>
|
||||||
<button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><i class="icon img-toolbarmenu btn-menu-textart"> </i></button>
|
<button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><i class="icon img-toolbarmenu btn-menu-textart"> </i></button>
|
||||||
<button id="id-right-menu-mail-merge" class="btn btn-category arrow-left hidden" content-target="id-mail-merge-settings"><i class="icon img-toolbarmenu btn-menu-mail-merge"> </i></button>
|
<button id="id-right-menu-mail-merge" class="btn btn-category arrow-left hidden" content-target="id-mail-merge-settings"><i class="icon img-toolbarmenu btn-menu-mail-merge"> </i></button>
|
||||||
|
<button id="id-right-menu-signature" class="btn btn-category arrow-left hidden" content-target="id-signature-settings"><i class="icon img-toolbarmenu btn-menu-signature"> </i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<table cols="2">
|
||||||
|
<tr>
|
||||||
|
<td class="padding-large">
|
||||||
|
<label style="font-size: 18px;"><%= scope.strSignature %></label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding-small">
|
||||||
|
<button id="signature-invisible-sign" class="btn btn-text-default" style="width:100%;"><%= scope.strInvisibleSign %></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding-large">
|
||||||
|
<button id="signature-visible-sign" class="btn btn-text-default" style="width:100%;"><%= scope.strVisibleSign %></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="signature-requested-sign">
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr id="signature-valid-sign">
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr id="signature-invalid-sign">
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="finish-cell"></tr>
|
||||||
|
</table>
|
|
@ -1090,7 +1090,6 @@ define([
|
||||||
|
|
||||||
template: _.template([
|
template: _.template([
|
||||||
'<label style="font-size: 18px;"><%= scope.strProtect %></label>',
|
'<label style="font-size: 18px;"><%= scope.strProtect %></label>',
|
||||||
'<button id="fms-btn-final" class="btn btn-text-default" style="min-width:100px;"><%= scope.strMarkAsFinal %></button>',
|
|
||||||
'<button id="fms-btn-invisible-sign" class="btn btn-text-default" style="min-width:190px;"><%= scope.strInvisibleSign %></button>',
|
'<button id="fms-btn-invisible-sign" class="btn btn-text-default" style="min-width:190px;"><%= scope.strInvisibleSign %></button>',
|
||||||
'<button id="fms-btn-visible-sign" class="btn btn-text-default" style="min-width:190px;"><%= scope.strVisibleSign %></button>',
|
'<button id="fms-btn-visible-sign" class="btn btn-text-default" style="min-width:190px;"><%= scope.strVisibleSign %></button>',
|
||||||
'<div id="id-fms-requested-sign"></div>',
|
'<div id="id-fms-requested-sign"></div>',
|
||||||
|
@ -1130,11 +1129,6 @@ define([
|
||||||
render: function() {
|
render: function() {
|
||||||
$(this.el).html(this.template({scope: this}));
|
$(this.el).html(this.template({scope: this}));
|
||||||
|
|
||||||
this.btnFinal = new Common.UI.Button({
|
|
||||||
el: '#fms-btn-final'
|
|
||||||
});
|
|
||||||
this.btnFinal.on('click', _.bind(this.markAsFinal, this));
|
|
||||||
|
|
||||||
this.btnAddInvisibleSign = new Common.UI.Button({
|
this.btnAddInvisibleSign = new Common.UI.Button({
|
||||||
el: '#fms-btn-invisible-sign'
|
el: '#fms-btn-invisible-sign'
|
||||||
});
|
});
|
||||||
|
@ -1173,9 +1167,6 @@ define([
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
markAsFinal: function() {
|
|
||||||
},
|
|
||||||
|
|
||||||
addInvisibleSign: function() {
|
addInvisibleSign: function() {
|
||||||
if (this.menu)
|
if (this.menu)
|
||||||
this.menu.fireEvent('signature:invisible', [this.menu]);
|
this.menu.fireEvent('signature:invisible', [this.menu]);
|
||||||
|
@ -1208,7 +1199,6 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
strProtect: 'Protect Document',
|
strProtect: 'Protect Document',
|
||||||
strMarkAsFinal: 'Mark as final',
|
|
||||||
strInvisibleSign: 'Add invisible digital signature',
|
strInvisibleSign: 'Add invisible digital signature',
|
||||||
strVisibleSign: 'Add visible signature',
|
strVisibleSign: 'Add visible signature',
|
||||||
strRequested: 'Requested signatures',
|
strRequested: 'Requested signatures',
|
||||||
|
|
|
@ -57,6 +57,7 @@ define([
|
||||||
'documenteditor/main/app/view/ShapeSettings',
|
'documenteditor/main/app/view/ShapeSettings',
|
||||||
'documenteditor/main/app/view/MailMergeSettings',
|
'documenteditor/main/app/view/MailMergeSettings',
|
||||||
'documenteditor/main/app/view/TextArtSettings',
|
'documenteditor/main/app/view/TextArtSettings',
|
||||||
|
'documenteditor/main/app/view/SignatureSettings',
|
||||||
'common/main/lib/component/Scroller'
|
'common/main/lib/component/Scroller'
|
||||||
], function (menuTemplate, $, _, Backbone) {
|
], function (menuTemplate, $, _, Backbone) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -194,6 +195,21 @@ define([
|
||||||
this.mergeSettings = new DE.Views.MailMergeSettings();
|
this.mergeSettings = new DE.Views.MailMergeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode && mode.isDesktopApp) {
|
||||||
|
this.btnSignature = new Common.UI.Button({
|
||||||
|
hint: this.txtSignatureSettings,
|
||||||
|
asctype: Common.Utils.documentSettingsType.Signature,
|
||||||
|
enableToggle: true,
|
||||||
|
disabled: true,
|
||||||
|
toggleGroup: 'tabpanelbtnsGroup'
|
||||||
|
});
|
||||||
|
this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature};
|
||||||
|
|
||||||
|
this.btnSignature.el = $('#id-right-menu-signature'); this.btnSignature.render().setVisible(true);
|
||||||
|
this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this));
|
||||||
|
this.signatureSettings = new DE.Views.SignatureSettings();
|
||||||
|
}
|
||||||
|
|
||||||
if (_.isUndefined(this.scroller)) {
|
if (_.isUndefined(this.scroller)) {
|
||||||
this.scroller = new Common.UI.Scroller({
|
this.scroller = new Common.UI.Scroller({
|
||||||
el: $(this.el).find('.right-panel'),
|
el: $(this.el).find('.right-panel'),
|
||||||
|
@ -223,6 +239,7 @@ define([
|
||||||
this.shapeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
this.shapeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
||||||
this.textartSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
this.textartSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
||||||
if (this.mergeSettings) this.mergeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
if (this.mergeSettings) this.mergeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
||||||
|
if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _.bind( fire, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
|
@ -303,6 +320,7 @@ define([
|
||||||
txtShapeSettings: 'Shape Settings',
|
txtShapeSettings: 'Shape Settings',
|
||||||
txtTextArtSettings: 'Text Art Settings',
|
txtTextArtSettings: 'Text Art Settings',
|
||||||
txtChartSettings: 'Chart Settings',
|
txtChartSettings: 'Chart Settings',
|
||||||
txtMailMergeSettings: 'Mail Merge Settings'
|
txtMailMergeSettings: 'Mail Merge Settings',
|
||||||
|
txtSignatureSettings: 'Signature Settings'
|
||||||
}, DE.Views.RightMenu || {}));
|
}, DE.Views.RightMenu || {}));
|
||||||
});
|
});
|
282
apps/documenteditor/main/app/view/SignatureSettings.js
Normal file
282
apps/documenteditor/main/app/view/SignatureSettings.js
Normal file
|
@ -0,0 +1,282 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System Limited 2010-2017
|
||||||
|
*
|
||||||
|
* This program is a free software product. You can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||||
|
* version 3 as published by the Free Software Foundation. In accordance with
|
||||||
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||||
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||||
|
* of any third-party rights.
|
||||||
|
*
|
||||||
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||||
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
*
|
||||||
|
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||||
|
* EU, LV-1021.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of the Program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU AGPL version 3.
|
||||||
|
*
|
||||||
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||||
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||||
|
* grant you any rights under trademark law for use of our trademarks.
|
||||||
|
*
|
||||||
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||||
|
* well as technical writing content are licensed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||||
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* SignatureSettings.js
|
||||||
|
*
|
||||||
|
* Created by Julia Radzhabova on 5/24/17
|
||||||
|
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'text!documenteditor/main/app/template/SignatureSettings.template',
|
||||||
|
'jquery',
|
||||||
|
'underscore',
|
||||||
|
'backbone',
|
||||||
|
'common/main/lib/component/Button',
|
||||||
|
'documenteditor/main/app/view/SignSettingsDialog',
|
||||||
|
'documenteditor/main/app/view/SignDialog'
|
||||||
|
], function (menuTemplate, $, _, Backbone) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
DE.Views.SignatureSettings = Backbone.View.extend(_.extend({
|
||||||
|
el: '#id-signature-settings',
|
||||||
|
|
||||||
|
// Compile our stats template
|
||||||
|
template: _.template(menuTemplate),
|
||||||
|
|
||||||
|
// Delegated events for creating new items, and clearing completed ones.
|
||||||
|
events: {
|
||||||
|
},
|
||||||
|
|
||||||
|
options: {
|
||||||
|
alias: 'SignatureSettings'
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
this._initSettings = true;
|
||||||
|
|
||||||
|
this._state = {
|
||||||
|
DisabledControls: false,
|
||||||
|
requestedSignatures: undefined,
|
||||||
|
validSignatures: undefined,
|
||||||
|
invalidSignatures: undefined
|
||||||
|
};
|
||||||
|
this._locked = false;
|
||||||
|
this.lockedControls = [];
|
||||||
|
|
||||||
|
this._noApply = false;
|
||||||
|
this._originalProps = null;
|
||||||
|
|
||||||
|
this.templateRequested = _.template([
|
||||||
|
'<td class="padding-large <% if (signatures.length<1) { %>hidden<% } %>">',
|
||||||
|
'<table class="<% if (signatures.length<1) { %>hidden<% } %>" style="width:100%">',
|
||||||
|
'<tr><td colspan="2" class="padding-large"><label class="header"><%= header %></label></td></tr>',
|
||||||
|
'<% _.each(signatures, function(item) { %>',
|
||||||
|
'<tr>',
|
||||||
|
'<td style="padding-bottom: 3px;"><label style="overflow: hidden; max-height: 15px;"><%= Common.Utils.String.htmlEncode(item.name) %></label></td>',
|
||||||
|
'<td style="padding: 0 5px; vertical-align: top; text-align: right;"><label class="link-solid signature-sign-link" data-value="<%= item.guid %>">' + this.strSign + '</label></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<% }); %>',
|
||||||
|
'</table>',
|
||||||
|
'</td>'
|
||||||
|
].join(''));
|
||||||
|
|
||||||
|
this.templateValid = _.template([
|
||||||
|
'<td class="padding-large <% if (signatures.length<1) { %>hidden<% } %>"">',
|
||||||
|
'<table class="<% if (signatures.length<1) { %>hidden<% } %>" style="width:100%">',
|
||||||
|
'<tr><td colspan="2" class="padding-large"><label class="header"><%= header %></label></td></tr>',
|
||||||
|
'<% _.each(signatures, function(item) { %>',
|
||||||
|
'<tr>',
|
||||||
|
'<td><div style="overflow: hidden; max-height: 15px;"><%= Common.Utils.String.htmlEncode(item.name) %></div></td>',
|
||||||
|
'<td rowspan="2" style="padding: 0 5px; vertical-align: top; text-align: right;"><label class="link-solid signature-view-link" data-value="<%= item.guid %>">' + this.strView + '</label></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr><td style="padding-bottom: 3px;"><%= Common.Utils.String.htmlEncode(item.date) %></td></tr>',
|
||||||
|
'<% }); %>',
|
||||||
|
'</table>',
|
||||||
|
'</td>'
|
||||||
|
].join(''));
|
||||||
|
|
||||||
|
this.render();
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function () {
|
||||||
|
this.$el.html(this.template({
|
||||||
|
scope: this
|
||||||
|
}));
|
||||||
|
|
||||||
|
this.btnAddInvisibleSign = new Common.UI.Button({
|
||||||
|
el: this.$el.find('#signature-invisible-sign')
|
||||||
|
});
|
||||||
|
this.btnAddInvisibleSign.on('click', _.bind(this.addInvisibleSign, this));
|
||||||
|
this.lockedControls.push(this.btnAddInvisibleSign);
|
||||||
|
|
||||||
|
this.btnAddVisibleSign = new Common.UI.Button({
|
||||||
|
el: this.$el.find('#signature-visible-sign')
|
||||||
|
});
|
||||||
|
this.btnAddVisibleSign.on('click', _.bind(this.addVisibleSign, this));
|
||||||
|
this.lockedControls.push(this.btnAddVisibleSign);
|
||||||
|
|
||||||
|
this.cntRequestedSign = $('#signature-requested-sign');
|
||||||
|
this.cntValidSign = $('#signature-valid-sign');
|
||||||
|
this.cntInvalidSign = $('#signature-invalid-sign');
|
||||||
|
},
|
||||||
|
|
||||||
|
setApi: function(api) {
|
||||||
|
this.api = api;
|
||||||
|
if (this.api) {
|
||||||
|
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onUpdateSignatures, this));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
createDelayedControls: function() {
|
||||||
|
this._initSettings = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
ChangeSettings: function(props) {
|
||||||
|
if (this._initSettings)
|
||||||
|
this.createDelayedControls();
|
||||||
|
|
||||||
|
if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures) {
|
||||||
|
this.onUpdateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setLocked: function (locked) {
|
||||||
|
this._locked = locked;
|
||||||
|
},
|
||||||
|
|
||||||
|
disableControls: function(disable) {
|
||||||
|
if (this._initSettings) return;
|
||||||
|
|
||||||
|
if (this._state.DisabledControls!==disable) {
|
||||||
|
this._state.DisabledControls = disable;
|
||||||
|
_.each(this.lockedControls, function(item) {
|
||||||
|
item.setDisabled(disable);
|
||||||
|
});
|
||||||
|
this.$linksSign.toggleClass('disabled', disable);
|
||||||
|
this.$linksView.toggleClass('disabled', disable);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setMode: function(mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
},
|
||||||
|
|
||||||
|
onUpdateSignatures: function(valid, requested){
|
||||||
|
var me = this;
|
||||||
|
me._state.requestedSignatures = [];
|
||||||
|
me._state.validSignatures = [];
|
||||||
|
me._state.invalidSignatures = [];
|
||||||
|
|
||||||
|
_.each(requested, function(item, index){
|
||||||
|
me._state.requestedSignatures.push({name: item.asc_getSigner1(), guid: item.asc_getGuid()});
|
||||||
|
});
|
||||||
|
_.each(valid, function(item, index){
|
||||||
|
var sign = {name: item.asc_getSigner1(), guid: item.asc_getGuid(), date: '18/05/2017'};
|
||||||
|
(item.asc_getValid()==0) ? me._state.validSignatures.push(sign) : me._state.invalidSignatures.push(sign);
|
||||||
|
});
|
||||||
|
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.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.$linksView = $('.signature-view-link', this.$el);
|
||||||
|
this.$el.on('click', '.signature-sign-link', _.bind(this.onSign, this));
|
||||||
|
this.$el.on('click', '.signature-view-link', _.bind(this.onViewSignature, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
addVisibleSign: function(btn) {
|
||||||
|
var me = this,
|
||||||
|
win = new DE.Views.SignSettingsDialog({
|
||||||
|
handler: function(dlg, result) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
me.api.asc_AddSignatureLine2(dlg.getSettings());
|
||||||
|
}
|
||||||
|
me.fireEvent('editcomplete', me);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
win.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
addInvisibleSign: function(btn) {
|
||||||
|
var me = this,
|
||||||
|
win = new DE.Views.SignDialog({
|
||||||
|
api: me.api,
|
||||||
|
signType: 'invisible',
|
||||||
|
handler: function(dlg, result) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
var props = dlg.getSettings();
|
||||||
|
me.api.asc_Sign(props.certificateId);
|
||||||
|
}
|
||||||
|
me.fireEvent('editcomplete', me);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
win.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
onSign: function(event) {
|
||||||
|
var me = this,
|
||||||
|
guid = $(event.currentTarget).attr('data-value');
|
||||||
|
|
||||||
|
if (_.isUndefined(me.fontStore)) {
|
||||||
|
me.fontStore = new Common.Collections.Fonts();
|
||||||
|
var fonts = DE.getController('Toolbar').getView('Toolbar').cmbFontName.store.toJSON();
|
||||||
|
var arr = [];
|
||||||
|
_.each(fonts, function(font, index){
|
||||||
|
if (!font.cloneid) {
|
||||||
|
arr.push(_.clone(font));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
me.fontStore.add(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
var win = new DE.Views.SignDialog({
|
||||||
|
api: me.api,
|
||||||
|
signType: 'visible',
|
||||||
|
fontStore: me.fontStore,
|
||||||
|
handler: function(dlg, result) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
var props = dlg.getSettings();
|
||||||
|
me.api.asc_Sign(props.certificateId, guid, props.images[0], props.images[1]);
|
||||||
|
}
|
||||||
|
me.fireEvent('editcomplete', me);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
win.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
onViewSignature: function(guid) {
|
||||||
|
var guid = $(event.currentTarget).attr('data-value');
|
||||||
|
this.api.asc_ViewCertificate(guid);
|
||||||
|
},
|
||||||
|
|
||||||
|
strSignature: 'Signature',
|
||||||
|
strInvisibleSign: 'Add invisible digital signature',
|
||||||
|
strVisibleSign: 'Add visible signature',
|
||||||
|
strRequested: 'Requested signatures',
|
||||||
|
strValid: 'Valid signatures',
|
||||||
|
strInvalid: 'Invalid signatures',
|
||||||
|
strSign: 'Sign',
|
||||||
|
strView: 'View'
|
||||||
|
|
||||||
|
}, DE.Views.SignatureSettings || {}));
|
||||||
|
});
|
|
@ -105,6 +105,7 @@
|
||||||
|
|
||||||
/*menuTextArt*/
|
/*menuTextArt*/
|
||||||
.button-normal-icon(btn-menu-textart, 54, @toolbar-icon-size);
|
.button-normal-icon(btn-menu-textart, 54, @toolbar-icon-size);
|
||||||
|
.button-normal-icon(btn-menu-signature, 54, @toolbar-icon-size);
|
||||||
|
|
||||||
.button-otherstates-icon2(btn-category, @toolbar-icon-size);
|
.button-otherstates-icon2(btn-category, @toolbar-icon-size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue