From 148bc3e179eca2a4500d9cb2d9b6a6ee794b6f00 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 20 Jul 2021 21:30:09 +0300 Subject: [PATCH] Add download as docm/pptm/xlsm --- .../main/resources/img/doc-formats/docm.svg | 10 ++++++++++ .../main/resources/img/doc-formats/pptm.svg | 14 ++++++++++++++ .../main/resources/img/doc-formats/xlsm.svg | 10 ++++++++++ apps/documenteditor/main/app/view/FileMenu.js | 4 ++-- .../main/app/view/FileMenuPanels.js | 12 ++++++++++-- apps/documenteditor/main/index.html | 1 + apps/documenteditor/main/index.html.deploy | 1 + apps/documenteditor/main/index_loader.html | 1 + .../documenteditor/main/index_loader.html.deploy | 1 + .../presentationeditor/main/app/view/FileMenu.js | 4 ++-- .../main/app/view/FileMenuPanels.js | 14 ++++++++++++-- apps/presentationeditor/main/index.html | 1 + apps/presentationeditor/main/index.html.deploy | 1 + apps/presentationeditor/main/index_loader.html | 1 + .../main/index_loader.html.deploy | 1 + apps/spreadsheeteditor/main/app/view/FileMenu.js | 4 ++-- .../main/app/view/FileMenuPanels.js | 16 ++++++++++++---- apps/spreadsheeteditor/main/index.html | 1 + apps/spreadsheeteditor/main/index.html.deploy | 1 + apps/spreadsheeteditor/main/index_loader.html | 1 + .../main/index_loader.html.deploy | 1 + 21 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 apps/common/main/resources/img/doc-formats/docm.svg create mode 100644 apps/common/main/resources/img/doc-formats/pptm.svg create mode 100644 apps/common/main/resources/img/doc-formats/xlsm.svg diff --git a/apps/common/main/resources/img/doc-formats/docm.svg b/apps/common/main/resources/img/doc-formats/docm.svg new file mode 100644 index 000000000..a259c17de --- /dev/null +++ b/apps/common/main/resources/img/doc-formats/docm.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/common/main/resources/img/doc-formats/pptm.svg b/apps/common/main/resources/img/doc-formats/pptm.svg new file mode 100644 index 000000000..c3f2f8570 --- /dev/null +++ b/apps/common/main/resources/img/doc-formats/pptm.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/apps/common/main/resources/img/doc-formats/xlsm.svg b/apps/common/main/resources/img/doc-formats/xlsm.svg new file mode 100644 index 000000000..ab30655fd --- /dev/null +++ b/apps/common/main/resources/img/doc-formats/xlsm.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index d3fa08c07..5d93afa5a 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -403,12 +403,12 @@ define([ } if (this.mode.canDownload) { - !this.panels['saveas'] && (this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render())); + !this.panels['saveas'] && (this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType})).render())); } else if (this.mode.canDownloadOrigin) $('a',this.miDownload.$el).text(this.textDownload); if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - !this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render())); + !this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType})).render())); } if (this.mode.canHelp && !this.panels['help']) { diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 46994ac38..ac365b2dd 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -63,6 +63,7 @@ define([ {name: 'OTT', imgCls: 'ott', type: Asc.c_oAscFileType.OTT}, {name: 'RTF', imgCls: 'rtf', type: Asc.c_oAscFileType.RTF} ],[ + {name: 'DOCM', imgCls: 'docm', type: Asc.c_oAscFileType.DOCM}, {name: 'HTML (Zipped)', imgCls: 'html', type: Asc.c_oAscFileType.HTML}, {name: 'FB2', imgCls: 'fb2', type: Asc.c_oAscFileType.FB2}, {name: 'EPUB', imgCls: 'epub', type: Asc.c_oAscFileType.EPUB} @@ -74,9 +75,11 @@ define([ '<% _.each(rows, function(row) { %>', '', '<% _.each(row, function(item) { %>', + '<% if (item.type!==Asc.c_oAscFileType.DOCM || fileType=="docm") { %>', '
', '', '
', + '<% } %>', '<% }) %>', '', '<% }) %>', @@ -87,10 +90,11 @@ define([ Common.UI.BaseView.prototype.initialize.call(this,arguments); this.menu = options.menu; + this.fileType = options.fileType; }, render: function() { - this.$el.html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'docx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { @@ -132,6 +136,7 @@ define([ {name: 'OTT', imgCls: 'ott', type: Asc.c_oAscFileType.OTT, ext: '.ott'}, {name: 'RTF', imgCls: 'rtf', type: Asc.c_oAscFileType.RTF, ext: '.rtf'} ],[ + {name: 'DOCM', imgCls: 'docm', type: Asc.c_oAscFileType.DOCM, ext: '.docm'}, {name: 'HTML (Zipped)', imgCls: 'html', type: Asc.c_oAscFileType.HTML, ext: '.html'}, {name: 'FB2', imgCls: 'fb2', type: Asc.c_oAscFileType.FB2, ext: '.fb2'}, {name: 'EPUB', imgCls: 'epub', type: Asc.c_oAscFileType.EPUB, ext: '.epub'} @@ -143,9 +148,11 @@ define([ '<% _.each(rows, function(row) { %>', '', '<% _.each(row, function(item) { %>', + '<% if (item.type!==Asc.c_oAscFileType.DOCM || fileType=="docm") { %>', '
', '', '
', + '<% } %>', '<% }) %>', '', '<% }) %>', @@ -156,10 +163,11 @@ define([ Common.UI.BaseView.prototype.initialize.call(this,arguments); this.menu = options.menu; + this.fileType = options.fileType; }, render: function() { - this.$el.html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'docx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index 4fe8a6c3e..f72b039e4 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -315,6 +315,7 @@ + diff --git a/apps/documenteditor/main/index.html.deploy b/apps/documenteditor/main/index.html.deploy index 6387529ff..d6c0ea442 100644 --- a/apps/documenteditor/main/index.html.deploy +++ b/apps/documenteditor/main/index.html.deploy @@ -309,6 +309,7 @@ + diff --git a/apps/documenteditor/main/index_loader.html b/apps/documenteditor/main/index_loader.html index f1fe2ae1b..6b021184d 100644 --- a/apps/documenteditor/main/index_loader.html +++ b/apps/documenteditor/main/index_loader.html @@ -272,6 +272,7 @@ + diff --git a/apps/documenteditor/main/index_loader.html.deploy b/apps/documenteditor/main/index_loader.html.deploy index 13d327a22..fed071eb3 100644 --- a/apps/documenteditor/main/index_loader.html.deploy +++ b/apps/documenteditor/main/index_loader.html.deploy @@ -315,6 +315,7 @@ + diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index a6ee850eb..86f323c31 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -402,11 +402,11 @@ define([ } if (this.mode.canDownload) { - !this.panels['saveas'] && (this.panels['saveas'] = ((new PE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render())); + !this.panels['saveas'] && (this.panels['saveas'] = ((new PE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType})).render())); } if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - !this.panels['save-copy'] && (this.panels['save-copy'] = ((new PE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render())); + !this.panels['save-copy'] && (this.panels['save-copy'] = ((new PE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType})).render())); } if (this.mode.canHelp && !this.panels['help']) { diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index f4d891317..7a67b4062 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -61,6 +61,8 @@ define([ {name: 'POTX', imgCls: 'potx', type: Asc.c_oAscFileType.POTX}, {name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA}, {name: 'OTP', imgCls: 'otp', type: Asc.c_oAscFileType.OTP} + ], [ + {name: 'PPTM', imgCls: 'pptm', type: Asc.c_oAscFileType.PPTM} ]], @@ -69,9 +71,11 @@ define([ '<% _.each(rows, function(row) { %>', '', '<% _.each(row, function(item) { %>', + '<% if (item.type!==Asc.c_oAscFileType.PPTM || fileType=="pptm") { %>', '
', '', '
', + '<% } %>', '<% }) %>', '', '<% }) %>', @@ -82,10 +86,11 @@ define([ Common.UI.BaseView.prototype.initialize.call(this,arguments); this.menu = options.menu; + this.fileType = options.fileType; }, render: function() { - this.$el.html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'pptx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { @@ -124,6 +129,8 @@ define([ {name: 'POTX', imgCls: 'potx', type: Asc.c_oAscFileType.POTX, ext: '.potx'}, {name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA, ext: '.pdf'}, {name: 'OTP', imgCls: 'otp', type: Asc.c_oAscFileType.OTP, ext: '.otp'} + ], [ + {name: 'PPTM', imgCls: 'pptm', type: Asc.c_oAscFileType.PPTM, ext: '.pptm'} ]], template: _.template([ @@ -131,9 +138,11 @@ define([ '<% _.each(rows, function(row) { %>', '', '<% _.each(row, function(item) { %>', + '<% if (item.type!==Asc.c_oAscFileType.PPTM || fileType=="pptm") { %>', '
', '', '
', + '<% } %>', '<% }) %>', '', '<% }) %>', @@ -144,10 +153,11 @@ define([ Common.UI.BaseView.prototype.initialize.call(this,arguments); this.menu = options.menu; + this.fileType = options.fileType; }, render: function() { - this.$el.html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'pptx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { diff --git a/apps/presentationeditor/main/index.html b/apps/presentationeditor/main/index.html index cd541ff81..67074ee18 100644 --- a/apps/presentationeditor/main/index.html +++ b/apps/presentationeditor/main/index.html @@ -333,6 +333,7 @@ + diff --git a/apps/presentationeditor/main/index.html.deploy b/apps/presentationeditor/main/index.html.deploy index becd10047..3b81c1a8f 100644 --- a/apps/presentationeditor/main/index.html.deploy +++ b/apps/presentationeditor/main/index.html.deploy @@ -355,6 +355,7 @@ + diff --git a/apps/presentationeditor/main/index_loader.html b/apps/presentationeditor/main/index_loader.html index 2903b7bf7..085b0738d 100644 --- a/apps/presentationeditor/main/index_loader.html +++ b/apps/presentationeditor/main/index_loader.html @@ -256,6 +256,7 @@ + diff --git a/apps/presentationeditor/main/index_loader.html.deploy b/apps/presentationeditor/main/index_loader.html.deploy index 2ded00a17..885cb15ed 100644 --- a/apps/presentationeditor/main/index_loader.html.deploy +++ b/apps/presentationeditor/main/index_loader.html.deploy @@ -310,6 +310,7 @@ + diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 8ce7b08e5..f1f6a6a12 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -377,11 +377,11 @@ define([ } if (this.mode.canDownload) { - !this.panels['saveas'] && (this.panels['saveas'] = (new SSE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render()); + !this.panels['saveas'] && (this.panels['saveas'] = (new SSE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType})).render()); } if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - !this.panels['save-copy'] && (this.panels['save-copy'] = (new SSE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render()); + !this.panels['save-copy'] && (this.panels['save-copy'] = (new SSE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType})).render()); } if (this.mode.canHelp && !this.panels['help']) { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 0ba25a2ac..00f8c80a0 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -50,7 +50,8 @@ define([ ],[ {name: 'XLTX', imgCls: 'xltx', type: Asc.c_oAscFileType.XLTX}, {name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA}, - {name: 'OTS', imgCls: 'ots', type: Asc.c_oAscFileType.OTS} + {name: 'OTS', imgCls: 'ots', type: Asc.c_oAscFileType.OTS}, + {name: 'XLSM', imgCls: 'xlsm', type: Asc.c_oAscFileType.XLSM} ] // ,[ // {name: 'HTML', imgCls: 'html', type: Asc.c_oAscFileType.HTML} @@ -63,9 +64,11 @@ define([ '<% _.each(rows, function(row) { %>', '', '<% _.each(row, function(item) { %>', + '<% if (item.type!==Asc.c_oAscFileType.XLSM || fileType=="xlsm") { %>', '
', '', '
', + '<% } %>', '<% }) %>', '', '<% }) %>', @@ -76,10 +79,11 @@ define([ Common.UI.BaseView.prototype.initialize.call(this,arguments); this.menu = options.menu; + this.fileType = options.fileType; }, render: function() { - this.$el.html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'xlsx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { @@ -118,7 +122,8 @@ define([ ],[ {name: 'XLTX', imgCls: 'xltx', type: Asc.c_oAscFileType.XLTX, ext: '.xltx'}, {name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA, ext: '.pdf'}, - {name: 'OTS', imgCls: 'ots', type: Asc.c_oAscFileType.OTS, ext: '.ots'} + {name: 'OTS', imgCls: 'ots', type: Asc.c_oAscFileType.OTS, ext: '.ots'}, + {name: 'XLSM', imgCls: 'xlsm', type: Asc.c_oAscFileType.XLSM, ext: '.xlsm'} ] // ,[ // {name: 'HTML', imgCls: 'html', type: Asc.c_oAscFileType.HTML, ext: '.html'} @@ -130,9 +135,11 @@ define([ '<% _.each(rows, function(row) { %>', '', '<% _.each(row, function(item) { %>', + '<% if (item.type!==Asc.c_oAscFileType.XLSM || fileType=="xlsm") { %>', '
', '', '
', + '<% } %>', '<% }) %>', '', '<% }) %>', @@ -143,10 +150,11 @@ define([ Common.UI.BaseView.prototype.initialize.call(this,arguments); this.menu = options.menu; + this.fileType = options.fileType; }, render: function() { - this.$el.html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'xlsx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { diff --git a/apps/spreadsheeteditor/main/index.html b/apps/spreadsheeteditor/main/index.html index 3fc0f9f9f..2905c495e 100644 --- a/apps/spreadsheeteditor/main/index.html +++ b/apps/spreadsheeteditor/main/index.html @@ -350,6 +350,7 @@ + diff --git a/apps/spreadsheeteditor/main/index.html.deploy b/apps/spreadsheeteditor/main/index.html.deploy index bf6708198..ece2f660a 100644 --- a/apps/spreadsheeteditor/main/index.html.deploy +++ b/apps/spreadsheeteditor/main/index.html.deploy @@ -369,6 +369,7 @@ + diff --git a/apps/spreadsheeteditor/main/index_loader.html b/apps/spreadsheeteditor/main/index_loader.html index 8c6425661..baad09906 100644 --- a/apps/spreadsheeteditor/main/index_loader.html +++ b/apps/spreadsheeteditor/main/index_loader.html @@ -259,6 +259,7 @@ + diff --git a/apps/spreadsheeteditor/main/index_loader.html.deploy b/apps/spreadsheeteditor/main/index_loader.html.deploy index 884f65146..82e13fd12 100644 --- a/apps/spreadsheeteditor/main/index_loader.html.deploy +++ b/apps/spreadsheeteditor/main/index_loader.html.deploy @@ -310,6 +310,7 @@ +