--- /home/www/html/drupal-4.5.0/modules/book.module 2004-10-19 16:00:06.000000000 -0400 +++ book.module 2004-11-20 01:04:00.318603413 -0500 @@ -64,7 +64,8 @@ $links[] = l(t('books'), 'book', array('title' => t('Read and contribute to the collaborative books.'))); } - if ($type == 'node' && $node->type == 'book') { + $show_print_friendly = variable_get('book_show_printer_friendly', 1 ); + if ($type == 'node' && $node->type == 'book' && $show_print_friendly == 1){ if (!$main) { $links[] = l(t('printer-friendly version'), 'book/print/'. $node->nid, array('title' => t('Show a printer-friendly version of this book page and its sub-pages.'))); } @@ -767,18 +768,45 @@ * Menu callback; displays the book administration page. */ function book_admin($nid = 0) { - $op = $_POST['op']; + $op = $_POST['op']; $edit = $_POST['edit']; + $pf = $edit['show_printer_friendly']; + $var = variable_get('book_show_printer_friendly', 0); - switch ($op) { - case t('Save book pages'): - drupal_set_message(book_admin_save($nid, $edit)); - // fall through: - default: - $output .= book_admin_view($nid); - break; - } - print theme('page', $output); + switch ( $nid ) + { + case 0: + // We are not on a node, display the general settings for the book module + switch ($op) + { + case t('Save settings'): + variable_set('book_show_printer_friendly', $pf); + drupal_set_message('Setting saved'); + // fall through: + case '': + $var = variable_get('book_show_printer_friendly', 1); + $output .= form_checkbox(t('show printer friendly links for books'), + 'show_printer_friendly', 1, $var); + $output .= form_submit(t('Save settings')); + break; + } + print theme('page', form($output)); + break; + + default: + // We are on a node, so allow editing this nodes info + switch ($op) + { + case t('Save book pages'): + drupal_set_message(book_admin_save($nid, $edit)); + // fall through: + default: + $output .= book_admin_view($nid); + break; + } + print theme('page', $output); + break; + } } /**