From db75fdd25507aab2585a867a0f44a5352b17a46e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 11 Nov 2021 16:53:43 +0300 Subject: [PATCH] [SSE] Bug 53654: don't show hidden sheets in protected workbook --- apps/spreadsheeteditor/main/app/controller/Statusbar.js | 5 +++-- apps/spreadsheeteditor/main/app/view/Statusbar.js | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index 47c5c0e53..dde45ae85 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -193,15 +193,16 @@ define([ }, onChangeProtectWorkbook: function() { - this.statusbar.btnAddWorksheet.setDisabled(this.api.isCellEdited || this.api.asc_isWorkbookLocked() || this.api.asc_isProtectedWorkbook() || this.statusbar.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None); - var count = this.statusbar.tabbar.getCount(), tab; var wbprotected = this.api.asc_isProtectedWorkbook(); + this.statusbar.btnAddWorksheet.setDisabled(this.api.isCellEdited || this.api.asc_isWorkbookLocked() || wbprotected || this.statusbar.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None); + var count = this.statusbar.tabbar.getCount(), tab; for (var i = count; i-- > 0; ) { tab = this.statusbar.tabbar.getAt(i); var islocked = tab.hasClass('coauth-locked'); tab.isLockTheDrag = islocked || wbprotected || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable) || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.PrintTitles); tab.$el.children(':first-child').attr('draggable', tab.isLockTheDrag?'false':'true'); } + this.statusbar.update(); }, /** coauthoring end **/ diff --git a/apps/spreadsheeteditor/main/app/view/Statusbar.js b/apps/spreadsheeteditor/main/app/view/Statusbar.js index 699080041..684e52e0e 100644 --- a/apps/spreadsheeteditor/main/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/view/Statusbar.js @@ -553,10 +553,9 @@ define([ iconTitle : name, iconVisible : name!=='' }; - - this.api.asc_isWorksheetHidden(i)? hidentems.push(tab) : items.push(tab); - - allItems.push(tab); + var hidden = this.api.asc_isWorksheetHidden(i); + hidden ? hidentems.push(tab) : items.push(tab); + (!hidden || !wbprotected) && allItems.push(tab); } if (hidentems.length) { @@ -600,7 +599,7 @@ define([ if (!this.tabbar.isTabVisible(sindex)) this.tabbar.setTabVisible(sindex); - this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || me.api.asc_isProtectedWorkbook() || me.api.isCellEdited); + this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || wbprotected || me.api.isCellEdited); if (this.mode.isEdit) { this.tabbar.addDataHint(_.findIndex(items, function (item) { return item.sheetindex === sindex;