diff --git a/apps/spreadsheeteditor/main/app/controller/WBProtection.js b/apps/spreadsheeteditor/main/app/controller/WBProtection.js index 49b52b5c5..6fe5be03c 100644 --- a/apps/spreadsheeteditor/main/app/controller/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/controller/WBProtection.js @@ -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); } diff --git a/apps/spreadsheeteditor/main/app/view/ProtectDialog.js b/apps/spreadsheeteditor/main/app/view/ProtectDialog.js index b2551ae4d..c3b6f9e0b 100644 --- a/apps/spreadsheeteditor/main/app/view/ProtectDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ProtectDialog.js @@ -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')); }); diff --git a/apps/spreadsheeteditor/main/app/view/WBProtection.js b/apps/spreadsheeteditor/main/app/view/WBProtection.js index 65e77e0a9..554211db4 100644 --- a/apps/spreadsheeteditor/main/app/view/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/view/WBProtection.js @@ -49,8 +49,8 @@ define([ SSE.Views.WBProtection = Common.UI.BaseView.extend(_.extend((function(){ var template = '