Commit b42d3086 authored by jcnventura's avatar jcnventura

Fix #566138: add setting to close the window when both the new window and send...

Fix #566138: add setting to close the window when both the new window and send to printer are enabled
parent 937c5ab6
......@@ -293,6 +293,13 @@ function print_html_settings() {
'#description' => t("Automatically calls the browser's print function when the printer-friendly version is displayed."),
);
$form['settings']['print_html_windowclose'] = array(
'#type' => 'checkbox',
'#title' => t('Close window after sending to printer'),
'#default_value' => variable_get('print_html_windowclose', PRINT_HTML_WINDOWCLOSE_DEFAULT),
'#description' => t("When the above options are enabled, this option will close the window after its contents are printed."),
);
$form['settings']['print_robots_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Robots META tags'),
......
......@@ -49,6 +49,7 @@ function print_uninstall() {
variable_del('print_html_book_link');
variable_del('print_html_new_window');
variable_del('print_html_sendtoprinter');
variable_del('print_html_windowclose');
variable_del('print_robots_noindex');
variable_del('print_robots_nofollow');
variable_del('print_robots_noarchive');
......
......@@ -61,6 +61,7 @@ define('PRINT_HTML_LINK_USE_ALIAS_DEFAULT', 0);
define('PRINT_HTML_BOOK_LINK_DEFAULT', 1);
define('PRINT_HTML_NEW_WINDOW_DEFAULT', 0);
define('PRINT_HTML_SENDTOPRINTER_DEFAULT', 0);
define('PRINT_HTML_WINDOWCLOSE_DEFAULT', 1);
define('PRINT_SOURCEURL_ENABLED_DEFAULT', 1);
define('PRINT_SOURCEURL_DATE_DEFAULT', 0);
......
......@@ -158,7 +158,9 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
$print_css = variable_get('print_css', PRINT_CSS_DEFAULT);
$print_logo_options = variable_get('print_logo_options', PRINT_LOGO_OPTIONS_DEFAULT);
$print_logo_url = variable_get('print_logo_url', PRINT_LOGO_URL_DEFAULT);
$print_html_new_window = variable_get('print_html_new_window', PRINT_HTML_NEW_WINDOW_DEFAULT);
$print_html_sendtoprinter = variable_get('print_html_sendtoprinter', PRINT_HTML_SENDTOPRINTER_DEFAULT);
$print_html_windowclose = variable_get('print_html_windowclose', PRINT_HTML_WINDOWCLOSE_DEFAULT);
$print_sourceurl_enabled = variable_get('print_sourceurl_enabled', PRINT_SOURCEURL_ENABLED_DEFAULT);
$print_sourceurl_forcenode = variable_get('print_sourceurl_forcenode', PRINT_SOURCEURL_FORCENODE_DEFAULT);
$print_sourceurl_date = variable_get('print_sourceurl_date', PRINT_SOURCEURL_DATE_DEFAULT);
......@@ -216,7 +218,8 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
}
}
$print['sendtoprinter'] = $print_html_sendtoprinter ? ' onload="window.print();"' : '';
$window_close = ($print_html_new_window && $print_html_windowclose) ? 'window.close();' : '';
$print['sendtoprinter'] = $print_html_sendtoprinter ? " onload='window.print();$window_close'" : '';
switch ($print_logo_options) {
case 0: // none
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment