summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoao Ventura2008-05-21 16:22:00 (GMT)
committer Joao Ventura2008-05-21 16:22:00 (GMT)
commit4e09d3585341aece4d28808ed0f78974ce7cd461 (patch)
tree78517b9a00671ce25dec04b2fd3df9a902cf896f
parent63092b5c238efef29bf88c143cce3e46e32a7887 (diff)
Fix the 'Show book link' option in the PDF version module
Fix the display of links to PF pages and PDF in individual comments
-rw-r--r--print.module5
-rw-r--r--print_pdf.module71
2 files changed, 41 insertions, 35 deletions
diff --git a/print.module b/print.module
index 6be40f4..c6eb2f2 100644
--- a/print.module
+++ b/print.module
@@ -123,16 +123,15 @@ function print_menu() {
*/
function print_link($type, $node = NULL, $teaser = FALSE) {
$print_html_settings = variable_get('print_html_settings', print_html_settings_default());
- static $print_display = FALSE;
+ static $print_display_comment = FALSE;
- if (($print_display == FALSE) && (isset($node->type))) {
+ if (($print_display_comment == FALSE) && (isset($node->type))) {
$node_type = $node->type;
$print_display_comment = variable_get('print_display_comment_'. $node->type, 0);
$print_display = variable_get('print_display_'. $node->type, 1);
}
else {
$node_type = '';
- $print_display_comment = 0;
$print_display = 1;
}
diff --git a/print_pdf.module b/print_pdf.module
index 1f3335d..49ca5f9 100644
--- a/print_pdf.module
+++ b/print_pdf.module
@@ -67,48 +67,55 @@ function print_pdf_menu() {
*/
function print_pdf_link($type, $node = NULL, $teaser = FALSE) {
$print_pdf_settings = variable_get('print_pdf_settings', print_pdf_settings_default());
- static $print_pdf_display = FALSE;
+ static $print_pdf_display_comment = FALSE;
- if ($print_pdf_display == FALSE) {
- if (isset($node->type)) {
- $node_type = $node->type;
- $print_pdf_display_comment = variable_get('print_pdf_display_comment_'. $node->type, 0);
- $print_pdf_display = variable_get('print_pdf_display_'. $node->type, 1);
- }
- else {
- $node_type = '';
- $print_pdf_display_comment = 0;
- $print_pdf_display = 1;
- }
+ if (($print_pdf_display_comment == FALSE) && (isset($node->type))) {
+ $node_type = $node->type;
+ $print_pdf_display_comment = variable_get('print_pdf_display_comment_'. $node->type, 0);
+ $print_pdf_display = variable_get('print_pdf_display_'. $node->type, 1);
+ }
+ else {
+ $node_type = '';
+ $print_pdf_display = 1;
}
- // No link is shown for several motives...
- if ( !($teaser) &&
- ($print_pdf_settings['show_link']) && user_access('access print') &&
- (($type == 'comment' && $print_pdf_display_comment) ||
- ($type == 'node' && $print_pdf_display))) {
+ if (!$teaser) {
$links = array();
-
$format = theme('print_pdf_format_link');
+ // Show book link
+ if (($print_pdf_settings['book_link']) && user_access('access printer-friendly version') &&
+ (($node_type == 'book') || isset($node->book))) {
+
+ $links['book_pdf'] = array('href' => PRINTPDF_PATH ."/book/export/html/". $node->nid,
+ 'title' => strip_tags($format['text']),
+ 'attributes' => $format['attributes'],
+ );
- $query_arr = $_GET;
- if ($type == 'comment') {
- $query_arr['comment'] = $node->cid;
+ return $links;
}
- $query = drupal_query_string_encode($query_arr, array('q'));
+ // No link is shown for several motives...
+ elseif (($node_type != 'book') && (!isset($node->book)) &&
+ ($print_pdf_settings['show_link']) && user_access('access print') &&
+ (($type == 'comment' && $print_pdf_display_comment) ||
+ ($type == 'node' && $print_pdf_display))) {
+
+ $query_arr = $_GET;
+ if ($type == 'comment') {
+ $query_arr['comment'] = $node->cid;
+ }
+ $query = drupal_query_string_encode($query_arr, array('q'));
- $links['print_pdf'] = array('href' => PRINTPDF_PATH ."/". $node->nid,
- 'title' => $format['text'],
- 'attributes' => $format['attributes'],
- 'html' => $format['html'],
- 'query' => $query,
- );
+ $links['print_pdf'] = array('href' => PRINTPDF_PATH ."/". $node->nid,
+ 'title' => $format['text'],
+ 'attributes' => $format['attributes'],
+ 'html' => $format['html'],
+ 'query' => $query,
+ );
- return $links;
- }
- else {
- return;
+ return $links;
+ }
}
+ return;
}
/**