From 4abaffcf88cd4b2018bc0897071c9c6fc16bbb78 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Jul 2019 11:36:13 +0300 Subject: [PATCH] Change usage of asc_DownloadAs --- apps/common/embed/lib/util/utils.js | 2 +- apps/common/main/lib/controller/History.js | 2 +- apps/documenteditor/embed/js/ApplicationController.js | 2 +- apps/documenteditor/main/app/controller/LeftMenu.js | 8 ++++---- apps/documenteditor/main/app/controller/Main.js | 4 ++-- apps/documenteditor/main/app/controller/Toolbar.js | 2 +- apps/documenteditor/mobile/app/controller/Main.js | 2 +- apps/documenteditor/mobile/app/controller/Settings.js | 4 ++-- apps/presentationeditor/embed/js/ApplicationController.js | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 4 ++-- apps/presentationeditor/main/app/controller/Main.js | 4 ++-- apps/presentationeditor/main/app/controller/Toolbar.js | 2 +- apps/presentationeditor/mobile/app/controller/Main.js | 2 +- apps/presentationeditor/mobile/app/controller/Settings.js | 2 +- apps/spreadsheeteditor/embed/js/ApplicationController.js | 2 +- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 8 ++++---- apps/spreadsheeteditor/main/app/controller/Main.js | 6 ++++-- apps/spreadsheeteditor/main/app/controller/Print.js | 7 +++++-- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- apps/spreadsheeteditor/mobile/app/controller/Main.js | 2 +- apps/spreadsheeteditor/mobile/app/controller/Settings.js | 4 ++-- 21 files changed, 39 insertions(+), 34 deletions(-) diff --git a/apps/common/embed/lib/util/utils.js b/apps/common/embed/lib/util/utils.js index 96b16c173..0ad2ed91e 100644 --- a/apps/common/embed/lib/util/utils.js +++ b/apps/common/embed/lib/util/utils.js @@ -65,7 +65,7 @@ iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - api.asc_DownloadAs(Asc.c_oAscFileType.PDF); + api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); } }; diff --git a/apps/common/main/lib/controller/History.js b/apps/common/main/lib/controller/History.js index 8e8978193..056183ee3 100644 --- a/apps/common/main/lib/controller/History.js +++ b/apps/common/main/lib/controller/History.js @@ -113,7 +113,7 @@ define([ Common.Gateway.requestRestore(record.get('revision')); else { this.isFromSelectRevision = record.get('revision'); - this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } return; } diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 87d6b1e47..7a551c55d 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -458,7 +458,7 @@ DE.ApplicationController = new(function(){ Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); return; } - if (api) api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true); + if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } // Helpers diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index fb82b1432..3395df3da 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -302,13 +302,13 @@ define([ buttons: ['ok', 'cancel'], callback: _.bind(function(btn){ if (btn == 'ok') { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) }); } else { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } } else @@ -326,14 +326,14 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, this) }); } else { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } } else { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a88d2fce4..156643c26 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -463,7 +463,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.DOCX; - this.api.asc_DownloadAs(_format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)); } }, @@ -2096,7 +2096,7 @@ define([ me.iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); } }; } diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index dc5c863f6..f32b7224a 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -152,7 +152,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.PDF; - _main.api.asc_DownloadAs(_format); + _main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format)); }, 'go:editor': function() { Common.Gateway.requestEditRights(); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 10ea23815..f657b5f9c 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -322,7 +322,7 @@ define([ if (type && typeof type[1] === 'string') { this.api.asc_DownloadOrigin(true) } else { - this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } }, diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index ed2c91303..5b60752d7 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -567,13 +567,13 @@ define([ me.warnDownloadAs, me.notcriticalErrorTitle, function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); } ); }); } else { _.defer(function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); }); } diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 6faead079..5229c9ae4 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -558,7 +558,7 @@ PE.ApplicationController = new(function(){ Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); return; } - if (api) api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true); + if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); } // Helpers // ------------------------- diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index d38358c8d..943cfb61a 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -247,13 +247,13 @@ define([ }, clickSaveAsFormat: function(menu, format) { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); }, clickSaveCopyAsFormat: function(menu, format, ext) { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3bfe5f948..c88587ea9 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -419,7 +419,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.PPTX; - this.api.asc_DownloadAs(_format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)); }, onProcessMouse: function(data) { @@ -1784,7 +1784,7 @@ define([ me.iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); } }; } diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index e236209f8..c1712c590 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -161,7 +161,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.PDF; - _main.api.asc_DownloadAs(_format); + _main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format)); }, 'go:editor': function() { Common.Gateway.requestEditRights(); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index a3e746c08..2b36d8157 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -311,7 +311,7 @@ define([ return; } this._state.isFromGatewayDownloadAs = true; - this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); }, goBack: function(current) { diff --git a/apps/presentationeditor/mobile/app/controller/Settings.js b/apps/presentationeditor/mobile/app/controller/Settings.js index ba56d02d7..bd2c06493 100644 --- a/apps/presentationeditor/mobile/app/controller/Settings.js +++ b/apps/presentationeditor/mobile/app/controller/Settings.js @@ -381,7 +381,7 @@ define([ if (format) { _.defer(function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); }); } diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 40235cd48..4586f1580 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -464,7 +464,7 @@ SSE.ApplicationController = new(function(){ Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); return; } - api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true); + api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true)); } function onApiMouseMove(array) { diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 596a68398..558d43d5d 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -264,7 +264,7 @@ define([ buttons: ['ok', 'cancel'], callback: _.bind(function(btn){ if (btn == 'ok') { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) @@ -273,7 +273,7 @@ define([ menu.hide(); Common.NotificationCenter.trigger('download:settings', this.leftMenu, format); } else { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, @@ -287,7 +287,7 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, this) @@ -298,7 +298,7 @@ define([ Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, true); } else { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index c760ad729..86a6720c7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -434,7 +434,7 @@ define([ if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA) Common.NotificationCenter.trigger('download:settings', this, _format, true); else - this.api.asc_DownloadAs(_format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)); }, onProcessMouse: function(data) { @@ -2021,7 +2021,9 @@ define([ me.iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF, false, me.getApplication().getController('Print').getPrintParams()); + var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF); + opts.asc_setAdjustPrint(me.getApplication().getController('Print').getPrintParams()); + me.api.asc_DownloadAs(opts); } }; } diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index aba2b4079..d2899e595 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -268,8 +268,11 @@ define([ if ( this.printSettingsDlg.type=='print' ) this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); - else - this.api.asc_DownloadAs(this.downloadFormat, this.asUrl, this.adjPrintParams); + else { + var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl); + opts.asc_setAdjustPrint(this.adjPrintParams); + this.api.asc_DownloadAs(opts); + } Common.component.Analytics.trackEvent((this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs'); Common.component.Analytics.trackEvent('ToolBar', (this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs'); Common.NotificationCenter.trigger('edit:complete', view); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 1c1aedbe2..d9e4ba653 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -113,7 +113,7 @@ define([ if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA) Common.NotificationCenter.trigger('download:settings', this.toolbar, _format); else - _main.api.asc_DownloadAs(_format); + _main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format)); }, 'go:editor': function() { Common.Gateway.requestEditRights(); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 25a029017..02df0244b 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -319,7 +319,7 @@ define([ return; } this._state.isFromGatewayDownloadAs = true; - this.api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true)); }, goBack: function(current) { diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 15d9200c1..def0ccc68 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -676,11 +676,11 @@ define([ me.warnDownloadAs, me.notcriticalErrorTitle, function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); } ); } else { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); } me.hideModal();