From 2cd972c1c60e6780140092106c44b5e216335a7a Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Mon, 21 May 2012 14:06:00 +1200 Subject: [PATCH] MDL-32709 Pre-integration trivial clean up * Added a comment for the BOOK_NUM_* defines. * Fixed broken redirects in tool/importhtml/index.php * Fixed typo in book_preload_chapters [subchpaters => subchapters] * Fixed copy paste docblock error in tool/print/locallib.php * Removed the .gitignore file as Eloy had previously mentioned that. --- mod/book/.gitignore | 16 ---------------- mod/book/locallib.php | 11 +++++++++-- mod/book/tool/importhtml/index.php | 4 ++-- mod/book/tool/print/locallib.php | 2 +- 4 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 mod/book/.gitignore diff --git a/mod/book/.gitignore b/mod/book/.gitignore deleted file mode 100644 index 043a39ba30d..00000000000 --- a/mod/book/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# See gitignore(5) man page for more details -# -*~ -*.swp -/tags -/TAGS -/cscope.* -/.patches/ -/.idea/ -/nbproject/ -CVS -.DS_Store -/.settings/ -/.project -/.buildpath -/.cache diff --git a/mod/book/locallib.php b/mod/book/locallib.php index 3ba4af5100b..96f9f456aad 100644 --- a/mod/book/locallib.php +++ b/mod/book/locallib.php @@ -27,6 +27,13 @@ defined('MOODLE_INTERNAL') || die; require_once(dirname(__FILE__).'/lib.php'); require_once($CFG->libdir.'/filelib.php'); +/** + * The following defines are used to define how the chapters and subchapters of a book should be displayed in that table of contents. + * BOOK_NUM_NONE No special styling will applied and the editor will be able to do what ever thay want in the title + * BOOK_NUM_NUMBERS Chapters and subchapters are numbered (1, 1.1, 1.2, 2, ...) + * BOOK_NUM_BULLETS Subchapters are indented and displayed with bullets + * BOOK_NUM_INDENTED Subchapters are indented + */ define('BOOK_NUM_NONE', '0'); define('BOOK_NUM_NUMBERS', '1'); define('BOOK_NUM_BULLETS', '2'); @@ -88,7 +95,7 @@ function book_preload_chapters($book) { $hidesub = $ch->hidden; $parent = $ch->id; $ch->parent = null; - $ch->subchpaters = array(); + $ch->subchapters = array(); } else { $ch->prev = $prevsub; $ch->next = null; @@ -96,7 +103,7 @@ function book_preload_chapters($book) { $chapters[$prevsub]->next = $ch->id; } $ch->parent = $parent; - $ch->subchpaters = null; + $ch->subchapters = null; $chapters[$parent]->subchapters[$ch->id] = $ch->id; if ($hidesub) { // all subchapters in hidden chapter must be hidden too diff --git a/mod/book/tool/importhtml/index.php b/mod/book/tool/importhtml/index.php index f28bd445b17..95bdd381566 100644 --- a/mod/book/tool/importhtml/index.php +++ b/mod/book/tool/importhtml/index.php @@ -61,9 +61,9 @@ $mform = new booktool_importhtml_form(null, array('id'=>$id, 'chapterid'=>$chapt // If data submitted, then process and store. if ($mform->is_cancelled()) { if (empty($chapter->id)) { - redirect("view.php?id=$cm->id"); + redirect("/mod/book/view.php?id=$cm->id"); } else { - redirect("view.php?id=$cm->id&chapterid=$chapter->id"); + redirect("/mod/book/view.php?id=$cm->id&chapterid=$chapter->id"); } } else if ($data = $mform->get_data()) { diff --git a/mod/book/tool/print/locallib.php b/mod/book/tool/print/locallib.php index 821c278787e..524ad16f2d7 100644 --- a/mod/book/tool/print/locallib.php +++ b/mod/book/tool/print/locallib.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * HTML import lib + * Book print lib * * @package booktool_print * @copyright 2011 Petr Skoda {@link http://skodak.org}