[Embedded] Change settings menu

This commit is contained in:
Julia Radzhabova 2021-05-19 17:29:13 +03:00
parent 892fd142ac
commit 23ac69f964
4 changed files with 62 additions and 14 deletions

View file

@ -229,28 +229,56 @@ DE.ApplicationController = new(function(){
var zf = (config.customization && config.customization.zoom ? parseInt(config.customization.zoom) : -2);
(zf == -1) ? api.zoomFitToPage() : ((zf == -2) ? api.zoomFitToWidth() : api.zoom(zf>0 ? zf : 100));
if ( !embedConfig.saveUrl && permissions.print === false)
$('#idt-download').hide();
var dividers = $('#box-tools .divider');
var itemsCount = $('#box-tools a').length;
if ( permissions.print === false)
if ( permissions.print === false) {
$('#idt-print').hide();
$(dividers[0]).hide();
itemsCount--;
}
if ( !embedConfig.shareUrl || appOptions.canFillForms)
if ( !embedConfig.saveUrl && permissions.print === false || appOptions.canFillForms) {
$('#idt-download').hide();
itemsCount--;
}
if ( !appOptions.canFillForms || permissions.download === false) {
$('#idt-download-docx').hide();
$('#idt-download-pdf').hide();
$(dividers[0]).hide();
$(dividers[1]).hide();
itemsCount -= 2;
}
if ( !embedConfig.shareUrl || appOptions.canFillForms) {
$('#idt-share').hide();
itemsCount--;
}
if (!config.canBackToFolder)
$('#id-close').hide();
if (!config.canBackToFolder) {
$('#idt-close').hide();
itemsCount--;
}
if ( !embedConfig.embedUrl || appOptions.canFillForms)
if (itemsCount<3)
$(dividers[2]).hide();
if ( !embedConfig.embedUrl || appOptions.canFillForms) {
$('#idt-embed').hide();
itemsCount--;
}
if ( !embedConfig.fullscreenUrl )
if ( !embedConfig.fullscreenUrl ) {
$('#idt-fullscreen').hide();
itemsCount--;
}
if ( !embedConfig.saveUrl && permissions.print === false && (!embedConfig.shareUrl || appOptions.canFillForms) && (!embedConfig.embedUrl || appOptions.canFillForms) && !embedConfig.fullscreenUrl && !config.canBackToFolder)
// 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)
$('#box-tools .divider').hide();
$(dividers[2]).hide();
common.controller.modals.attach({
share: '#idt-share',
@ -304,6 +332,20 @@ DE.ApplicationController = new(function(){
}
});
var downloadAs = function(format){
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
Common.Analytics.trackEvent('Save');
};
DE.ApplicationView.tools.get('#idt-download-docx')
.on('click', function(){
downloadAs(Asc.c_oAscFileType.DOCX);
});
DE.ApplicationView.tools.get('#idt-download-pdf')
.on('click', function(){
downloadAs(Asc.c_oAscFileType.PDF);
});
$('#id-btn-zoom-in').on('click', api.zoomIn.bind(this));
$('#id-btn-zoom-out').on('click', api.zoomOut.bind(this));

View file

@ -46,7 +46,11 @@ DE.ApplicationView = new(function(){
$btnTools.parent().append(
'<ul class="dropdown-menu pull-right">' +
'<li><a id="idt-print"><span class="mi-icon svg-icon print"></span>' + this.txtPrint + '</a></li>' +
'<li class="divider"></li>' +
'<li><a id="idt-download"><span class="mi-icon svg-icon download"></span>' + this.txtDownload + '</a></li>' +
'<li><a id="idt-download-docx"><span class="mi-icon svg-icon download"></span>' + this.txtDownloadDocx + '</a></li>' +
'<li><a id="idt-download-pdf"><span class="mi-icon"></span>' + this.txtDownloadPdf + '</a></li>' +
'<li class="divider"></li>' +
'<li><a id="idt-share" data-toggle="modal"><span class="mi-icon svg-icon share"></span>' + this.txtShare + '</a></li>' +
'<li><a id="idt-close" data-toggle="modal"><span class="mi-icon svg-icon go-to-location"></span>' + this.txtFileLocation + '</a></li>' +
'<li class="divider"></li>' +
@ -70,6 +74,8 @@ DE.ApplicationView = new(function(){
txtShare: 'Share',
txtEmbed: 'Embed',
txtFullScreen: 'Full Screen',
txtFileLocation: 'Open file location'
txtFileLocation: 'Open file location',
txtDownloadDocx: 'Download as docx',
txtDownloadPdf: 'Download as pdf'
}
})();

View file

@ -242,7 +242,7 @@ PE.ApplicationController = new(function(){
$('#idt-share').hide();
if (!config.canBackToFolder)
$('#id-close').hide();
$('#idt-close').hide();
if ( !embedConfig.embedUrl )
$('#idt-embed').hide();

View file

@ -192,7 +192,7 @@ SSE.ApplicationController = new(function(){
$('#idt-share').hide();
if (!config.canBackToFolder)
$('#id-close').hide();
$('#idt-close').hide();
if ( !embedConfig.embedUrl )
$('#idt-embed').hide();