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