Merge pull request #1307 from ONLYOFFICE/fix/bugfix

[SSE] Bug 53654: don't show hidden sheets in protected workbook
This commit is contained in:
Julia Radzhabova 2021-11-11 17:03:14 +03:00 committed by GitHub
commit 2d9a56643e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -193,15 +193,16 @@ define([
}, },
onChangeProtectWorkbook: function() { 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(); 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; ) { for (var i = count; i-- > 0; ) {
tab = this.statusbar.tabbar.getAt(i); tab = this.statusbar.tabbar.getAt(i);
var islocked = tab.hasClass('coauth-locked'); 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.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'); tab.$el.children(':first-child').attr('draggable', tab.isLockTheDrag?'false':'true');
} }
this.statusbar.update();
}, },
/** coauthoring end **/ /** coauthoring end **/

View file

@ -553,10 +553,9 @@ define([
iconTitle : name, iconTitle : name,
iconVisible : name!=='' iconVisible : name!==''
}; };
var hidden = this.api.asc_isWorksheetHidden(i);
this.api.asc_isWorksheetHidden(i)? hidentems.push(tab) : items.push(tab); hidden ? hidentems.push(tab) : items.push(tab);
(!hidden || !wbprotected) && allItems.push(tab);
allItems.push(tab);
} }
if (hidentems.length) { if (hidentems.length) {
@ -600,7 +599,7 @@ define([
if (!this.tabbar.isTabVisible(sindex)) if (!this.tabbar.isTabVisible(sindex))
this.tabbar.setTabVisible(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) { if (this.mode.isEdit) {
this.tabbar.addDataHint(_.findIndex(items, function (item) { this.tabbar.addDataHint(_.findIndex(items, function (item) {
return item.sheetindex === sindex; return item.sheetindex === sindex;