Merge branch 'hotfix/v7.2.2' of https://github.com/ONLYOFFICE/web-apps into hotfix/v7.2.2

This commit is contained in:
Maxim Kadushkin 2022-11-16 00:08:44 +03:00
commit 2d2958e07b
8 changed files with 140 additions and 52 deletions

View file

@ -1494,7 +1494,7 @@ define([
}
this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit;
this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac;
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac && this.appOptions.isDesktopApp;
this.appOptions.canRename = this.editorConfig.canRename;
this.appOptions.buildVersion = params.asc_getBuildVersion();
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);

View file

@ -42,14 +42,10 @@ define([
],
initialize: function() {
var value = Common.localStorage.getItem("de-print-settings-range");
value = (value!==null) ? parseInt(value) : Asc.c_oAscPrintType.ActiveSheets;
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this.adjPrintParams.asc_setPrintType(value);
this._state = {
lock_doc: false
lock_doc: false,
firstPrintPage: 0
};
this._navigationPreview = {
@ -118,7 +114,7 @@ define([
}
}
if (res.length>0) {
// me.adjPrintParams.asc_setPages(res);
me._state.firstPrintPage = res[0];
return true;
}
}
@ -135,8 +131,6 @@ define([
var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this));
this.fillPrintOptions();
},
setMode: function (mode) {
@ -224,23 +218,14 @@ define([
}
},
fillPrintOptions: function(props) {
// fill page numbers, copies, collated
var panel = this.printSettings;
panel.cmbRange.setValue(this.adjPrintParams.asc_getPrintType());
panel.inputPages.setValue(''); // pages numbers
},
comboRangeChange: function(combo, record) {
if (record.value === -1) {
var me = this;
setTimeout(function(){
me.printSettings.inputPages.focus();
}, 50);
// this.adjPrintParams.asc_setPrintType(record.value)
} else {
this.printSettings.inputPages.setValue('');
this.adjPrintParams.asc_setPrintType(record.value)
}
this.printSettings.inputPages.showError();
},
@ -501,8 +486,18 @@ define([
this.isInputFirstChange = true;
return;
}
this._isPrint = print;
if (this.printSettings.cmbRange.getValue()==='all')
this._state.firstPrintPage = 0;
else if (this.printSettings.cmbRange.getValue()==='current')
this._state.firstPrintPage = this._navigationPreview.currentPage;
this.adjPrintParams.asc_setNativeOptions({
pages: this.printSettings.cmbRange.getValue()===-1 ? this.printSettings.inputPages.getValue() : this.printSettings.cmbRange.getValue(),
paperSize: this._state.pgsize, //this.api.asc_getPageSize(this._state.firstPrintPage),
paperOrientation: this._state.pgorient ? 'portrait' : 'landscape' // this.api.asc_getPageOrient(this._state.firstPrintPage) ? 'portrait' : 'landscape'
});
this._isPrint = print;
if ( print ) {
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
opts.asc_setAdvancedOptions(this.adjPrintParams);
@ -521,7 +516,7 @@ define([
this.isInputFirstChange = false;
if (value.length<1)
this.printSettings.cmbRange.setValue(Asc.c_oAscPrintType.EntireWorkbook);
this.printSettings.cmbRange.setValue('all');
else if (this.printSettings.cmbRange.getValue()!==-1)
this.printSettings.cmbRange.setValue(-1);
},

View file

@ -2399,14 +2399,15 @@ define([
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: Asc.c_oAscPrintType.EntireWorkbook, displayValue: this.txtAllPages },
{ value: Asc.c_oAscPrintType.ActiveSheets, displayValue: this.txtCurrentPage },
{ value: 'all', displayValue: this.txtAllPages },
{ value: 'current', displayValue: this.txtCurrentPage },
{ value: -1, displayValue: this.txtCustomPages }
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbRange.setValue('all');
this.inputPages = new Common.UI.InputField({
el: $markup.findById('#print-txt-pages'),
@ -2484,10 +2485,10 @@ define([
'<li id="<%= item.id %>" data-value="<%- item.value %>"><a tabindex="-1" type="menuitem">',
'<div><b><%= scope.getDisplayValue(item) %></b></div>',
'<% if (item.size !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;">' +
'<label style="display: block;">' + this.txtTop + ' <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.txtLeft + ' <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><div style="display: inline-block;">' +
'<label style="display: block;">' + this.txtBottom + ' <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[2]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.txtRight + ' <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[3]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div>' +
'<label style="display: block;">' + this.txtTop + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.txtLeft + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><div style="display: inline-block;">' +
'<label style="display: block;">' + this.txtBottom + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[2]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.txtRight + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[3]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div>' +
'<% } %>',
'<% }); %>'
].join('')),
@ -2647,10 +2648,10 @@ define([
txtLandscape: 'Landscape',
txtCustom: 'Custom',
txtMargins: 'Margins',
txtTop: 'Top:',
txtBottom: 'Bottom:',
txtLeft: 'Left:',
txtRight: 'Right:',
txtTop: 'Top',
txtBottom: 'Bottom',
txtLeft: 'Left',
txtRight: 'Right',
txtPage: 'Page',
txtOf: 'of {0}',
txtPageNumInvalid: 'Page number invalid',

View file

@ -951,6 +951,9 @@
"DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled",
"DE.Controllers.Statusbar.tipReview": "Track changes",
"DE.Controllers.Statusbar.zoomText": "Zoom {0}%",
"DE.Controllers.Print.txtCustom": "Custom",
"DE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range",
"DE.Controllers.Print.textMarginsLast": "Last Custom",
"DE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",
"DE.Controllers.Toolbar.dataUrl": "Paste a data URL",
"DE.Controllers.Toolbar.notcriticalErrorTitle": "Warning",
@ -2384,6 +2387,33 @@
"DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only",
"DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
"DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders",
"DE.Views.PrintWithPreview.txtPrint": "Print",
"DE.Views.PrintWithPreview.txtPrintPdf": "Print to PDF",
"DE.Views.PrintWithPreview.txtPrintRange": "Print range",
"DE.Views.PrintWithPreview.txtCurrentPage": "Current page",
"DE.Views.PrintWithPreview.txtAllPages": "All pages",
"DE.Views.PrintWithPreview.txtSelection": "Selection",
"DE.Views.PrintWithPreview.txtCustomPages": "Custom print",
"DE.Views.PrintWithPreview.txtPageSize": "Page size",
"DE.Views.PrintWithPreview.txtPageOrientation": "Page orientation",
"DE.Views.PrintWithPreview.txtPortrait": "Portrait",
"DE.Views.PrintWithPreview.txtLandscape": "Landscape",
"DE.Views.PrintWithPreview.txtCustom": "Custom",
"DE.Views.PrintWithPreview.txtMargins": "Margins",
"DE.Views.PrintWithPreview.txtTop": "Top",
"DE.Views.PrintWithPreview.txtBottom": "Bottom",
"DE.Views.PrintWithPreview.txtLeft": "Left",
"DE.Views.PrintWithPreview.txtRight": "Right",
"DE.Views.PrintWithPreview.txtPage": "Page",
"DE.Views.PrintWithPreview.txtOf": "of {0}",
"DE.Views.PrintWithPreview.txtPageNumInvalid": "Page number invalid",
"DE.Views.PrintWithPreview.txtPages": "Pages",
"DE.Views.PrintWithPreview.textMarginsLast": "Last Custom",
"DE.Views.PrintWithPreview.textMarginsNormal": "Normal",
"DE.Views.PrintWithPreview.textMarginsUsNormal": "US Normal",
"DE.Views.PrintWithPreview.textMarginsNarrow": "Narrow",
"DE.Views.PrintWithPreview.textMarginsModerate": "Moderate",
"DE.Views.PrintWithPreview.textMarginsWide": "Wide",
"DE.Views.RightMenu.txtChartSettings": "Chart settings",
"DE.Views.RightMenu.txtFormSettings": "Form Settings",
"DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings",

View file

@ -1165,7 +1165,7 @@ define([
console.log("Obsolete: The 'chat' parameter of the 'customization' section is deprecated. Please use 'chat' parameter in the permissions instead.");
}
this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac;
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac && this.appOptions.isDesktopApp;
this.appOptions.canRename = this.editorConfig.canRename;
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
this.appOptions.forcesave = this.appOptions.canForcesave;

View file

@ -42,11 +42,7 @@ define([
],
initialize: function() {
var value = Common.localStorage.getItem("pe-print-settings-range");
value = (value!==null) ? parseInt(value) : Asc.c_oAscPrintType.ActiveSheets;
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this.adjPrintParams.asc_setPrintType(value);
this._state = {};
@ -113,7 +109,6 @@ define([
}
}
if (res.length>0) {
// me.adjPrintParams.asc_setPages(res);
return true;
}
}
@ -129,8 +124,6 @@ define([
var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this));
this.fillPrintOptions();
},
setMode: function (mode) {
@ -146,23 +139,14 @@ define([
return this;
},
fillPrintOptions: function(props) {
// fill page numbers, copies, collated
var panel = this.printSettings;
panel.cmbRange.setValue(this.adjPrintParams.asc_getPrintType());
panel.inputPages.setValue(''); // pages numbers
},
comboRangeChange: function(combo, record) {
if (record.value === -1) {
var me = this;
setTimeout(function(){
me.printSettings.inputPages.focus();
}, 50);
// this.adjPrintParams.asc_setPrintType(record.value)
} else {
this.printSettings.inputPages.setValue('');
this.adjPrintParams.asc_setPrintType(record.value)
}
this.printSettings.inputPages.showError();
},
@ -307,6 +291,12 @@ define([
if (this._navigationPreview.pageCount<1)
return;
var rec = this.printSettings.cmbPaperSize.getSelectedRecord();
this.adjPrintParams.asc_setNativeOptions({
pages: this.printSettings.cmbRange.getValue()===-1 ? this.printSettings.inputPages.getValue() : this.printSettings.cmbRange.getValue(),
paperSize: rec ? rec.size : null
});
this._isPrint = print;
if ( print ) {
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
@ -326,7 +316,7 @@ define([
this.isInputFirstChange = false;
if (value.length<1)
this.printSettings.cmbRange.setValue(Asc.c_oAscPrintType.EntireWorkbook);
this.printSettings.cmbRange.setValue('all');
else if (this.printSettings.cmbRange.getValue()!==-1)
this.printSettings.cmbRange.setValue(-1);
},

View file

@ -1839,6 +1839,8 @@ define([
'<td><%= scope.txtPages %></td><td><div id="print-txt-pages" style="width: 100%;padding-left: 5px;"></div></td>',
'</tr></tbody></table>',
'</td></tr>',
'<tr><td><label class="header"><%= scope.txtPaperSize %></label></td></tr>',
'<tr><td class="padding-large"><div id="print-combo-pages" style="width: 248px;"></div></td></tr>',
'<tr class="fms-btn-apply"><td>',
'<div class="footer justify">',
'<button id="print-btn-print" class="btn normal dlg-btn primary" result="print" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button>',
@ -1872,6 +1874,8 @@ define([
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.menu = options.menu;
this._initSettings = true;
},
render: function(node) {
@ -1886,14 +1890,15 @@ define([
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: Asc.c_oAscPrintType.EntireWorkbook, displayValue: this.txtAllPages },
{ value: Asc.c_oAscPrintType.ActiveSheets, displayValue: this.txtCurrentPage },
{ value: 'all', displayValue: this.txtAllPages },
{ value: 'current', displayValue: this.txtCurrentPage },
{ value: -1, displayValue: this.txtCustomPages }
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbRange.setValue('all');
this.inputPages = new Common.UI.InputField({
el: $markup.findById('#print-txt-pages'),
@ -1906,6 +1911,37 @@ define([
dataHintOffset: 'small'
});
this.cmbPaperSize = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-pages'),
menuStyle: 'max-height: 280px; min-width: 248px;',
editable: false,
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: 0, displayValue:'US Letter (21,59cm x 27,94cm)', caption: 'US Letter', size: [215.9, 279.4]},
{ value: 1, displayValue:'US Legal (21,59cm x 35,56cm)', caption: 'US Legal', size: [215.9, 355.6]},
{ value: 2, displayValue:'A4 (21cm x 29,7cm)', caption: 'A4', size: [210, 297]},
{ value: 3, displayValue:'A5 (14,8cm x 21cm)', caption: 'A5', size: [148, 210]},
{ value: 4, displayValue:'B5 (17,6cm x 25cm)', caption: 'B5', size: [176, 250]},
{ value: 5, displayValue:'Envelope #10 (10,48cm x 24,13cm)', caption: 'Envelope #10', size: [104.8, 241.3]},
{ value: 6, displayValue:'Envelope DL (11cm x 22cm)', caption: 'Envelope DL', size: [110, 220]},
{ value: 7, displayValue:'Tabloid (27,94cm x 43,18cm)', caption: 'Tabloid', size: [279.4, 431.8]},
{ value: 8, displayValue:'A3 (29,7cm x 42cm)', caption: 'A3', size: [297, 420]},
{ value: 9, displayValue:'Tabloid Oversize (30,48cm x 45,71cm)', caption: 'Tabloid Oversize', size: [304.8, 457.1]},
{ value: 10, displayValue:'ROC 16K (19,68cm x 27,3cm)', caption: 'ROC 16K', size: [196.8, 273]},
{ value: 11, displayValue:'Envelope Choukei 3 (11,99cm x 23,49cm)', caption: 'Envelope Choukei 3', size: [119.9, 234.9]},
{ value: 12, displayValue:'Super B/A3 (33,02cm x 48,25cm)', caption: 'Super B/A3', size: [330.2, 482.5]},
{ value: 13, displayValue:'A4 (84,1cm x 118,9cm)', caption: 'A0', size: [841, 1189]},
{ value: 14, displayValue:'A4 (59,4cm x 84,1cm)', caption: 'A1', size: [594, 841]},
{ value: 16, displayValue:'A4 (42cm x 59,4cm)', caption: 'A2', size: [420, 594]},
{ value: 17, displayValue:'A4 (10,5cm x 14,8cm)', caption: 'A6', size: [105, 148]}
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbPaperSize.setValue(2);
this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings');
this.pnlTable = $(this.pnlSettings.find('table')[0]);
this.trApply = $markup.find('.fms-btn-apply');
@ -1973,6 +2009,8 @@ define([
}
});
this.updateMetricUnit();
this.fireEvent('render:after', this);
return this;
@ -1980,6 +2018,10 @@ define([
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
if (this._initSettings) {
this.updateMetricUnit();
this._initSettings = false;
}
this.updateScroller();
this.fireEvent('show', this);
},
@ -2024,6 +2066,22 @@ define([
this.txtNumberPage.setValue(index + 1);
},
updateMetricUnit: function() {
var store = this.cmbPaperSize.store;
for (var i=0; i<store.length; i++) {
var item = store.at(i),
size = item.get('size'),
pagewidth = size[0],
pageheight = size[1];
item.set('displayValue', item.get('caption') + ' (' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(pagewidth).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ' x ' +
parseFloat(Common.Utils.Metric.fnRecalcFromMM(pageheight).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ')');
}
var value = this.cmbPaperSize.getValue();
this.cmbPaperSize.onResetItems();
this.cmbPaperSize.setValue(value);
},
txtPrint: 'Print',
txtPrintPdf: 'Print to PDF',
txtPrintRange: 'Print range',
@ -2034,7 +2092,8 @@ define([
txtOf: 'of {0}',
txtPageNumInvalid: 'Slide number invalid',
txtEmptyTable: 'There is nothing to print because the presentation is empty',
txtPages: 'Slides'
txtPages: 'Slides',
txtPaperSize: 'Paper size'
}, PE.Views.PrintWithPreview || {}));
});

View file

@ -1010,6 +1010,7 @@
"PE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"PE.Controllers.Main.textUndo": "Undo",
"PE.Controllers.Main.textContinue": "Continue",
"PE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range",
"PE.Controllers.Search.notcriticalErrorTitle": "Warning",
"PE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
"PE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",
@ -1849,6 +1850,18 @@
"PE.Views.ParagraphSettingsAdvanced.textTabRight": "Right",
"PE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced Settings",
"PE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
"PE.Views.PrintWithPreview.txtPrint": "Print",
"PE.Views.PrintWithPreview.txtPrintPdf": "Print to PDF",
"PE.Views.PrintWithPreview.txtPrintRange": "Print range",
"PE.Views.PrintWithPreview.txtCurrentPage": "Current slide",
"PE.Views.PrintWithPreview.txtAllPages": "All slides",
"PE.Views.PrintWithPreview.txtCustomPages": "Custom print",
"PE.Views.PrintWithPreview.txtPage": "Slide",
"PE.Views.PrintWithPreview.txtOf": "of {0}",
"PE.Views.PrintWithPreview.txtPageNumInvalid": "Slide number invalid",
"PE.Views.PrintWithPreview.txtEmptyTable": "There is nothing to print because the presentation is empty",
"PE.Views.PrintWithPreview.txtPages": "Slides",
"PE.Views.PrintWithPreview.txtPaperSize": "Paper size",
"PE.Views.RightMenu.txtChartSettings": "Chart settings",
"PE.Views.RightMenu.txtImageSettings": "Image settings",
"PE.Views.RightMenu.txtParagraphSettings": "Paragraph settings",