[Embedded] Fix Bug 49866

This commit is contained in:
Julia Radzhabova 2021-09-29 17:45:40 +03:00
parent fa9fd8d971
commit 1b4cc723ea
4 changed files with 12 additions and 24 deletions

View file

@ -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');

View file

@ -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--;
}

View file

@ -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');

View file

@ -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');