[DE] Refactoring signature settings in the right and left panels.
This commit is contained in:
parent
7d75359ff4
commit
ceb0cd4b5e
|
@ -91,6 +91,7 @@ define([
|
||||||
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));
|
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onApiSignatureClick, this));
|
||||||
|
Common.NotificationCenter.on('protect:sign', _.bind(this.onApiSignatureClick, this));
|
||||||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +146,7 @@ define([
|
||||||
|
|
||||||
onAppReady: function (config) {
|
onAppReady: function (config) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
// this.onApiUpdateSignatures([{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}]);
|
||||||
},
|
},
|
||||||
|
|
||||||
addPassword: function() {
|
addPassword: function() {
|
||||||
|
|
|
@ -202,7 +202,11 @@ define([
|
||||||
|
|
||||||
getButton: function(type, parent) {
|
getButton: function(type, parent) {
|
||||||
if ( type == 'signature' ) {
|
if ( type == 'signature' ) {
|
||||||
var button = new Common.UI.Button({});
|
var button = new Common.UI.Button({
|
||||||
|
cls: 'btn-text-default',
|
||||||
|
style: 'width: 100%;',
|
||||||
|
caption: this.txtInvisibleSignature
|
||||||
|
});
|
||||||
this.btnsInvisibleSignature.push(button);
|
this.btnsInvisibleSignature.push(button);
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
define([
|
define([
|
||||||
'core',
|
'core',
|
||||||
'common/main/lib/util/Shortcuts',
|
'common/main/lib/util/Shortcuts',
|
||||||
'common/main/lib/view/SignSettingsDialog',
|
|
||||||
'common/main/lib/view/SignDialog',
|
|
||||||
'documenteditor/main/app/view/LeftMenu',
|
'documenteditor/main/app/view/LeftMenu',
|
||||||
'documenteditor/main/app/view/FileMenu'
|
'documenteditor/main/app/view/FileMenu'
|
||||||
], function () {
|
], function () {
|
||||||
|
@ -87,9 +85,7 @@ define([
|
||||||
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
||||||
'settings:apply': _.bind(this.applySettings, this),
|
'settings:apply': _.bind(this.applySettings, this),
|
||||||
'create:new': _.bind(this.onCreateNew, this),
|
'create:new': _.bind(this.onCreateNew, this),
|
||||||
'recent:open': _.bind(this.onOpenRecent, this),
|
'recent:open': _.bind(this.onOpenRecent, this)
|
||||||
'signature:visible': _.bind(this.addVisibleSign, this),
|
|
||||||
'signature:invisible': _.bind(this.addInvisibleSign, this)
|
|
||||||
},
|
},
|
||||||
'Toolbar': {
|
'Toolbar': {
|
||||||
'file:settings': _.bind(this.clickToolbarSettings,this),
|
'file:settings': _.bind(this.clickToolbarSettings,this),
|
||||||
|
@ -680,41 +676,6 @@ define([
|
||||||
Common.Gateway.requestHistory();
|
Common.Gateway.requestHistory();
|
||||||
},
|
},
|
||||||
|
|
||||||
addVisibleSign: function(menu) {
|
|
||||||
var me = this,
|
|
||||||
win = new Common.Views.SignSettingsDialog({
|
|
||||||
handler: function(dlg, result) {
|
|
||||||
if (result == 'ok') {
|
|
||||||
me.api.asc_AddSignatureLine2(dlg.getSettings());
|
|
||||||
}
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
win.show();
|
|
||||||
|
|
||||||
menu.hide();
|
|
||||||
},
|
|
||||||
|
|
||||||
addInvisibleSign: function(menu) {
|
|
||||||
var me = this,
|
|
||||||
win = new Common.Views.SignDialog({
|
|
||||||
api: me.api,
|
|
||||||
signType: 'invisible',
|
|
||||||
handler: function(dlg, result) {
|
|
||||||
if (result == 'ok') {
|
|
||||||
var props = dlg.getSettings();
|
|
||||||
me.api.asc_Sign(props.certificateId);
|
|
||||||
}
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
win.show();
|
|
||||||
|
|
||||||
menu.hide();
|
|
||||||
},
|
|
||||||
|
|
||||||
textNoTextFound : 'Text not found',
|
textNoTextFound : 'Text not found',
|
||||||
newDocumentTitle : 'Unnamed document',
|
newDocumentTitle : 'Unnamed document',
|
||||||
requestEditRightsText : 'Requesting editing rights...',
|
requestEditRightsText : 'Requesting editing rights...',
|
||||||
|
|
|
@ -79,7 +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: (rightMenu.signatureSettings) ? 0 : 1, props: {}, locked: false};
|
this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false};
|
||||||
},
|
},
|
||||||
|
|
||||||
setApi: function(api) {
|
setApi: function(api) {
|
||||||
|
@ -270,6 +270,11 @@ define([
|
||||||
this.rightmenu.mergeSettings.setDocumentName(this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption());
|
this.rightmenu.mergeSettings.setDocumentName(this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption());
|
||||||
this.api.asc_registerCallback('asc_onStartMailMerge', _.bind(this.onStartMailMerge, this));
|
this.api.asc_registerCallback('asc_onStartMailMerge', _.bind(this.onStartMailMerge, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.rightmenu.signatureSettings) {
|
||||||
|
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
||||||
|
}
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +285,9 @@ 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) {
|
||||||
|
@ -325,6 +333,14 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onApiUpdateSignatures: function(valid, requested){
|
||||||
|
var disabled = (!valid || valid.length<1) && (!requested || requested.length<1),
|
||||||
|
type = Common.Utils.documentSettingsType.Signature;
|
||||||
|
this._settings[type].hidden = disabled ? 1 : 0;
|
||||||
|
this._settings[type].btn.setDisabled(disabled);
|
||||||
|
this._settings[type].panel.setLocked(this._settings[type].locked);
|
||||||
|
},
|
||||||
|
|
||||||
SetDisabled: function(disabled, allowMerge, allowSignature) {
|
SetDisabled: function(disabled, allowMerge, allowSignature) {
|
||||||
this.setMode({isEdit: !disabled});
|
this.setMode({isEdit: !disabled});
|
||||||
if (this.rightmenu) {
|
if (this.rightmenu) {
|
||||||
|
|
|
@ -4,14 +4,9 @@
|
||||||
<label style="font-size: 18px;"><%= scope.strSignature %></label>
|
<label style="font-size: 18px;"><%= scope.strSignature %></label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td class="padding-large">
|
<td class="padding-large">
|
||||||
<button id="signature-visible-sign" class="btn btn-text-default" style="width:100%;"><%= scope.strVisibleSign %></button>
|
<div id="signature-invisible-sign" style="width:100%;"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="signature-requested-sign">
|
<tr id="signature-requested-sign">
|
||||||
|
|
|
@ -240,7 +240,7 @@ define([
|
||||||
applyMode: function() {
|
applyMode: function() {
|
||||||
this.miPrint[this.mode.canPrint?'show':'hide']();
|
this.miPrint[this.mode.canPrint?'show':'hide']();
|
||||||
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
|
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
|
||||||
this.items[7][(this.mode.canProtect) ?'show':'hide']();
|
this.items[7][(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide']();
|
||||||
this.items[7].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
|
this.items[7].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
|
||||||
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
|
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
|
||||||
this.miNew[this.mode.canCreateNew?'show':'hide']();
|
this.miNew[this.mode.canCreateNew?'show':'hide']();
|
||||||
|
@ -277,7 +277,7 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mode.canProtect) {
|
if (this.mode.isDesktopApp && this.mode.isOffline) {
|
||||||
// this.$el.find('#fm-btn-back').hide();
|
// this.$el.find('#fm-btn-back').hide();
|
||||||
this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
|
this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
|
||||||
this.panels['protect'].setMode(this.mode);
|
this.panels['protect'].setMode(this.mode);
|
||||||
|
|
|
@ -1103,12 +1103,12 @@ define([
|
||||||
menu: undefined,
|
menu: undefined,
|
||||||
|
|
||||||
template: _.template([
|
template: _.template([
|
||||||
'<label id="id-fms-lbl-sign-header" style="font-size: 18px;"><%= scope.strProtect %></label>',
|
'<label id="id-fms-lbl-protect-header" style="font-size: 18px;"><%= scope.strProtect %></label>',
|
||||||
'<button id="fms-btn-invisible-sign" class="btn btn-text-default" style="min-width:190px;"><%= scope.strInvisibleSign %></button>',
|
'<div id="id-fms-signature">',
|
||||||
'<button id="fms-btn-visible-sign" class="btn btn-text-default" style="min-width:190px;"><%= scope.strVisibleSign %></button>',
|
'<label class="header"><%= scope.strSignature %></label>',
|
||||||
'<div id="id-fms-requested-sign"></div>',
|
'<div id="fms-btn-invisible-sign" style="width:190px; margin-top: 10px;margin-bottom: 20px;"></div>',
|
||||||
'<div id="id-fms-valid-sign"></div>',
|
'<div id="id-fms-signature-view"></div>',
|
||||||
'<div id="id-fms-invalid-sign"></div>'
|
'</div>'
|
||||||
].join('')),
|
].join('')),
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
@ -1116,26 +1116,16 @@ define([
|
||||||
|
|
||||||
this.menu = options.menu;
|
this.menu = options.menu;
|
||||||
|
|
||||||
this.templateRequested = _.template([
|
var me = this;
|
||||||
'<label class="header <% if (signatures.length<1) { %>hidden<% } %>"><%= header %></label>',
|
this.templateSignature = _.template([
|
||||||
'<table>',
|
'<table cols="2" width="300" class="<% if (!hasRequested && !hasSigned) { %>hidden<% } %>"">',
|
||||||
'<% _.each(signatures, function(item) { %>',
|
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td><%= Common.Utils.String.htmlEncode(item) %></td>',
|
'<td colspan="2"><span><%= tipText %></span></td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'<% }); %>',
|
|
||||||
'</table>'
|
|
||||||
].join(''));
|
|
||||||
|
|
||||||
this.templateValid = _.template([
|
|
||||||
'<label class="header <% if (signatures.length<1) { %>hidden<% } %>"><%= header %></label>',
|
|
||||||
'<table>',
|
|
||||||
'<% _.each(signatures, function(item) { %>',
|
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td><%= Common.Utils.String.htmlEncode(item.name) %></td>',
|
'<td><label class="link signature-view-link">' + me.txtView + '</label></td>',
|
||||||
'<td><%= Common.Utils.String.htmlEncode(item.date) %></td>',
|
'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>">' + me.txtEdit + '</label></td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'<% }); %>',
|
|
||||||
'</table>'
|
'</table>'
|
||||||
].join(''));
|
].join(''));
|
||||||
},
|
},
|
||||||
|
@ -1143,22 +1133,13 @@ define([
|
||||||
render: function() {
|
render: function() {
|
||||||
$(this.el).html(this.template({scope: this}));
|
$(this.el).html(this.template({scope: this}));
|
||||||
|
|
||||||
this.btnAddInvisibleSign = new Common.UI.Button({
|
var protection = DE.getController('Common.Controllers.Protection').getView();
|
||||||
el: '#fms-btn-invisible-sign'
|
this.btnAddInvisibleSign = protection.getButton('signature');
|
||||||
});
|
this.btnAddInvisibleSign.render(this.$el.find('#fms-btn-invisible-sign'));
|
||||||
this.btnAddInvisibleSign.on('click', _.bind(this.addInvisibleSign, this));
|
this.btnAddInvisibleSign.on('click', _.bind(this.closeMenu, this));
|
||||||
|
|
||||||
this.btnAddVisibleSign = new Common.UI.Button({
|
|
||||||
el: '#fms-btn-visible-sign'
|
|
||||||
});
|
|
||||||
this.btnAddVisibleSign.on('click', _.bind(this.addVisibleSign, this));
|
|
||||||
|
|
||||||
this.lblSignHeader = $('#id-fms-lbl-sign-header', this.$el);
|
|
||||||
|
|
||||||
this.cntRequestedSign = $('#id-fms-requested-sign');
|
|
||||||
this.cntValidSign = $('#id-fms-valid-sign');
|
|
||||||
this.cntInvalidSign = $('#id-fms-invalid-sign');
|
|
||||||
|
|
||||||
|
this.cntSignature = $('#id-fms-signature');
|
||||||
|
this.cntSignatureView = $('#id-fms-signature-view');
|
||||||
if (_.isUndefined(this.scroller)) {
|
if (_.isUndefined(this.scroller)) {
|
||||||
this.scroller = new Common.UI.Scroller({
|
this.scroller = new Common.UI.Scroller({
|
||||||
el: $(this.el),
|
el: $(this.el),
|
||||||
|
@ -1166,6 +1147,9 @@ define([
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$el.on('click', '.signature-edit-link', _.bind(this.onEdit, this));
|
||||||
|
this.$el.on('click', '.signature-view-link', _.bind(this.onView, this));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1176,11 +1160,7 @@ define([
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
if (!this.mode.isEdit) {
|
this.cntSignature.toggleClass('hidden', !this.mode.canProtect);
|
||||||
this.btnAddInvisibleSign.setVisible(false);
|
|
||||||
this.btnAddVisibleSign.setVisible(false);
|
|
||||||
this.lblSignHeader.html(this.strSignature);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setApi: function(o) {
|
setApi: function(o) {
|
||||||
|
@ -1188,49 +1168,67 @@ define([
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
addInvisibleSign: function() {
|
closeMenu: function() {
|
||||||
if (this.menu)
|
this.menu && this.menu.hide();
|
||||||
this.menu.fireEvent('signature:invisible', [this.menu]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addVisibleSign: function() {
|
onEdit: function() {
|
||||||
if (this.menu)
|
this.menu && this.menu.hide();
|
||||||
this.menu.fireEvent('signature:visible', [this.menu]);
|
|
||||||
|
var me = this;
|
||||||
|
Common.UI.warning({
|
||||||
|
title: this.notcriticalErrorTitle,
|
||||||
|
msg: this.txtEditWarning,
|
||||||
|
buttons: ['ok', 'cancel'],
|
||||||
|
primary: 'ok',
|
||||||
|
callback: function(btn) {
|
||||||
|
if (btn == 'ok') {
|
||||||
|
// me.api.editSignedDoc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onView: function() {
|
||||||
|
|
||||||
|
this.menu && this.menu.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSignatures: function(){
|
updateSignatures: function(){
|
||||||
var requested = this.api.asc_getRequestSignatures(),
|
var requested = this.api.asc_getRequestSignatures(),
|
||||||
requested_arr = [],
|
|
||||||
valid = this.api.asc_getSignatures(),
|
valid = this.api.asc_getSignatures(),
|
||||||
valid_arr = [], invalid_arr = [];
|
hasRequested = requested && requested.length>0,
|
||||||
|
hasValid = false,
|
||||||
|
hasInvalid = false;
|
||||||
|
|
||||||
_.each(requested, function(item, index){
|
|
||||||
requested_arr.push(item.asc_getSigner1());
|
|
||||||
});
|
|
||||||
_.each(valid, function(item, index){
|
_.each(valid, function(item, index){
|
||||||
var sign = {name: item.asc_getSigner1(), date: '18/05/2017'};
|
if (item.asc_getValid()==0)
|
||||||
(item.asc_getValid()==0) ? valid_arr.push(sign) : invalid_arr.push(sign);
|
hasValid = true;
|
||||||
|
else
|
||||||
|
hasInvalid = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// requested_arr = ['Hammish Mitchell', 'Someone Somewhere', 'Mary White', 'John Black'];
|
// hasRequested = true;
|
||||||
// valid_arr = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
|
// hasValid = true;
|
||||||
// invalid_arr = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
|
// hasInvalid = true;
|
||||||
|
|
||||||
this.cntRequestedSign.html(this.templateRequested({signatures: requested_arr, header: this.strRequested}));
|
var tipText = (hasInvalid) ? this.txtSignedInvalid : (hasValid ? this.txtSigned : "");
|
||||||
this.cntValidSign.html(this.templateValid({signatures: valid_arr, header: this.strValid}));
|
if (hasRequested)
|
||||||
this.cntInvalidSign.html(this.templateValid({signatures: invalid_arr, header: this.strInvalid}));
|
tipText = this.txtRequestedSignatures + (tipText!="" ? "<br><br>" : "")+ tipText;
|
||||||
|
|
||||||
this.btnAddInvisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
this.cntSignatureView.html(this.templateSignature({tipText: tipText, hasSigned: (hasValid || hasInvalid), hasRequested: hasRequested}));
|
||||||
this.btnAddVisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
strProtect: 'Protect Document',
|
strProtect: 'Protect Document',
|
||||||
strInvisibleSign: 'Add invisible digital signature',
|
strSignature: 'Signature',
|
||||||
strVisibleSign: 'Add visible signature',
|
txtView: 'View signatures',
|
||||||
strRequested: 'Requested signatures',
|
txtEdit: 'Edit document',
|
||||||
strValid: 'Valid signatures',
|
txtSigned: 'Valid signatures has been added to the document. The document is protected from editing.',
|
||||||
strInvalid: 'Invalid signatures',
|
txtSignedInvalid: 'Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.',
|
||||||
strSignature: 'Signature'
|
txtRequestedSignatures: 'This document needs to be signed.',
|
||||||
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
txtEditWarning: 'Editing will remove the signatures from the document.<br>Are you sure you want to continue?'
|
||||||
|
|
||||||
}, DE.Views.FileMenuPanels.ProtectDoc || {}));
|
}, DE.Views.FileMenuPanels.ProtectDoc || {}));
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,6 @@ define([
|
||||||
ready: false
|
ready: false
|
||||||
};
|
};
|
||||||
this._locked = false;
|
this._locked = false;
|
||||||
this.lockedControls = [];
|
|
||||||
|
|
||||||
this._noApply = false;
|
this._noApply = false;
|
||||||
this._originalProps = null;
|
this._originalProps = null;
|
||||||
|
|
||||||
|
@ -118,17 +116,9 @@ define([
|
||||||
scope: this
|
scope: this
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.btnAddInvisibleSign = new Common.UI.Button({
|
var protection = DE.getController('Common.Controllers.Protection').getView();
|
||||||
el: this.$el.find('#signature-invisible-sign')
|
this.btnAddInvisibleSign = protection.getButton('signature');
|
||||||
});
|
this.btnAddInvisibleSign.render(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.cntRequestedSign = $('#signature-requested-sign');
|
||||||
this.cntValidSign = $('#signature-valid-sign');
|
this.cntValidSign = $('#signature-valid-sign');
|
||||||
|
@ -164,16 +154,6 @@ define([
|
||||||
this.$linksSign && this.$linksSign.toggleClass('disabled', disable);
|
this.$linksSign && this.$linksSign.toggleClass('disabled', disable);
|
||||||
this.$linksView && this.$linksView.toggleClass('disabled', disable);
|
this.$linksView && this.$linksView.toggleClass('disabled', disable);
|
||||||
}
|
}
|
||||||
this.disableInsertControls(disable);
|
|
||||||
},
|
|
||||||
|
|
||||||
disableInsertControls: function(disable) {
|
|
||||||
if (this._state.DisabledInsertControls!==disable) {
|
|
||||||
this._state.DisabledInsertControls = disable;
|
|
||||||
_.each(this.lockedControls, function(item) {
|
|
||||||
item.setDisabled(disable);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
|
@ -184,7 +164,7 @@ define([
|
||||||
if (!this._state.ready) return;
|
if (!this._state.ready) return;
|
||||||
|
|
||||||
this.updateSignatures(valid, requested);
|
this.updateSignatures(valid, requested);
|
||||||
this.showSignatureTooltip(this._state.validSignatures.length>0 || this._state.invalidSignatures.length>0);
|
this.showSignatureTooltip(this._state.validSignatures.length>0, this._state.invalidSignatures.length>0);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSignatures: function(valid, requested){
|
updateSignatures: function(valid, requested){
|
||||||
|
@ -221,68 +201,11 @@ define([
|
||||||
me.disableEditing(me._state.validSignatures.length>0 || me._state.invalidSignatures.length>0);
|
me.disableEditing(me._state.validSignatures.length>0 || me._state.invalidSignatures.length>0);
|
||||||
},
|
},
|
||||||
|
|
||||||
addVisibleSign: function(btn) {
|
|
||||||
var me = this,
|
|
||||||
win = new Common.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 Common.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) {
|
onSign: function(event) {
|
||||||
var me = this,
|
var target = $(event.currentTarget);
|
||||||
target = $(event.currentTarget);
|
|
||||||
|
|
||||||
if (target.hasClass('disabled')) return;
|
if (target.hasClass('disabled')) return;
|
||||||
|
|
||||||
if (_.isUndefined(me.fontStore)) {
|
Common.NotificationCenter.trigger('protect:sign', target.attr('data-value'));
|
||||||
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 Common.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, target.attr('data-value'), props.images[0], props.images[1]);
|
|
||||||
}
|
|
||||||
me.fireEvent('editcomplete', me);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
win.show();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onViewSignature: function(event) {
|
onViewSignature: function(event) {
|
||||||
|
@ -296,25 +219,39 @@ define([
|
||||||
this._state.ready = true;
|
this._state.ready = true;
|
||||||
|
|
||||||
this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
|
this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
|
||||||
this.showSignatureTooltip(this._state.validSignatures.length>0 || this._state.invalidSignatures.length>0, this._state.requestedSignatures.length>0);
|
this.showSignatureTooltip(this._state.validSignatures.length>0, this._state.invalidSignatures.length>0, this._state.requestedSignatures.length>0);
|
||||||
},
|
},
|
||||||
|
|
||||||
showSignatureTooltip: function(hasSigned, hasRequested) {
|
showSignatureTooltip: function(hasValid, hasInvalid, hasRequested) {
|
||||||
if (!hasSigned && !hasRequested) return;
|
if (!hasValid && !hasInvalid && !hasRequested) return;
|
||||||
|
|
||||||
|
var tipText = (hasInvalid) ? this.txtSignedInvalid : (hasValid ? this.txtSigned : "");
|
||||||
|
if (hasRequested)
|
||||||
|
tipText = this.txtRequestedSignatures + "<br><br>" + tipText;
|
||||||
|
|
||||||
var me = this,
|
var me = this,
|
||||||
tip = new Common.UI.SynchronizeTip({
|
tip = new Common.UI.SynchronizeTip({
|
||||||
target : DE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
target : DE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
||||||
text : (hasSigned) ? this.txtSignedDocument : this.txtRequestedSignatures,
|
text : tipText,
|
||||||
showLink: hasSigned,
|
showLink: hasValid || hasInvalid,
|
||||||
textLink: this.txtContinueEditing,
|
textLink: this.txtContinueEditing,
|
||||||
placement: 'left'
|
placement: 'left'
|
||||||
});
|
});
|
||||||
tip.on({
|
tip.on({
|
||||||
'dontshowclick': function() {
|
'dontshowclick': function() {
|
||||||
|
Common.UI.warning({
|
||||||
|
title: me.notcriticalErrorTitle,
|
||||||
|
msg: me.txtEditWarning,
|
||||||
|
buttons: ['ok', 'cancel'],
|
||||||
|
primary: 'ok',
|
||||||
|
callback: function(btn) {
|
||||||
|
if (btn == 'ok') {
|
||||||
tip.close();
|
tip.close();
|
||||||
// me.api.editSingedDoc();
|
// me.api.editSignedDoc();
|
||||||
// me.disableEditing(false); // call in the asc_onUpdateSignatures event callback.
|
// me.disableEditing(false); // call in the asc_onUpdateSignatures event callback.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
'closeclick': function() {
|
'closeclick': function() {
|
||||||
tip.close();
|
tip.close();
|
||||||
|
@ -341,22 +278,21 @@ define([
|
||||||
var comments = DE.getController('Common.Controllers.Comments');
|
var comments = DE.getController('Common.Controllers.Comments');
|
||||||
if (comments)
|
if (comments)
|
||||||
comments.setPreviewMode(disable);
|
comments.setPreviewMode(disable);
|
||||||
|
|
||||||
this.disableInsertControls(disable);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
strSignature: 'Signature',
|
strSignature: 'Signature',
|
||||||
strInvisibleSign: 'Add invisible digital signature',
|
|
||||||
strVisibleSign: 'Add visible signature',
|
|
||||||
strRequested: 'Requested signatures',
|
strRequested: 'Requested signatures',
|
||||||
strValid: 'Valid signatures',
|
strValid: 'Valid signatures',
|
||||||
strInvalid: 'Invalid signatures',
|
strInvalid: 'Invalid signatures',
|
||||||
strSign: 'Sign',
|
strSign: 'Sign',
|
||||||
strView: 'View',
|
strView: 'View',
|
||||||
txtSignedDocument: 'This document has been signed. It should not be edited.',
|
txtSigned: 'Valid signatures has been added to the document. The document is protected from editing.',
|
||||||
txtRequestedSignatures: 'This document has requested signatures.',
|
txtSignedInvalid: 'Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.',
|
||||||
txtContinueEditing: 'Edit anyway'
|
txtRequestedSignatures: 'This document needs to be signed.',
|
||||||
|
txtContinueEditing: 'Edit anyway',
|
||||||
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
txtEditWarning: 'Editing will remove the signatures from the document.<br>Are you sure you want to continue?'
|
||||||
|
|
||||||
}, DE.Views.SignatureSettings || {}));
|
}, DE.Views.SignatureSettings || {}));
|
||||||
});
|
});
|
|
@ -1073,12 +1073,14 @@
|
||||||
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
|
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
|
||||||
"DE.Views.HeaderFooterSettings.textBottomRight": "Bottom right",
|
"DE.Views.HeaderFooterSettings.textBottomRight": "Bottom right",
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strProtect": "Protect Document",
|
"DE.Views.FileMenuPanels.ProtectDoc.strProtect": "Protect Document",
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strInvisibleSign": "Add invisible digital signature",
|
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strVisibleSign": "Add visible signature",
|
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strRequested": "Requested signatures",
|
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strValid": "Valid signatures",
|
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strInvalid": "Invalid signatures",
|
|
||||||
"DE.Views.FileMenuPanels.ProtectDoc.strSignature": "Signature",
|
"DE.Views.FileMenuPanels.ProtectDoc.strSignature": "Signature",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.txtView": "View signatures",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.txtEdit": "Edit document",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.txtSigned": "Valid signatures has been added to the document. The document is protected from editing.",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.txtSignedInvalid": "Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.txtRequestedSignatures": "This document needs to be signed.",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.notcriticalErrorTitle": "Warning",
|
||||||
|
"DE.Views.FileMenuPanels.ProtectDoc.txtEditWarning": "Editing will remove the signatures from the document.<br>Are you sure you want to continue?",
|
||||||
"DE.Views.HeaderFooterSettings.textDiffFirst": "Different first page",
|
"DE.Views.HeaderFooterSettings.textDiffFirst": "Different first page",
|
||||||
"DE.Views.HeaderFooterSettings.textDiffOdd": "Different odd and even pages",
|
"DE.Views.HeaderFooterSettings.textDiffOdd": "Different odd and even pages",
|
||||||
"DE.Views.HeaderFooterSettings.textHeaderFromBottom": "Footer from Bottom",
|
"DE.Views.HeaderFooterSettings.textHeaderFromBottom": "Footer from Bottom",
|
||||||
|
@ -1409,13 +1411,17 @@
|
||||||
"DE.Views.ShapeSettings.txtTopAndBottom": "Top and bottom",
|
"DE.Views.ShapeSettings.txtTopAndBottom": "Top and bottom",
|
||||||
"DE.Views.ShapeSettings.txtWood": "Wood",
|
"DE.Views.ShapeSettings.txtWood": "Wood",
|
||||||
"DE.Views.SignatureSettings.strSignature": "Signature",
|
"DE.Views.SignatureSettings.strSignature": "Signature",
|
||||||
"DE.Views.SignatureSettings.strInvisibleSign": "Add invisible digital signature",
|
|
||||||
"DE.Views.SignatureSettings.strVisibleSign": "Add visible signature",
|
|
||||||
"DE.Views.SignatureSettings.strRequested": "Requested signatures",
|
"DE.Views.SignatureSettings.strRequested": "Requested signatures",
|
||||||
"DE.Views.SignatureSettings.strValid": "Valid signatures",
|
"DE.Views.SignatureSettings.strValid": "Valid signatures",
|
||||||
"DE.Views.SignatureSettings.strInvalid": "Invalid signatures",
|
"DE.Views.SignatureSettings.strInvalid": "Invalid signatures",
|
||||||
"DE.Views.SignatureSettings.strSign": "Sign",
|
"DE.Views.SignatureSettings.strSign": "Sign",
|
||||||
"DE.Views.SignatureSettings.strView": "View",
|
"DE.Views.SignatureSettings.strView": "View",
|
||||||
|
"DE.Views.SignatureSettings.txtSigned": "Valid signatures has been added to the document. The document is protected from editing.",
|
||||||
|
"DE.Views.SignatureSettings.txtSignedInvalid": "Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.",
|
||||||
|
"DE.Views.SignatureSettings.txtRequestedSignatures": "This document needs to be signed.",
|
||||||
|
"DE.Views.SignatureSettings.txtContinueEditing": "Edit anyway",
|
||||||
|
"DE.Views.SignatureSettings.notcriticalErrorTitle": "Warning",
|
||||||
|
"DE.Views.SignatureSettings.txtEditWarning": "Editing will remove the signatures from the document.<br>Are you sure you want to continue?",
|
||||||
"DE.Views.Statusbar.goToPageText": "Go to Page",
|
"DE.Views.Statusbar.goToPageText": "Go to Page",
|
||||||
"DE.Views.Statusbar.pageIndexText": "Page {0} of {1}",
|
"DE.Views.Statusbar.pageIndexText": "Page {0} of {1}",
|
||||||
"DE.Views.Statusbar.tipFitPage": "Fit to page",
|
"DE.Views.Statusbar.tipFitPage": "Fit to page",
|
||||||
|
|
|
@ -370,3 +370,24 @@
|
||||||
font: 12px tahoma, arial, verdana, sans-serif;
|
font: 12px tahoma, arial, verdana, sans-serif;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#panel-protect {
|
||||||
|
label, span {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#file-menu-panel & {
|
||||||
|
padding: 30px 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 30px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
td {
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,31 +78,3 @@ button.notify .btn-menu-comments {background-position: -0*@toolbar-icon-size -60
|
||||||
-o-transform: rotate(180deg);
|
-o-transform: rotate(180deg);
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#panel-protect {
|
|
||||||
#file-menu-panel & {
|
|
||||||
padding: 30px 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
button {
|
|
||||||
display: block;
|
|
||||||
width: auto;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
font: 12px tahoma, arial, verdana, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
font-weight: bold;
|
|
||||||
margin: 30px 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
td {
|
|
||||||
padding: 5px 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue