summaryrefslogtreecommitdiffstats
path: root/print.module
diff options
context:
space:
mode:
authorkm2005-01-28 14:33:32 +0000
committerkm2005-01-28 14:33:32 +0000
commit0edb8690c669bcf84d3b7e1757c7655d1ebd0ebc (patch)
treebcae7f51c5232e5468b0a93fb29dec7f496d9949 /print.module
parent46d4aabe596bd9664a95dada6e75e075b836e1c0 (diff)
km - introduced printer friendly icon
Diffstat (limited to 'print.module')
-rw-r--r--print.module12
1 files changed, 9 insertions, 3 deletions
diff --git a/print.module b/print.module
index 934fef3..8552134 100644
--- a/print.module
+++ b/print.module
@@ -25,7 +25,7 @@ function print_menu($may_cache) {
$items = array();
if (!$may_cache) {
- $items[] = array('path' => 'node/'. arg(1) .'/print', 'title' => t('printer friendly'),
+ $items[] = array('path' => 'node/'. arg(1) .'/print', 'title' => t('printer friendly page'),
'callback' => 'print_page', 'access' => user_access('access content'),
'type' => MENU_CALLBACK);
}
@@ -57,9 +57,10 @@ function print_link($type, $node = 0, $main) {
function print_settings() {
$output = form_textfield(t('Stylesheet URL'), 'print_css', variable_get('print_css', 'misc/print.css'), 60, 64, t('The URL to your print cascading stylesheet.'));
- $field .= form_checkbox(t('Printer friendly URLs'), 'print_urls', 1, variable_get('print_urls', 0));
+ $field .= form_checkbox(t('A list of the node\'s links at the bottom'), 'print_urls', 1, variable_get('print_urls', 0));
$output .= form_group(t('Print page elements'), $field);
$output .= form_radios(t('Printer friendly page link'), 'print_show_link', variable_get('print_show_link', 1), array(t("Disabled"), t("Enabled")), t("Enable or disable the 'printer friendly page' link for each node. Even if the link is disabled, you can still view the print version of a node by going to 'node/nid/print' where nid is the numeric id of the node."));
+ $output .= form_textfield(t('Printer friendly page icon'), 'print_icon', variable_get('print_icon', 'misc/print.gif'), 60, 64, t('An optional icon to put in front of the printer friendly page link.'));
return $output;
}
@@ -110,6 +111,7 @@ function print_generate($title) {
/* End of code stealing from node_view() */
if (variable_get('print_urls', 1)) {
+
/* Collect links and display them at the bottom of the page. Code once taken from Kjartan Mannes' project.module */
$pattern = "@href=([\']?[\"]?)([^\"|^\'|^|^>]*)([^>]*)>(.+?)</a>@ise";
$node->body = preg_replace($pattern, "'<u>'.stripslashes('\\4').'</u> ['. print_friendly_urls(stripslashes('\\2')) .']'", $node->body);
@@ -146,7 +148,11 @@ function print_friendly_urls($url = 0) {
********************************************************************/
function theme_print_link($node) {
- $links = l(t('printer friendly version'), "node/$node->nid/print", array('title' => t('Display a printer friendly version of this page.')));
+ $links = '';
+ if ($icon = variable_get('print_icon', 1)) {
+ $links .= l('<img src="'.$icon.'" alt="">', "node/$node->nid/print");
+ }
+ $links .= l(t('printer friendly page'), "node/$node->nid/print", array('title' => t('Display a printer friendly page.')));
return $links;
}