[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));
|
||||
if (this.appConfig.canProtect) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +146,7 @@ define([
|
|||
|
||||
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'}]);
|
||||
},
|
||||
|
||||
addPassword: function() {
|
||||
|
|
|
@ -202,7 +202,11 @@ define([
|
|||
|
||||
getButton: function(type, parent) {
|
||||
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);
|
||||
|
||||
return button;
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
define([
|
||||
'core',
|
||||
'common/main/lib/util/Shortcuts',
|
||||
'common/main/lib/view/SignSettingsDialog',
|
||||
'common/main/lib/view/SignDialog',
|
||||
'documenteditor/main/app/view/LeftMenu',
|
||||
'documenteditor/main/app/view/FileMenu'
|
||||
], function () {
|
||||
|
@ -87,9 +85,7 @@ define([
|
|||
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
||||
'settings:apply': _.bind(this.applySettings, this),
|
||||
'create:new': _.bind(this.onCreateNew, this),
|
||||
'recent:open': _.bind(this.onOpenRecent, this),
|
||||
'signature:visible': _.bind(this.addVisibleSign, this),
|
||||
'signature:invisible': _.bind(this.addInvisibleSign, this)
|
||||
'recent:open': _.bind(this.onOpenRecent, this)
|
||||
},
|
||||
'Toolbar': {
|
||||
'file:settings': _.bind(this.clickToolbarSettings,this),
|
||||
|
@ -680,41 +676,6 @@ define([
|
|||
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',
|
||||
newDocumentTitle : 'Unnamed document',
|
||||
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.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.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) {
|
||||
|
@ -270,6 +270,11 @@ define([
|
|||
this.rightmenu.mergeSettings.setDocumentName(this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption());
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -280,6 +285,9 @@ define([
|
|||
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) {
|
||||
|
@ -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) {
|
||||
this.setMode({isEdit: !disabled});
|
||||
if (this.rightmenu) {
|
||||
|
|
|
@ -4,14 +4,9 @@
|
|||
<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>
|
||||
<div id="signature-invisible-sign" style="width:100%;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="signature-requested-sign">
|
||||
|
|
|
@ -240,7 +240,7 @@ define([
|
|||
applyMode: function() {
|
||||
this.miPrint[this.mode.canPrint?'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.miRecent[this.mode.canOpenRecent?'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.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
|
||||
this.panels['protect'].setMode(this.mode);
|
||||
|
|
|
@ -1103,12 +1103,12 @@ define([
|
|||
menu: undefined,
|
||||
|
||||
template: _.template([
|
||||
'<label id="id-fms-lbl-sign-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>',
|
||||
'<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-valid-sign"></div>',
|
||||
'<div id="id-fms-invalid-sign"></div>'
|
||||
'<label id="id-fms-lbl-protect-header" style="font-size: 18px;"><%= scope.strProtect %></label>',
|
||||
'<div id="id-fms-signature">',
|
||||
'<label class="header"><%= scope.strSignature %></label>',
|
||||
'<div id="fms-btn-invisible-sign" style="width:190px; margin-top: 10px;margin-bottom: 20px;"></div>',
|
||||
'<div id="id-fms-signature-view"></div>',
|
||||
'</div>'
|
||||
].join('')),
|
||||
|
||||
initialize: function(options) {
|
||||
|
@ -1116,26 +1116,16 @@ define([
|
|||
|
||||
this.menu = options.menu;
|
||||
|
||||
this.templateRequested = _.template([
|
||||
'<label class="header <% if (signatures.length<1) { %>hidden<% } %>"><%= header %></label>',
|
||||
'<table>',
|
||||
'<% _.each(signatures, function(item) { %>',
|
||||
var me = this;
|
||||
this.templateSignature = _.template([
|
||||
'<table cols="2" width="300" class="<% if (!hasRequested && !hasSigned) { %>hidden<% } %>"">',
|
||||
'<tr>',
|
||||
'<td><%= Common.Utils.String.htmlEncode(item) %></td>',
|
||||
'<td colspan="2"><span><%= tipText %></span></td>',
|
||||
'</tr>',
|
||||
'<% }); %>',
|
||||
'</table>'
|
||||
].join(''));
|
||||
|
||||
this.templateValid = _.template([
|
||||
'<label class="header <% if (signatures.length<1) { %>hidden<% } %>"><%= header %></label>',
|
||||
'<table>',
|
||||
'<% _.each(signatures, function(item) { %>',
|
||||
'<tr>',
|
||||
'<td><%= Common.Utils.String.htmlEncode(item.name) %></td>',
|
||||
'<td><%= Common.Utils.String.htmlEncode(item.date) %></td>',
|
||||
'<td><label class="link signature-view-link">' + me.txtView + '</label></td>',
|
||||
'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>">' + me.txtEdit + '</label></td>',
|
||||
'</tr>',
|
||||
'<% }); %>',
|
||||
'</table>'
|
||||
].join(''));
|
||||
},
|
||||
|
@ -1143,22 +1133,13 @@ define([
|
|||
render: function() {
|
||||
$(this.el).html(this.template({scope: this}));
|
||||
|
||||
this.btnAddInvisibleSign = new Common.UI.Button({
|
||||
el: '#fms-btn-invisible-sign'
|
||||
});
|
||||
this.btnAddInvisibleSign.on('click', _.bind(this.addInvisibleSign, 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');
|
||||
var protection = DE.getController('Common.Controllers.Protection').getView();
|
||||
this.btnAddInvisibleSign = protection.getButton('signature');
|
||||
this.btnAddInvisibleSign.render(this.$el.find('#fms-btn-invisible-sign'));
|
||||
this.btnAddInvisibleSign.on('click', _.bind(this.closeMenu, this));
|
||||
|
||||
this.cntSignature = $('#id-fms-signature');
|
||||
this.cntSignatureView = $('#id-fms-signature-view');
|
||||
if (_.isUndefined(this.scroller)) {
|
||||
this.scroller = new Common.UI.Scroller({
|
||||
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;
|
||||
},
|
||||
|
||||
|
@ -1176,11 +1160,7 @@ define([
|
|||
|
||||
setMode: function(mode) {
|
||||
this.mode = mode;
|
||||
if (!this.mode.isEdit) {
|
||||
this.btnAddInvisibleSign.setVisible(false);
|
||||
this.btnAddVisibleSign.setVisible(false);
|
||||
this.lblSignHeader.html(this.strSignature);
|
||||
}
|
||||
this.cntSignature.toggleClass('hidden', !this.mode.canProtect);
|
||||
},
|
||||
|
||||
setApi: function(o) {
|
||||
|
@ -1188,49 +1168,67 @@ define([
|
|||
return this;
|
||||
},
|
||||
|
||||
addInvisibleSign: function() {
|
||||
if (this.menu)
|
||||
this.menu.fireEvent('signature:invisible', [this.menu]);
|
||||
closeMenu: function() {
|
||||
this.menu && this.menu.hide();
|
||||
},
|
||||
|
||||
addVisibleSign: function() {
|
||||
if (this.menu)
|
||||
this.menu.fireEvent('signature:visible', [this.menu]);
|
||||
onEdit: function() {
|
||||
this.menu && this.menu.hide();
|
||||
|
||||
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(){
|
||||
var requested = this.api.asc_getRequestSignatures(),
|
||||
requested_arr = [],
|
||||
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){
|
||||
var sign = {name: item.asc_getSigner1(), date: '18/05/2017'};
|
||||
(item.asc_getValid()==0) ? valid_arr.push(sign) : invalid_arr.push(sign);
|
||||
if (item.asc_getValid()==0)
|
||||
hasValid = true;
|
||||
else
|
||||
hasInvalid = true;
|
||||
});
|
||||
|
||||
// requested_arr = ['Hammish Mitchell', 'Someone Somewhere', 'Mary White', 'John Black'];
|
||||
// valid_arr = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
|
||||
// invalid_arr = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
|
||||
// hasRequested = true;
|
||||
// hasValid = true;
|
||||
// hasInvalid = true;
|
||||
|
||||
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}));
|
||||
var tipText = (hasInvalid) ? this.txtSignedInvalid : (hasValid ? this.txtSigned : "");
|
||||
if (hasRequested)
|
||||
tipText = this.txtRequestedSignatures + (tipText!="" ? "<br><br>" : "")+ tipText;
|
||||
|
||||
this.btnAddInvisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
||||
this.btnAddVisibleSign.setDisabled(valid_arr.length>0 || invalid_arr.length>0);
|
||||
this.cntSignatureView.html(this.templateSignature({tipText: tipText, hasSigned: (hasValid || hasInvalid), hasRequested: hasRequested}));
|
||||
},
|
||||
|
||||
strProtect: 'Protect Document',
|
||||
strInvisibleSign: 'Add invisible digital signature',
|
||||
strVisibleSign: 'Add visible signature',
|
||||
strRequested: 'Requested signatures',
|
||||
strValid: 'Valid signatures',
|
||||
strInvalid: 'Invalid signatures',
|
||||
strSignature: 'Signature'
|
||||
strSignature: 'Signature',
|
||||
txtView: 'View signatures',
|
||||
txtEdit: 'Edit document',
|
||||
txtSigned: 'Valid signatures has been added to the document. The document is protected from editing.',
|
||||
txtSignedInvalid: 'Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.',
|
||||
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 || {}));
|
||||
|
||||
|
|
|
@ -76,8 +76,6 @@ define([
|
|||
ready: false
|
||||
};
|
||||
this._locked = false;
|
||||
this.lockedControls = [];
|
||||
|
||||
this._noApply = false;
|
||||
this._originalProps = null;
|
||||
|
||||
|
@ -118,17 +116,9 @@ define([
|
|||
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);
|
||||
var protection = DE.getController('Common.Controllers.Protection').getView();
|
||||
this.btnAddInvisibleSign = protection.getButton('signature');
|
||||
this.btnAddInvisibleSign.render(this.$el.find('#signature-invisible-sign'));
|
||||
|
||||
this.cntRequestedSign = $('#signature-requested-sign');
|
||||
this.cntValidSign = $('#signature-valid-sign');
|
||||
|
@ -164,16 +154,6 @@ define([
|
|||
this.$linksSign && this.$linksSign.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) {
|
||||
|
@ -184,7 +164,7 @@ define([
|
|||
if (!this._state.ready) return;
|
||||
|
||||
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){
|
||||
|
@ -221,68 +201,11 @@ define([
|
|||
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) {
|
||||
var me = this,
|
||||
target = $(event.currentTarget);
|
||||
|
||||
var target = $(event.currentTarget);
|
||||
if (target.hasClass('disabled')) return;
|
||||
|
||||
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 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();
|
||||
Common.NotificationCenter.trigger('protect:sign', target.attr('data-value'));
|
||||
},
|
||||
|
||||
onViewSignature: function(event) {
|
||||
|
@ -296,25 +219,39 @@ define([
|
|||
this._state.ready = true;
|
||||
|
||||
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) {
|
||||
if (!hasSigned && !hasRequested) return;
|
||||
showSignatureTooltip: function(hasValid, hasInvalid, hasRequested) {
|
||||
if (!hasValid && !hasInvalid && !hasRequested) return;
|
||||
|
||||
var tipText = (hasInvalid) ? this.txtSignedInvalid : (hasValid ? this.txtSigned : "");
|
||||
if (hasRequested)
|
||||
tipText = this.txtRequestedSignatures + "<br><br>" + tipText;
|
||||
|
||||
var me = this,
|
||||
tip = new Common.UI.SynchronizeTip({
|
||||
target : DE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
||||
text : (hasSigned) ? this.txtSignedDocument : this.txtRequestedSignatures,
|
||||
showLink: hasSigned,
|
||||
text : tipText,
|
||||
showLink: hasValid || hasInvalid,
|
||||
textLink: this.txtContinueEditing,
|
||||
placement: 'left'
|
||||
});
|
||||
tip.on({
|
||||
'dontshowclick': function() {
|
||||
Common.UI.warning({
|
||||
title: me.notcriticalErrorTitle,
|
||||
msg: me.txtEditWarning,
|
||||
buttons: ['ok', 'cancel'],
|
||||
primary: 'ok',
|
||||
callback: function(btn) {
|
||||
if (btn == 'ok') {
|
||||
tip.close();
|
||||
// me.api.editSingedDoc();
|
||||
// me.api.editSignedDoc();
|
||||
// me.disableEditing(false); // call in the asc_onUpdateSignatures event callback.
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
'closeclick': function() {
|
||||
tip.close();
|
||||
|
@ -341,22 +278,21 @@ define([
|
|||
var comments = DE.getController('Common.Controllers.Comments');
|
||||
if (comments)
|
||||
comments.setPreviewMode(disable);
|
||||
|
||||
this.disableInsertControls(disable);
|
||||
}
|
||||
},
|
||||
|
||||
strSignature: 'Signature',
|
||||
strInvisibleSign: 'Add invisible digital signature',
|
||||
strVisibleSign: 'Add visible signature',
|
||||
strRequested: 'Requested signatures',
|
||||
strValid: 'Valid signatures',
|
||||
strInvalid: 'Invalid signatures',
|
||||
strSign: 'Sign',
|
||||
strView: 'View',
|
||||
txtSignedDocument: 'This document has been signed. It should not be edited.',
|
||||
txtRequestedSignatures: 'This document has requested signatures.',
|
||||
txtContinueEditing: 'Edit anyway'
|
||||
txtSigned: 'Valid signatures has been added to the document. The document is protected from editing.',
|
||||
txtSignedInvalid: 'Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.',
|
||||
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 || {}));
|
||||
});
|
|
@ -1073,12 +1073,14 @@
|
|||
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
|
||||
"DE.Views.HeaderFooterSettings.textBottomRight": "Bottom right",
|
||||
"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.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.textDiffOdd": "Different odd and even pages",
|
||||
"DE.Views.HeaderFooterSettings.textHeaderFromBottom": "Footer from Bottom",
|
||||
|
@ -1409,13 +1411,17 @@
|
|||
"DE.Views.ShapeSettings.txtTopAndBottom": "Top and bottom",
|
||||
"DE.Views.ShapeSettings.txtWood": "Wood",
|
||||
"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.strValid": "Valid signatures",
|
||||
"DE.Views.SignatureSettings.strInvalid": "Invalid signatures",
|
||||
"DE.Views.SignatureSettings.strSign": "Sign",
|
||||
"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.pageIndexText": "Page {0} of {1}",
|
||||
"DE.Views.Statusbar.tipFitPage": "Fit to page",
|
||||
|
|
|
@ -370,3 +370,24 @@
|
|||
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);
|
||||
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