Show warning before first click on Quick print button

This commit is contained in:
Julia Radzhabova 2022-11-22 00:56:54 +03:00
parent 8e25f9c027
commit 7d0ac791aa
7 changed files with 98 additions and 23 deletions

View file

@ -579,7 +579,7 @@ define([
this.btnDownload = createTitleButton('toolbar__icon icon--inverse btn-download', $html.findById('#slot-hbtn-download'), undefined, 'bottom', 'big');
if ( config.canPrint )
this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print-preview', $html.findById('#slot-hbtn-print'), undefined, 'bottom', 'big', 'P');
this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-hbtn-print'), undefined, 'bottom', 'big', 'P');
if ( config.canQuickPrint )
this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q');
@ -656,7 +656,7 @@ define([
me.setUserName(me.options.userName);
if ( config.canPrint && config.isEdit ) {
me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print-preview', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P');
me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P');
}
if ( config.canQuickPrint && config.isEdit )
me.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-btn-dt-print-quick'), true, undefined, undefined, 'Q');

View file

@ -2656,12 +2656,35 @@ define([
onPrintQuick: function() {
if (!this.appOptions.canQuickPrint) return;
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
this.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
var value = Common.localStorage.getBool("de-hide-quick-print-warning"),
me = this,
handler = function () {
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
me.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
};
if (value) {
handler.call(this);
} else {
Common.UI.warning({
msg: this.textTryQuickPrint,
buttons: ['yes', 'no'],
primary: 'yes',
dontshow: true,
maxwidth: 500,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setBool("de-hide-quick-print-warning", true);
if (btn === 'yes') {
setTimeout(handler, 1);
}
}
});
}
},
onClearDummyComment: function() {
@ -3290,7 +3313,8 @@ define([
errorTextFormWrongFormat: 'The value entered does not match the format of the field.',
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).',
textUndo: 'Undo',
textContinue: 'Continue'
textContinue: 'Continue',
textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?'
}
})(), DE.Controllers.Main || {}))
});

View file

@ -942,6 +942,7 @@
"DE.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).",
"DE.Controllers.Main.textUndo": "Undo",
"DE.Controllers.Main.textContinue": "Continue",
"DE.Controllers.Main.textTryQuickPrint": "You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?",
"DE.Controllers.Navigation.txtBeginning": "Beginning of document",
"DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document",
"DE.Controllers.Search.notcriticalErrorTitle": "Warning",

View file

@ -2217,12 +2217,35 @@ define([
onPrintQuick: function() {
if (!this.appOptions.canQuickPrint) return;
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
this.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
var value = Common.localStorage.getBool("pe-hide-quick-print-warning"),
me = this,
handler = function () {
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
me.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
};
if (value) {
handler.call(this);
} else {
Common.UI.warning({
msg: this.textTryQuickPrint,
buttons: ['yes', 'no'],
primary: 'yes',
dontshow: true,
maxwidth: 500,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setBool("pe-hide-quick-print-warning", true);
if (btn === 'yes') {
setTimeout(handler, 1);
}
}
});
}
},
onAdvancedOptions: function(type, advOptions) {
@ -3016,7 +3039,8 @@ define([
textRememberMacros: 'Remember my choice for all macros',
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).',
textUndo: 'Undo',
textContinue: 'Continue'
textContinue: 'Continue',
textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?'
}
})(), PE.Controllers.Main || {}))
});

View file

@ -1013,6 +1013,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.Main.textTryQuickPrint": "You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?",
"PE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range",
"PE.Controllers.Print.txtPrintRangeSingleRange": "Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.",
"PE.Controllers.Search.notcriticalErrorTitle": "Warning",

View file

@ -2877,12 +2877,35 @@ define([
onPrintQuick: function() {
if (!this.appOptions.canQuickPrint) return;
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
this.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
var value = Common.localStorage.getBool("sse-hide-quick-print-warning"),
me = this,
handler = function () {
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
me.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
};
if (value) {
handler.call(this);
} else {
Common.UI.warning({
msg: this.textTryQuickPrint,
buttons: ['yes', 'no'],
primary: 'yes',
dontshow: true,
maxwidth: 500,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setBool("sse-hide-quick-print-warning", true);
if (btn === 'yes') {
setTimeout(handler, 1);
}
}
});
}
},
warningDocumentIsLocked: function() {
@ -3665,7 +3688,8 @@ define([
textRememberMacros: 'Remember my choice for all macros',
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).',
textUndo: 'Undo',
textContinue: 'Continue'
textContinue: 'Continue',
textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -1126,6 +1126,7 @@
"SSE.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).",
"SSE.Controllers.Main.textUndo": "Undo",
"SSE.Controllers.Main.textContinue": "Continue",
"SSE.Controllers.Main.textTryQuickPrint": "You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textFirstCol": "First column",
"SSE.Controllers.Print.textFirstRow": "First row",