Commit 4b892b4b authored by jcnventura's avatar jcnventura

Issue #881802: URL list in system pages is now configurable (default off).

parent 0b05b59f
......@@ -319,6 +319,13 @@ function print_html_settings() {
'#description' => t("When the above options are enabled, this option will close the window after its contents are printed."),
);
$form['settings']['print_display_sys_urllist'] = array(
'#type' => 'checkbox',
'#title' => t('Printer-friendly URLs list in system pages'),
'#default_value' => variable_get('print_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT),
'#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
);
$form['settings']['print_robots_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Robots META tags'),
......
......@@ -63,6 +63,7 @@ function print_uninstall() {
variable_del('print_html_new_window');
variable_del('print_html_sendtoprinter');
variable_del('print_html_windowclose');
variable_del('print_display_sys_urllist');
variable_del('print_robots_noindex');
variable_del('print_robots_nofollow');
variable_del('print_robots_noarchive');
......
......@@ -76,6 +76,7 @@ define('PRINT_ROBOTS_NOARCHIVE_DEFAULT', 0);
define('PRINT_TYPE_SHOW_LINK_DEFAULT', 1);
define('PRINT_TYPE_COMMENT_LINK_DEFAULT', 0);
define('PRINT_TYPE_URLLIST_DEFAULT', 1);
define('PRINT_TYPE_SYS_URLLIST_DEFAULT', 0);
define('PRINT_ALLOW_NORMAL_LINK', 1);
define('PRINT_ALLOW_BOOK_LINK', 2);
......
......@@ -423,24 +423,35 @@ function _print_friendly_urls($url = 0) {
*/
function _print_url_list_enabled($node, $format = PRINT_HTML_FORMAT) {
if (!isset($node->type)) {
return variable_get('print_urls', PRINT_URLS_DEFAULT);
switch ($format) {
case PRINT_HTML_FORMAT:
$node_urllist = variable_get('print_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT);
break;
case PRINT_MAIL_FORMAT:
$node_urllist = variable_get('print_mail_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT);
break;
case PRINT_PDF_FORMAT:
$node_urllist = variable_get('print_pdf_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT);
break;
default:
$node_urllist = PRINT_TYPE_SYS_URLLIST_DEFAULT;
}
}
switch ($format) {
case PRINT_HTML_FORMAT:
$node_urllist = isset($node->print_display_urllist) ? $node->print_display_urllist : variable_get('print_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
$fmt = '';
break;
case PRINT_MAIL_FORMAT:
$node_urllist = isset($node->print_mail_display_urllist) ? $node->print_mail_display_urllist : variable_get('print_mail_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
$fmt = $format . '_';
break;
case PRINT_PDF_FORMAT:
$node_urllist = isset($node->print_pdf_display_urllist) ? $node->print_pdf_display_urllist : variable_get('print_pdf_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
$fmt = $format . '_';
break;
else {
switch ($format) {
case PRINT_HTML_FORMAT:
$node_urllist = isset($node->print_display_urllist) ? $node->print_display_urllist : variable_get('print_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
break;
case PRINT_MAIL_FORMAT:
$node_urllist = isset($node->print_mail_display_urllist) ? $node->print_mail_display_urllist : variable_get('print_mail_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
break;
case PRINT_PDF_FORMAT:
$node_urllist = isset($node->print_pdf_display_urllist) ? $node->print_pdf_display_urllist : variable_get('print_pdf_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
break;
default:
$node_urllist = PRINT_TYPE_URLLIST_DEFAULT;
}
}
if (!isset($node_urllist)) $node_urllist = PRINT_TYPE_URLLIST_DEFAULT;
// Get value of Printer-friendly URLs setting
return (variable_get('print_urls', PRINT_URLS_DEFAULT) && ($node_urllist));
......
......@@ -175,6 +175,13 @@ function print_mail_settings() {
);
}
$form['settings']['print_mail_display_sys_urllist'] = array(
'#type' => 'checkbox',
'#title' => t('Printer-friendly URLs list in system pages'),
'#default_value' => variable_get('print_mail_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT),
'#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
);
return system_settings_form($form);
}
......
......@@ -48,6 +48,7 @@ function print_mail_uninstall() {
variable_del('print_mail_text_subject');
variable_del('print_mail_text_content');
variable_del('print_mail_job_queue');
variable_del('print_mail_display_sys_urllist');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_mail\_display\_%'");
foreach ($settings as $variable) {
variable_del($variable->name);
......
......@@ -244,6 +244,14 @@ function print_pdf_settings() {
'#token_types' => array('node'),
);
}
$form['settings']['print_pdf_display_sys_urllist'] = array(
'#type' => 'checkbox',
'#title' => t('Printer-friendly URLs list in system pages'),
'#default_value' => variable_get('print_pdf_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT),
'#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
);
$form['#validate'][] = '_print_pdf_settings_validate';
}
else {
......
......@@ -50,6 +50,7 @@ function print_pdf_uninstall() {
variable_del('print_pdf_autoconfig');
variable_del('print_pdf_dompdf_unicode');
variable_del('print_pdf_wkhtmltopdf_options');
variable_del('print_pdf_display_sys_urllist');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_pdf\_display\_%'");
foreach ($settings as $variable) {
variable_del($variable->name);
......
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