Skip to content
Browse files

MDL-33121 Book Module: Removing unused book_log(), renamed css class …

…and fixed the book_preload_chpaters: next and previous values
  • Loading branch information...
1 parent 5b7e511 commit fb909757a678a230cc53254d7247aaced6893d75 @rwijaya rwijaya committed
Showing with 31 additions and 53 deletions.
  1. +10 −32 mod/book/locallib.php
  2. +21 −21 mod/book/styles.css
View
42 mod/book/locallib.php
@@ -77,11 +77,6 @@ function book_preload_chapters($book) {
$first = false;
}
if (!$ch->subchapter) {
- $ch->prev = $prev;
- $ch->next = null;
- if ($prev) {
- $chapters[$prev]->next = $ch->id;
- }
if ($ch->hidden) {
if ($book->numbering == BOOK_NUM_NUMBERS) {
$ch->number = 'x';
@@ -99,11 +94,6 @@ function book_preload_chapters($book) {
$ch->parent = null;
$ch->subchapters = array();
} else {
- $ch->prev = $prevsub;
- $ch->next = null;
- if ($prevsub) {
- $chapters[$prevsub]->next = $ch->id;
- }
$ch->parent = $parent;
$ch->subchapters = null;
$chapters[$parent]->subchapters[$ch->id] = $ch->id;
@@ -122,11 +112,20 @@ function book_preload_chapters($book) {
$ch->number = $j;
}
}
+
+ // assigning previous and next page id
+ $ch->prev = $prev;
+ $ch->next = null;
+ if ($prev) {
+ $chapters[$prev]->next = $ch->id;
+ }
+
if ($oldch->subchapter != $ch->subchapter or $oldch->pagenum != $ch->pagenum or $oldch->hidden != $ch->hidden) {
// update only if something changed
$DB->update_record('book_chapters', $ch);
}
$chapters[$id] = $ch;
+ $prev = $ch->id;
}
return $chapters;
@@ -162,27 +161,6 @@ function book_get_chapter_title($chid, $chapters, $book, $context) {
}
/**
- * General logging to table
- * @param string $str1
- * @param string $str2
- * @param int $level
- * @return void
- */
-function book_log($str1, $str2, $level = 0) {
- switch ($level) {
- case 1:
- echo '<tr><td><span class="dimmed_text">'.$str1.'</span></td><td><span class="dimmed_text">'.$str2.'</span></td></tr>';
- break;
- case 2:
- echo '<tr><td><span style="color: rgb(255, 0, 0);">'.$str1.'</span></td><td><span style="color: rgb(255, 0, 0);">'.$str2.'</span></td></tr>';
- break;
- default:
- echo '<tr><td>'.$str1.'</class></td><td>'.$str2.'</td></tr>';
- break;
- }
-}
-
-/**
* Add the book TOC sticky block to the 1st region available
*
* @param array $chapters
@@ -219,7 +197,7 @@ function book_add_fake_block($chapters, $chapter, $book, $cm, $edit) {
function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
global $USER, $OUTPUT;
- $toc ='';
+ $toc = '';
$nch = 0; // Chapter number
$ns = 0; // Subchapter number
$first = 1;
View
42 mod/book/styles.css
@@ -23,95 +23,95 @@
margin-bottom: 0.5em;
}
-.mod_book .navbottom {
+.path-mod-book .navbottom {
text-align: right;
}
/* == Fake toc block == */
/* toc style NONE */
-.mod_book .book_toc_none {
+.path-mod-book .book_toc_none {
font-size: 0.8em;
}
-.mod_book .book_toc_none ul {
+.path-mod-book .book_toc_none ul {
margin-left: 5px;
padding-left: 0px;
}
-.mod_book .book_toc_none ul ul {
+.path-mod-book .book_toc_none ul ul {
margin-left: 0px;
padding-left: 0px;
}
-.mod_book .book_toc_none li {
+.path-mod-book .book_toc_none li {
margin-top: 5px;
list-style: none;
}
-.mod_book .book_toc_none li li {
+.path-mod-book .book_toc_none li li {
margin-top: 0px;
list-style: none;
}
/* toc style NUMBERED */
-.mod_book .book_toc_numbered {
+.path-mod-book .book_toc_numbered {
font-size: 0.8em;
}
-.mod_book .book_toc_numbered ul {
+.path-mod-book .book_toc_numbered ul {
margin-left: 5px;
padding-left: 0px;
}
-.mod_book .book_toc_numbered ul ul {
+.path-mod-book .book_toc_numbered ul ul {
margin-left: 0px;
padding-left: 0px;
}
-.mod_book .book_toc_numbered li {
+.path-mod-book .book_toc_numbered li {
margin-top: 5px;
list-style: none;
}
-.mod_book .book_toc_numbered li li {
+.path-mod-book .book_toc_numbered li li {
margin-top: 0px;
list-style: none;
}
/*toc style BULLETS */
-.mod_book .book_toc_bullets {
+.path-mod-book .book_toc_bullets {
font-size: 0.8em;
}
-.mod_book .book_toc_bullets ul {
+.path-mod-book .book_toc_bullets ul {
margin-left: 5px;
padding-left: 0px;
}
-.mod_book .book_toc_bullets ul ul {
+.path-mod-book .book_toc_bullets ul ul {
margin-left: 20px;
padding-left: 0px;
}
-.mod_book .book_toc_bullets li {
+.path-mod-book .book_toc_bullets li {
margin-top: 5px;
list-style: none;
}
-.mod_book .book_toc_bullets li li {
+.path-mod-book .book_toc_bullets li li {
margin-top: 0px;
list-style: circle;
}
/* toc style INDENTED*/
-.mod_book .book_toc_indented {
+.path-mod-book .book_toc_indented {
font-size: 0.8em;
}
-.mod_book .book_toc_indented ul {
+.path-mod-book .book_toc_indented ul {
margin-left: 5px;
padding-left: 0px;
}
-.mod_book .book_toc_indented ul ul {
+.path-mod-book .book_toc_indented ul ul {
margin-left: 15px;
padding-left: 0px;
}
-.mod_book .book_toc_indented li {
+.path-mod-book .book_toc_indented li {
margin-top: 5px;
list-style: none;
}
-.mod_book .book_toc_indented li li {
+.path-mod-book .book_toc_indented li li {
margin-top: 0px;
list-style: none;
}

0 comments on commit fb90975

Please sign in to comment.
Something went wrong with that request. Please try again.