From afdb5b343fbd3c4a78d0303d62226aec16fa8857 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 12 Mar 2021 12:41:05 +0300 Subject: [PATCH] [SSE] Fix rules lock --- .../main/app/controller/Toolbar.js | 14 +++++++++++++- .../main/app/view/FormatRulesEditDlg.js | 10 ---------- .../main/app/view/FormatRulesManagerDlg.js | 7 ++++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 8fe432949..1c301818f 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -187,7 +187,8 @@ define([ pgsize: [0, 0], pgmargins: undefined, pgorient: undefined, - lock_doc: undefined + lock_doc: undefined, + cf_locked: [] }; this.binding = {}; @@ -421,6 +422,8 @@ define([ this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); + this.api.asc_registerCallback('asc_onLockCFManager', _.bind(this.onLockCFManager, this)); + this.api.asc_registerCallback('asc_onUnLockCFManager', _.bind(this.onUnLockCFManager, this)); this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); } else if (config.isRestrictedEdit) @@ -1731,6 +1734,7 @@ define([ (new SSE.Views.FormatRulesManagerDlg({ api: me.api, langId: value, + locked: !!me._state.cf_locked[this.api.asc_getActiveWorksheetIndex()], handler: function (result, settings) { if (me && me.api && result=='ok') { me.api.asc_setCF(settings.rules, settings.deleted); @@ -3536,6 +3540,14 @@ define([ this.toolbar.lockToolbar(SSE.enumLock.namedRangeLock, this._state.namedrange_locked, {array: [this.toolbar.btnPrintArea.menu.items[0], this.toolbar.btnPrintArea.menu.items[2]]}); }, + onLockCFManager: function(index) { + this._state.cf_locked[index] = true; + }, + + onUnLockCFManager: function(index) { + this._state.cf_locked[index] = false; + }, + activateControls: function() { this.toolbar.lockToolbar(SSE.enumLock.disableOnStart, false, {array: [this.toolbar.btnPrint]}); this._state.activated = true; diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index cd920e6ea..9d4f53614 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -214,16 +214,6 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', }); this.ruleStore = new Backbone.Collection(arrrules); - // this.txtScope = new Common.UI.InputFieldBtn({ - // el : $('#format-rules-edit-txt-scope'), - // name : 'range', - // style : 'width: 150px;', - // allowBlank : true, - // btnHint : this.textSelectData, - // validateOnChange: false - // }); - // this.txtScope.on('button:click', _.bind(this.onSelectData, this)); - this.cmbCategory = new Common.UI.ComboBox({ el : $('#format-rules-edit-combo-category'), style : 'width: 150px;', diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index ee469c9d0..158cf79de 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -258,7 +258,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa for (var i=0; i