[SSE] Disable right panel on protected sheet
This commit is contained in:
parent
1199804ae6
commit
c18ed375ca
|
@ -104,6 +104,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
|
||||
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
|
@ -171,10 +172,10 @@ define([
|
|||
if (!this.editMode)
|
||||
return;
|
||||
|
||||
var isCellLocked = cellInfo.asc_getLocked(),
|
||||
isTableLocked = (cellInfo.asc_getLockedTable()===true || !this.rightmenu.mode.canModifyFilter),
|
||||
isSparkLocked = (cellInfo.asc_getLockedSparkline()===true),
|
||||
isPivotLocked = (cellInfo.asc_getLockedPivotTable()===true);
|
||||
var isCellLocked = cellInfo.asc_getLocked() || this._state.wsProps['FormatCells'],
|
||||
isTableLocked = (cellInfo.asc_getLockedTable()===true || !this.rightmenu.mode.canModifyFilter) || this._state.wsProps['FormatCells'],
|
||||
isSparkLocked = (cellInfo.asc_getLockedSparkline()===true) || this._state.wsLock,
|
||||
isPivotLocked = (cellInfo.asc_getLockedPivotTable()===true) || this._state.wsProps['PivotTables'];
|
||||
|
||||
for (var i=0; i<this._settings.length; ++i) {
|
||||
if (i==Common.Utils.documentSettingsType.Signature) continue;
|
||||
|
@ -202,7 +203,7 @@ define([
|
|||
if (value.asc_getShapeProperties().asc_getTextArtProperties()) {
|
||||
this._settings[Common.Utils.documentSettingsType.TextArt].props = value;
|
||||
this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 0;
|
||||
this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.asc_getLocked();
|
||||
this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.asc_getLocked() || this._state.wsProps['Objects'];
|
||||
}
|
||||
} else if (value.asc_getSlicerProperties() !== null) {
|
||||
settingsType = Common.Utils.documentSettingsType.Slicer;
|
||||
|
@ -211,7 +212,8 @@ define([
|
|||
|
||||
this._settings[settingsType].props = value;
|
||||
this._settings[settingsType].hidden = 0;
|
||||
this._settings[settingsType].locked = value.asc_getLocked();
|
||||
|
||||
this._settings[settingsType].locked = value.asc_getLocked() || this._state.wsProps['Objects'];
|
||||
|
||||
if (!this._settings[Common.Utils.documentSettingsType.Signature].locked) // lock Signature, если хотя бы один объект locked
|
||||
this._settings[Common.Utils.documentSettingsType.Signature].locked = value.asc_getLocked();
|
||||
|
@ -301,7 +303,7 @@ define([
|
|||
if (active !== undefined) {
|
||||
this.rightmenu.SetActivePane(active, this._openRightMenu);
|
||||
if (active!=Common.Utils.documentSettingsType.Signature)
|
||||
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
|
||||
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props, this._state.wsLock, this._state.wsProps);
|
||||
else
|
||||
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel);
|
||||
this._openRightMenu = false;
|
||||
|
@ -365,7 +367,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
|
||||
this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this));
|
||||
// this.rightmenu.shapeSettings.createDelayedElements();
|
||||
this.onSelectionChanged(this.api.asc_getCellInfo());
|
||||
this.onChangeProtectSheet();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -388,7 +390,7 @@ define([
|
|||
|
||||
if (settingsType !== Common.Utils.documentSettingsType.Paragraph) {
|
||||
this.rightmenu.SetActivePane(settingsType, true);
|
||||
this._settings[settingsType].panel.ChangeSettings.call(this._settings[settingsType].panel, this._settings[settingsType].props);
|
||||
this._settings[settingsType].panel.ChangeSettings.call(this._settings[settingsType].panel, this._settings[settingsType].props, this._state.wsLock, this._state.wsProps);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -449,6 +451,16 @@ define([
|
|||
|
||||
onCellsRange: function(status) {
|
||||
this.rangeSelectionMode = (status != Asc.c_oAscSelectionDialogType.None);
|
||||
},
|
||||
|
||||
onChangeProtectSheet: function(props) {
|
||||
if (!props) {
|
||||
var wbprotect = this.getApplication().getController('WBProtection');
|
||||
props = wbprotect ? wbprotect.getWSProps() : null;
|
||||
}
|
||||
this._state.wsProps = props.wsProps;
|
||||
this._state.wsLock = props.wsLock;
|
||||
this.onSelectionChanged(this.api.asc_getCellInfo());
|
||||
}
|
||||
});
|
||||
});
|
|
@ -86,6 +86,8 @@ define([
|
|||
};
|
||||
this.lockedControls = [];
|
||||
this._locked = false;
|
||||
this.wsLock = false;
|
||||
this.wsProps = [];
|
||||
this.isEditCell = false;
|
||||
|
||||
this._originalProps = null;
|
||||
|
@ -367,10 +369,12 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
ChangeSettings: function(props) {
|
||||
ChangeSettings: function(props, wsLock, wsProps) {
|
||||
if (this._initSettings)
|
||||
this.createDelayedControls();
|
||||
|
||||
this.wsLock = wsLock;
|
||||
this.wsProps = wsProps;
|
||||
this.disableControls(this._locked); // need to update combodataview after disabled state
|
||||
|
||||
if (props )//formatTableInfo
|
||||
|
@ -434,7 +438,7 @@ define([
|
|||
this._state.CheckFilter=value;
|
||||
}
|
||||
if (this.chFilter.isDisabled() !== (!this._state.CheckHeader || this._locked || value===null))
|
||||
this.chFilter.setDisabled(!this._state.CheckHeader || this._locked || value===null);
|
||||
this.chFilter.setDisabled(!this._state.CheckHeader || this._locked || value===null || this.wsLock);
|
||||
|
||||
if (needTablePictures)
|
||||
this.onApiInitTableTemplates(this.api.asc_getTablePictures(props));
|
||||
|
@ -494,7 +498,7 @@ define([
|
|||
this.btnTableTemplate.render($('#table-btn-template'));
|
||||
this.lockedControls.push(this.btnTableTemplate);
|
||||
this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate));
|
||||
if (this._locked) this.btnTableTemplate.setDisabled(this._locked);
|
||||
if (this._locked) this.btnTableTemplate.setDisabled(this._locked || this.wsProps['FormatCells']);
|
||||
}
|
||||
|
||||
|
||||
|
@ -597,13 +601,16 @@ define([
|
|||
if (this._initSettings) return;
|
||||
disable = disable || this.isEditCell;
|
||||
|
||||
if (this._state.DisabledControls!==disable) {
|
||||
this._state.DisabledControls = disable;
|
||||
_.each(this.lockedControls, function(item) {
|
||||
item.setDisabled(disable);
|
||||
});
|
||||
this.linkAdvanced.toggleClass('disabled', disable);
|
||||
}
|
||||
var me = this;
|
||||
_.each(this.lockedControls, function(item) {
|
||||
item.setDisabled(disable || me.wsLock);
|
||||
});
|
||||
this.linkAdvanced.toggleClass('disabled', disable || this.wsLock);
|
||||
this.btnTableTemplate && this.btnTableTemplate.setDisabled(disable || this.wsProps['FormatCells']);
|
||||
this.chBanded.setDisabled(disable || this.wsProps['FormatCells']);
|
||||
this.chFirst.setDisabled(disable || this.wsProps['FormatCells']);
|
||||
this.chLast.setDisabled(disable || this.wsProps['FormatCells']);
|
||||
this.chColBanded.setDisabled(disable || this.wsProps['FormatCells']);
|
||||
},
|
||||
|
||||
textEdit: 'Rows & Columns',
|
||||
|
|
|
@ -151,7 +151,7 @@ define([
|
|||
|
||||
this.chLockedText = new Common.UI.CheckBox({
|
||||
labelText: this.txtLockedText,
|
||||
lock : [_set.selRange, _set.selRangeEdit, _set.selRangeEdit, _set.selImage, _set.wbLock, _set.lostConnect, _set.coAuth, _set['Objects']]
|
||||
lock : [_set.selRange, _set.selRangeEdit, _set.selRangeEdit, _set.selImage, _set.selSlicer, _set.wbLock, _set.lostConnect, _set.coAuth, _set['Objects']]
|
||||
});
|
||||
this.lockedControls.push(this.chLockedText);
|
||||
|
||||
|
|
Loading…
Reference in a new issue