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

View file

@ -290,7 +290,7 @@ define([
getSheetSettings: function() {
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) {
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(){
var template =
'<div class="group">' +
'<span id="slot-btn-protect-wb" class="btn-slot text x-huge"></span>' +
'<span id="slot-btn-protect-sheet" 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" style="margin-right: 2px;"></span>' +
'<span id="slot-btn-allow-ranges" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="group small">' +