diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index b0d32fcc3..f3b577b53 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -401,7 +401,7 @@ DE.ApplicationController = new(function(){ itemsCount--; } - if ( !embedConfig.saveUrl && permissions.print === false || appOptions.canFillForms) { + if ( !embedConfig.saveUrl || permissions.download === false || appOptions.canFillForms) { $('#idt-download').hide(); itemsCount--; } @@ -437,7 +437,6 @@ DE.ApplicationController = new(function(){ itemsCount--; } - // if ( !embedConfig.saveUrl && permissions.print === false && (!embedConfig.shareUrl || appOptions.canFillForms) && (!embedConfig.embedUrl || appOptions.canFillForms) && !embedConfig.fullscreenUrl && !config.canBackToFolder) if (itemsCount<1) $('#box-tools').addClass('hidden'); else if ((!embedConfig.embedUrl || appOptions.canFillForms) && !embedConfig.fullscreenUrl) @@ -475,11 +474,8 @@ DE.ApplicationController = new(function(){ DE.ApplicationView.tools.get('#idt-download') .on('click', function(){ - if ( !!embedConfig.saveUrl ){ + if ( !!embedConfig.saveUrl && permissions.download !== false){ common.utils.openLink(embedConfig.saveUrl); - } else - if (api && permissions.print!==false){ - api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86)); } Common.Analytics.trackEvent('Save'); diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 5a5c6d99e..a5186e34c 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -456,9 +456,7 @@ define([ this.appOptions.canFillForms = this.appOptions.canLicense && (this.permissions.fillForms===true) && (this.editorConfig.mode !== 'view'); this.api.asc_setViewMode(!this.appOptions.canFillForms); - var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); - this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string'); - this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string'); + this.appOptions.canDownload = this.permissions.download !== false; this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.fileKey = this.document.key; @@ -776,11 +774,11 @@ define([ }, onDownloadAs: function() { - if ( !this.appOptions.canDownload && !this.appOptions.canDownloadOrigin ) { + if ( !this.appOptions.canDownload ) { Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny); return; } - var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); + var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType); if (type && typeof type[1] === 'string') this.api.asc_DownloadOrigin(true); else @@ -1116,7 +1114,7 @@ define([ itemsCount--; } - if ( !this.embedConfig.saveUrl && !this.appOptions.canPrint || this.appOptions.canFillForms) { + if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.canFillForms) { menuItems[2].setVisible(false); itemsCount--; } diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 256fb4e11..8317bc3f2 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -261,7 +261,7 @@ PE.ApplicationController = new(function(){ if ( permissions.print === false) $('#idt-print').hide(); - if (!embedConfig.saveUrl && permissions.print === false) + if (!embedConfig.saveUrl || permissions.download === false) $('#idt-download').hide(); if ( !embedConfig.shareUrl ) @@ -276,7 +276,7 @@ PE.ApplicationController = new(function(){ if ( !embedConfig.fullscreenUrl ) $('#idt-fullscreen').hide(); - if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder) + if ( (!embedConfig.saveUrl || permissions.download === false) && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder) $('#box-tools').addClass('hidden'); else if (!embedConfig.embedUrl && !embedConfig.fullscreenUrl) $('#box-tools .divider').hide(); @@ -311,11 +311,8 @@ PE.ApplicationController = new(function(){ PE.ApplicationView.tools.get('#idt-download') .on('click', function(){ - if ( !!embedConfig.saveUrl ){ + if ( !!embedConfig.saveUrl && permissions.download !== false){ common.utils.openLink(embedConfig.saveUrl); - } else - if (api && permissions.print!==false){ - api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86)); } Common.Analytics.trackEvent('Save'); diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 29c6e574e..0bfa8b6d6 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -203,7 +203,7 @@ SSE.ApplicationController = new(function(){ if ( permissions.print === false) $('#idt-print').hide(); - if ( !embedConfig.saveUrl && permissions.print === false) + if ( !embedConfig.saveUrl || permissions.download === false) $('#idt-download').hide(); if ( !embedConfig.shareUrl ) @@ -218,7 +218,7 @@ SSE.ApplicationController = new(function(){ if ( !embedConfig.fullscreenUrl ) $('#idt-fullscreen').hide(); - if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder) + if ( (!embedConfig.saveUrl || permissions.download === false) && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder) $('#box-tools').addClass('hidden'); else if (!embedConfig.embedUrl && !embedConfig.fullscreenUrl) $('#box-tools .divider').hide(); @@ -246,11 +246,8 @@ SSE.ApplicationController = new(function(){ SSE.ApplicationView.tools.get('#idt-download') .on('click', function(){ - if ( !!embedConfig.saveUrl ){ + if ( !!embedConfig.saveUrl && permissions.download !== false){ common.utils.openLink(embedConfig.saveUrl); - } else - if (permissions.print!==false){ - api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86)); } Common.Analytics.trackEvent('Save');