From efd79e497ed78a17e94cb4176aaf4592c754f2de Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 May 2017 16:42:04 +0300 Subject: [PATCH] [DE] Lock signature settings in the right panel when cursor is in the locked object. --- .../main/app/controller/RightMenu.js | 8 +++++--- apps/documenteditor/main/app/view/SignDialog.js | 2 +- .../main/app/view/SignSettingsDialog.js | 2 +- .../main/app/view/SignatureSettings.js | 14 ++++++++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index fa2db4cce..c56a64f5a 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -78,8 +78,8 @@ define([ this._settings[Common.Utils.documentSettingsType.Shape] = {panelId: "id-shape-settings", panel: rightMenu.shapeSettings, btn: rightMenu.btnShape, 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.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}; + 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}; }, setApi: function(api) { @@ -156,6 +156,8 @@ define([ this._settings[settingsType].locked = value.get_Locked(); if (!this._settings[Common.Utils.documentSettingsType.MailMerge].locked) // lock MailMerge-InsertField, если хотя бы один объект locked this._settings[Common.Utils.documentSettingsType.MailMerge].locked = value.get_Locked(); + if (!this._settings[Common.Utils.documentSettingsType.Signature].locked) // lock Signature, если хотя бы один объект locked + this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked(); } if ( this._settings[Common.Utils.documentSettingsType.Header].locked ) { // если находимся в locked header/footer, то считаем, что все элементы в нем тоже недоступны @@ -206,7 +208,7 @@ define([ if (active !== undefined) { this.rightmenu.SetActivePane(active, open); - if (active!=Common.Utils.documentSettingsType.MailMerge) + if (active!=Common.Utils.documentSettingsType.MailMerge && active!=Common.Utils.documentSettingsType.Signature) this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props); else this._settings[active].panel.ChangeSettings.call(this._settings[active].panel); diff --git a/apps/documenteditor/main/app/view/SignDialog.js b/apps/documenteditor/main/app/view/SignDialog.js index 6e7bc5c05..ee6ed0bfa 100644 --- a/apps/documenteditor/main/app/view/SignDialog.js +++ b/apps/documenteditor/main/app/view/SignDialog.js @@ -244,7 +244,7 @@ define([ var me = this; _.delay(function(){ - me.inputPurpose.cmpEl.find('input').focus(); + ((me.signType == 'visible') ? me.inputName : me.inputPurpose).cmpEl.find('input').focus(); },500); }, diff --git a/apps/documenteditor/main/app/view/SignSettingsDialog.js b/apps/documenteditor/main/app/view/SignSettingsDialog.js index c52feddc9..3c749de3e 100644 --- a/apps/documenteditor/main/app/view/SignSettingsDialog.js +++ b/apps/documenteditor/main/app/view/SignSettingsDialog.js @@ -62,7 +62,7 @@ define([ }, options || {}); this.template = [ - '
', + '
', '
', '', '
', diff --git a/apps/documenteditor/main/app/view/SignatureSettings.js b/apps/documenteditor/main/app/view/SignatureSettings.js index 8266ff844..27dc418fc 100644 --- a/apps/documenteditor/main/app/view/SignatureSettings.js +++ b/apps/documenteditor/main/app/view/SignatureSettings.js @@ -153,6 +153,8 @@ define([ if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures) { this.onUpdateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures()); } + + this.disableControls(this._locked); }, setLocked: function (locked) { @@ -235,7 +237,9 @@ define([ onSign: function(event) { var me = this, - guid = $(event.currentTarget).attr('data-value'); + target = $(event.currentTarget); + + if (target.hasClass('disabled')) return; if (_.isUndefined(me.fontStore)) { me.fontStore = new Common.Collections.Fonts(); @@ -256,7 +260,7 @@ define([ 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.api.asc_Sign(props.certificateId, target.attr('data-value'), props.images[0], props.images[1]); } me.fireEvent('editcomplete', me); } @@ -265,8 +269,10 @@ define([ }, onViewSignature: function(guid) { - var guid = $(event.currentTarget).attr('data-value'); - this.api.asc_ViewCertificate(guid); + var target = $(event.currentTarget); + if (target.hasClass('disabled')) return; + + this.api.asc_ViewCertificate(target.attr('data-value')); }, strSignature: 'Signature',