[SSE] Fix Bug 34914

This commit is contained in:
Julia Radzhabova 2018-04-05 14:29:37 +03:00
parent eac9000bd8
commit 1aed6a07f5
7 changed files with 44 additions and 15 deletions

View file

@ -10,6 +10,7 @@
### Spreadsheet Editor ### Spreadsheet Editor
* Support Spanish in formulas * Support Spanish in formulas
* Set options for saving in PDF format
### Presentation Editor ### Presentation Editor
* *

View file

@ -262,6 +262,9 @@ define([
} }
}, this) }, this)
}); });
} else if (format == Asc.c_oAscFileType.PDF) {
menu.hide();
Common.NotificationCenter.trigger('download:settings', this.leftMenu);
} else { } else {
this.api.asc_DownloadAs(format); this.api.asc_DownloadAs(format);
menu.hide(); menu.hide();

View file

@ -412,7 +412,10 @@ define([
if ( !_format || _supported.indexOf(_format) < 0 ) if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.XLSX; _format = Asc.c_oAscFileType.XLSX;
this.api.asc_DownloadAs(_format, true); if (_format == Asc.c_oAscFileType.PDF)
Common.NotificationCenter.trigger('download:settings', this, true);
else
this.api.asc_DownloadAs(_format, true);
}, },
onProcessMouse: function(data) { onProcessMouse: function(data) {

View file

@ -69,7 +69,8 @@ define([
onAfterRender: function(view) { onAfterRender: function(view) {
this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings)); this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings));
this.printSettings.btnOk.on('click', _.bind(this.querySavePrintSettings, this)); this.printSettings.btnOk.on('click', _.bind(this.querySavePrintSettings, this));
Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this)); Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this, 'print'));
Common.NotificationCenter.on('download:settings', _.bind(this.openPrintSettings, this, 'download'));
this.registerControlEvents(this.printSettings); this.registerControlEvents(this.printSettings);
}, },
@ -219,9 +220,11 @@ define([
} }
}, },
openPrintSettings: function(btn) { openPrintSettings: function(type, cmp, asUrl) {
if (this.api) { if (this.api) {
this.asUrl = asUrl;
this.printSettingsDlg = (new SSE.Views.PrintSettings({ this.printSettingsDlg = (new SSE.Views.PrintSettings({
type: type,
handler: _.bind(this.resultPrintSettings,this), handler: _.bind(this.resultPrintSettings,this),
afterrender: _.bind(function() { afterrender: _.bind(function() {
this._changedProps = []; this._changedProps = [];
@ -245,10 +248,12 @@ define([
this.adjPrintParams.asc_setPrintType(printtype); this.adjPrintParams.asc_setPrintType(printtype);
Common.localStorage.setItem("sse-print-settings-range", printtype); Common.localStorage.setItem("sse-print-settings-range", printtype);
this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); if ( this.printSettingsDlg.type=='print' )
this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera);
Common.component.Analytics.trackEvent('Print'); else
Common.component.Analytics.trackEvent('ToolBar', 'Print'); this.api.asc_DownloadAs(Asc.c_oAscFileType.PDF, this.asUrl, this.adjPrintParams);
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); Common.NotificationCenter.trigger('edit:complete', view);
} else } else
return true; return true;

View file

@ -107,7 +107,10 @@ define([
if ( !_format || _supported.indexOf(_format) < 0 ) if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.PDF; _format = Asc.c_oAscFileType.PDF;
_main.api.asc_DownloadAs(_format); if (_format == Asc.c_oAscFileType.PDF)
Common.NotificationCenter.trigger('download:settings', this.toolbar);
else
_main.api.asc_DownloadAs(_format);
}, },
'go:editor': function() { 'go:editor': function() {
Common.Gateway.requestEditRights(); Common.Gateway.requestEditRights();

View file

@ -55,25 +55,26 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
}, },
initialize : function(options) { initialize : function(options) {
this.type = options.type || 'print';
_.extend(this.options, { _.extend(this.options, {
title: this.textTitle, title: (this.type == 'print') ? this.textTitle : this.textTitlePDF,
template: [ template: [
'<div class="box" style="height:' + (this.options.height-85) + 'px;">', '<div class="box" style="height:' + (this.options.height-85) + 'px;">',
'<div class="menu-panel" style="overflow: hidden;">', '<div class="menu-panel" style="overflow: hidden;">',
'<div style="height: 42px; line-height: 42px;" class="div-category">' + this.textPrintRange + '</div>', '<div style="height: 42px; line-height: 42px;" class="div-category">' + ((this.type == 'print') ? this.textPrintRange : this.textRange)+ '</div>',
'<div style="height: 52px; line-height: 66px;" class="div-category">' + this.textSettings + '</div>', '<div style="height: 52px; line-height: 66px;" class="div-category">' + this.textSettings + '</div>',
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageSize + '</div>', '<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageSize + '</div>',
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageOrientation + '</div>', '<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageOrientation + '</div>',
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageScaling + '</div>', '<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageScaling + '</div>',
'<div style="height: 108px; line-height: 33px;" class="div-category">' + this.strMargins + '</div>', '<div style="height: 108px; line-height: 33px;" class="div-category">' + this.strMargins + '</div>',
'<div style="height: 58px; line-height: 40px;" class="div-category">' + this.strPrint + '</div>', '<div style="height: 58px; line-height: 40px;" class="div-category">' + ((this.type == 'print') ? this.strPrint : this.strShow) + '</div>',
'</div>', '</div>',
'<div class="content-panel">' + _.template(contentTemplate)({scope: this}) + '</div>', '<div class="content-panel">' + _.template(contentTemplate)({scope: this}) + '</div>',
'</div>', '</div>',
'<div class="separator horizontal"/>', '<div class="separator horizontal"/>',
'<div class="footer justify">', '<div class="footer justify">',
'<button id="printadv-dlg-btn-hide" class="btn btn-text-default" style="margin-right: 55px; width: 100px;">' + this.textHideDetails + '</button>', '<button id="printadv-dlg-btn-hide" class="btn btn-text-default" style="margin-right: 55px; width: 100px;">' + this.textHideDetails + '</button>',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 150px;">' + this.btnPrint + '</button>', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 150px;">' + ((this.type == 'print') ? this.btnPrint : this.btnDownload) + '</button>',
'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.cancelButtonText + '</button>', '<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.cancelButtonText + '</button>',
'</div>' '</div>'
].join('') ].join('')
@ -145,12 +146,12 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
this.chPrintGrid = new Common.UI.CheckBox({ this.chPrintGrid = new Common.UI.CheckBox({
el: $('#printadv-dlg-chb-grid'), el: $('#printadv-dlg-chb-grid'),
labelText: this.textPrintGrid labelText: (this.type == 'print') ? this.textPrintGrid : this.textShowGrid
}); });
this.chPrintRows = new Common.UI.CheckBox({ this.chPrintRows = new Common.UI.CheckBox({
el: $('#printadv-dlg-chb-rows'), el: $('#printadv-dlg-chb-rows'),
labelText: this.textPrintHeadings labelText: (this.type == 'print') ? this.textPrintHeadings : this.textShowHeadings
}); });
this.spnMarginTop = new Common.UI.MetricSpinner({ this.spnMarginTop = new Common.UI.MetricSpinner({
@ -301,6 +302,13 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
textHideDetails: 'Hide Details', textHideDetails: 'Hide Details',
textPageScaling: 'Scaling', textPageScaling: 'Scaling',
textSettings: 'Sheet Settings' textSettings: 'Sheet Settings',
textTitlePDF: 'PDF Settings',
textShowGrid: 'Show Gridlines',
textShowHeadings: 'Show Rows and Columns Headings',
strShow: 'Show',
btnDownload: 'Save & Download',
textRange: 'Range'
}, SSE.Views.PrintSettings || {})); }, SSE.Views.PrintSettings || {}));
}); });

View file

@ -1543,6 +1543,12 @@
"SSE.Views.PrintSettings.textSettings": "Sheet Settings", "SSE.Views.PrintSettings.textSettings": "Sheet Settings",
"SSE.Views.PrintSettings.textShowDetails": "Show Details", "SSE.Views.PrintSettings.textShowDetails": "Show Details",
"SSE.Views.PrintSettings.textTitle": "Print Settings", "SSE.Views.PrintSettings.textTitle": "Print Settings",
"SSE.Views.PrintSettings.textTitlePDF": "PDF Settings",
"SSE.Views.PrintSettings.textShowGrid": "Show Gridlines",
"SSE.Views.PrintSettings.textShowHeadings": "Show Rows and Columns Headings",
"SSE.Views.PrintSettings.strShow": "Show",
"SSE.Views.PrintSettings.btnDownload": "Save & Download",
"SSE.Views.PrintSettings.textRange": "Range",
"SSE.Views.RightMenu.txtChartSettings": "Chart settings", "SSE.Views.RightMenu.txtChartSettings": "Chart settings",
"SSE.Views.RightMenu.txtImageSettings": "Image settings", "SSE.Views.RightMenu.txtImageSettings": "Image settings",
"SSE.Views.RightMenu.txtParagraphSettings": "Text settings", "SSE.Views.RightMenu.txtParagraphSettings": "Text settings",