[SSE] Protect sheet from context menu
This commit is contained in:
parent
1603e3cf9b
commit
6a270a5e03
|
@ -308,6 +308,9 @@ define([
|
||||||
me.hideWorksheet(true, arrIndex);
|
me.hideWorksheet(true, arrIndex);
|
||||||
}, 1);
|
}, 1);
|
||||||
break;
|
break;
|
||||||
|
case 'protect':
|
||||||
|
this.protectWorksheet();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -779,6 +782,10 @@ define([
|
||||||
this._sheetViewTip.hide();
|
this._sheetViewTip.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
protectWorksheet: function() {
|
||||||
|
Common.NotificationCenter.trigger('protect:sheet', !this.api.asc_isProtectedSheet());
|
||||||
|
},
|
||||||
|
|
||||||
zoomText : 'Zoom {0}%',
|
zoomText : 'Zoom {0}%',
|
||||||
errorLastSheet : 'Workbook must have at least one visible worksheet.',
|
errorLastSheet : 'Workbook must have at least one visible worksheet.',
|
||||||
errorRemoveSheet: 'Can\'t delete the worksheet.',
|
errorRemoveSheet: 'Can\'t delete the worksheet.',
|
||||||
|
|
|
@ -77,6 +77,7 @@ define([
|
||||||
|
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
|
Common.NotificationCenter.on('protect:sheet', _.bind(this.onSheetClick, this));
|
||||||
},
|
},
|
||||||
setConfig: function (data, api) {
|
setConfig: function (data, api) {
|
||||||
this.setApi(api);
|
this.setApi(api);
|
||||||
|
|
|
@ -342,6 +342,7 @@ define([
|
||||||
caption: this.itemHidden,
|
caption: this.itemHidden,
|
||||||
menu: menuHiddenItems
|
menu: menuHiddenItems
|
||||||
},
|
},
|
||||||
|
{caption: this.itemProtect, value: 'protect'},
|
||||||
{
|
{
|
||||||
caption: this.itemTabColor,
|
caption: this.itemTabColor,
|
||||||
menu: menuColorItems
|
menu: menuColorItems
|
||||||
|
@ -657,16 +658,19 @@ define([
|
||||||
this.tabMenu.items[4].setDisabled(issheetlocked || isdocprotected);
|
this.tabMenu.items[4].setDisabled(issheetlocked || isdocprotected);
|
||||||
this.tabMenu.items[5].setDisabled(issheetlocked || isdocprotected);
|
this.tabMenu.items[5].setDisabled(issheetlocked || isdocprotected);
|
||||||
this.tabMenu.items[6].setDisabled(isdoclocked || isdocprotected);
|
this.tabMenu.items[6].setDisabled(isdoclocked || isdocprotected);
|
||||||
this.tabMenu.items[7].setDisabled(issheetlocked || isdocprotected);
|
this.tabMenu.items[7].setDisabled(select.length>1);
|
||||||
|
this.tabMenu.items[8].setDisabled(issheetlocked || isdocprotected);
|
||||||
|
|
||||||
|
this.tabMenu.items[7].setCaption(this.api.asc_isProtectedSheet() ? this.itemUnProtect : this.itemProtect);
|
||||||
|
|
||||||
if (select.length === 1) {
|
if (select.length === 1) {
|
||||||
this.tabMenu.items[10].hide();
|
this.tabMenu.items[11].hide();
|
||||||
} else {
|
} else {
|
||||||
this.tabMenu.items[10].show();
|
this.tabMenu.items[11].show();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tabMenu.items[9].setDisabled(issheetlocked || isdocprotected);
|
|
||||||
this.tabMenu.items[10].setDisabled(issheetlocked || isdocprotected);
|
this.tabMenu.items[10].setDisabled(issheetlocked || isdocprotected);
|
||||||
|
this.tabMenu.items[11].setDisabled(issheetlocked || isdocprotected);
|
||||||
|
|
||||||
this.api.asc_closeCellEditor();
|
this.api.asc_closeCellEditor();
|
||||||
this.api.asc_enableKeyEvents(false);
|
this.api.asc_enableKeyEvents(false);
|
||||||
|
@ -857,7 +861,9 @@ define([
|
||||||
itemCount : 'Count',
|
itemCount : 'Count',
|
||||||
itemMinimum : 'Minimum',
|
itemMinimum : 'Minimum',
|
||||||
itemMaximum : 'Maximum',
|
itemMaximum : 'Maximum',
|
||||||
itemSum : 'Sum'
|
itemSum : 'Sum',
|
||||||
|
itemProtect : 'Protect',
|
||||||
|
itemUnProtect : 'Unprotect'
|
||||||
}, SSE.Views.Statusbar || {}));
|
}, SSE.Views.Statusbar || {}));
|
||||||
|
|
||||||
SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({
|
SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({
|
||||||
|
|
|
@ -2978,6 +2978,8 @@
|
||||||
"SSE.Views.Statusbar.itemRename": "Rename",
|
"SSE.Views.Statusbar.itemRename": "Rename",
|
||||||
"SSE.Views.Statusbar.itemSum": "Sum",
|
"SSE.Views.Statusbar.itemSum": "Sum",
|
||||||
"SSE.Views.Statusbar.itemTabColor": "Tab Color",
|
"SSE.Views.Statusbar.itemTabColor": "Tab Color",
|
||||||
|
"SSE.Views.Statusbar.itemProtect": "Protect",
|
||||||
|
"SSE.Views.Statusbar.itemUnProtect": "Unprotect",
|
||||||
"SSE.Views.Statusbar.RenameDialog.errNameExists": "Worksheet with such a name already exists.",
|
"SSE.Views.Statusbar.RenameDialog.errNameExists": "Worksheet with such a name already exists.",
|
||||||
"SSE.Views.Statusbar.RenameDialog.errNameWrongChar": "A sheet name cannot contain the following characters: \\/*?[]:",
|
"SSE.Views.Statusbar.RenameDialog.errNameWrongChar": "A sheet name cannot contain the following characters: \\/*?[]:",
|
||||||
"SSE.Views.Statusbar.RenameDialog.labelSheetName": "Sheet Name",
|
"SSE.Views.Statusbar.RenameDialog.labelSheetName": "Sheet Name",
|
||||||
|
|
Loading…
Reference in a new issue