[SSE] Change existing protection props

This commit is contained in:
Julia Radzhabova 2021-06-22 16:07:10 +03:00
parent e6c67dc0ef
commit 65498d9582
3 changed files with 6 additions and 10 deletions

View file

@ -117,7 +117,7 @@ define([
handler: function(result, value) { handler: function(result, value) {
btn = result; btn = result;
if (result == 'ok') { if (result == 'ok') {
var props = new Asc.CWorkbookProtection(); var props = me.api.asc_getProtectedWorkbook();
props.asc_setLockStructure(true); props.asc_setLockStructure(true);
value && props.asc_setPassword(value); value && props.asc_setPassword(value);
me.api.asc_setProtectedWorkbook(props); me.api.asc_setProtectedWorkbook(props);
@ -145,7 +145,6 @@ define([
btn = result; btn = result;
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
props = new Asc.CWorkbookProtection();
props.asc_setLockStructure(false, value); props.asc_setLockStructure(false, value);
me.api.asc_setProtectedWorkbook(props); me.api.asc_setProtectedWorkbook(props);
} }
@ -159,7 +158,6 @@ define([
win.show(); win.show();
} else { } else {
props = new Asc.CWorkbookProtection();
props.asc_setLockStructure(false); props.asc_setLockStructure(false);
me.api.asc_setProtectedWorkbook(props); me.api.asc_setProtectedWorkbook(props);
} }
@ -170,13 +168,13 @@ define([
if (state) { if (state) {
var me = this, var me = this,
btn, btn,
props = me.api.asc_getProtectedSheet(),
win = new SSE.Views.ProtectDialog({ win = new SSE.Views.ProtectDialog({
type: 'sheet', type: 'sheet',
props: me.api.asc_getProtectedSheet(), props: props,
handler: function(result, value, props) { handler: function(result, value, props) {
btn = result; btn = result;
if (result == 'ok') { if (result == 'ok') {
!props && (props = new Asc.CSheetProtection());
props.asc_setSheet(true); props.asc_setSheet(true);
value && props.asc_setPassword(value); value && props.asc_setPassword(value);
me.api.asc_setProtectedSheet(props); me.api.asc_setProtectedSheet(props);
@ -204,7 +202,6 @@ define([
btn = result; btn = result;
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
props = new Asc.CSheetProtection();
props.asc_setSheet(false, value); props.asc_setSheet(false, value);
me.api.asc_setProtectedSheet(props); me.api.asc_setProtectedSheet(props);
} }
@ -218,7 +215,6 @@ define([
win.show(); win.show();
} else { } else {
props = new Asc.CSheetProtection();
props.asc_setSheet(false); props.asc_setSheet(false);
me.api.asc_setProtectedSheet(props); me.api.asc_setProtectedSheet(props);
} }

View file

@ -290,7 +290,7 @@ define([
getSheetSettings: function() { getSheetSettings: function() {
if (this.type !== 'sheet') return null; if (this.type !== 'sheet') return null;
var props = new Asc.CSheetProtection(); var props = this.props ? this.props : new Asc.CSheetProtection();
this.optionsList.store.each(function (item, index) { this.optionsList.store.each(function (item, index) {
props && props['asc_set' + item.get('optionName')] && props['asc_set' + item.get('optionName')](!item.get('check')); props && props['asc_set' + item.get('optionName')] && props['asc_set' + item.get('optionName')](!item.get('check'));
}); });

View file

@ -49,8 +49,8 @@ define([
SSE.Views.WBProtection = Common.UI.BaseView.extend(_.extend((function(){ SSE.Views.WBProtection = Common.UI.BaseView.extend(_.extend((function(){
var template = var template =
'<div class="group">' + '<div class="group">' +
'<span id="slot-btn-protect-wb" class="btn-slot text x-huge"></span>' + '<span id="slot-btn-protect-wb" class="btn-slot text x-huge" style="margin-right: 2px;"></span>' +
'<span id="slot-btn-protect-sheet" class="btn-slot text x-huge"></span>' + '<span id="slot-btn-protect-sheet" class="btn-slot text x-huge" style="margin-right: 2px;"></span>' +
'<span id="slot-btn-allow-ranges" class="btn-slot text x-huge"></span>' + '<span id="slot-btn-allow-ranges" class="btn-slot text x-huge"></span>' +
'</div>' + '</div>' +
'<div class="group small">' + '<div class="group small">' +