Commit bdb66a46 authored by Frederic Massart's avatar Frederic Massart
Browse files

MDL-36628 usability: CSS adjustments for book module

parent 2da6e51e
......@@ -166,7 +166,7 @@ function book_add_fake_block($chapters, $chapter, $book, $cm, $edit) {
$bc = new block_contents();
$bc->title = get_string('toc', 'mod_book');
$bc->attributes['class'] = 'block';
$bc->attributes['class'] = 'block block_book_toc';
$bc->content = $toc;
$regions = $PAGE->blocks->get_regions();
......@@ -196,16 +196,16 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
switch ($book->numbering) {
case BOOK_NUM_NONE:
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_none'));
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_none clearfix'));
break;
case BOOK_NUM_NUMBERS:
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered'));
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered clearfix'));
break;
case BOOK_NUM_BULLETS:
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets'));
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets clearfix'));
break;
case BOOK_NUM_INDENTED:
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented'));
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented clearfix'));
break;
}
......@@ -218,11 +218,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
if (!$ch->subchapter) {
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
} else {
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
}
if (!$ch->hidden) {
......@@ -240,11 +240,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
} else {
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
$toc .= html_writer::start_tag('ul');
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
} else {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
}
if (!$ch->hidden) {
......@@ -269,7 +269,8 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
} else {
$toc .= html_writer::link(new moodle_url('view.php', array('id' => $cm->id, 'chapterid' => $ch->id)), $title, array('title' => s($title)));
}
$toc .= '  ';
$toc .= html_writer::start_tag('div', array('class' => 'action-list'));
if ($i != 1) {
$toc .= html_writer::link(new moodle_url('move.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'up' => '1', 'sesskey' => $USER->sesskey)),
$OUTPUT->pix_icon('t/up', get_string('up')), array('title' => get_string('up')));
......@@ -291,7 +292,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
}
$toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'pagenum' => $ch->pagenum, 'subchapter' => $ch->subchapter)),
$OUTPUT->pix_icon('add', get_string('addafter', 'mod_book'), 'mod_book'), array('title' => get_string('addafter', 'mod_book')));
$toc .= html_writer::end_tag('div');
if (!$ch->subchapter) {
$toc .= html_writer::start_tag('ul');
......@@ -315,11 +316,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$ns = 0;
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
} else {
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
}
if ($book->numbering == BOOK_NUM_NUMBERS) {
......@@ -329,11 +330,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$ns++;
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
$toc .= html_writer::start_tag('ul');
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
} else {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('li', array('class' => 'clearfix'));
}
if ($book->numbering == BOOK_NUM_NUMBERS) {
......
......@@ -5,113 +5,104 @@
font-size: large;
font-weight: bold;
margin-left: 0px;
margin-left: 0;
margin-bottom: 20px;
}
.dir-rtl.path-mod-book .book_chapter_title {
text-align: right;
}
.path-mod-book img.bigicon {
vertical-align: middle;
.path-mod-book .navtop img.icon,
.path-mod-book .navbotton img.icon {
margin-right: 4px;
margin-left: 4px;
width: 24px;
height: 24px;
border: 0px;
border: 0;
padding: 0;
}
.path-mod-book .navbottom,
.path-mod-book .navtop {
text-align: right;
margin-bottom: 0.5em;
}
.path-mod-book .navbottom {
text-align: right;
.dir-rtl.path-mod-book .navbottom,
.dir-rtl.path-mod-book .navtop {
text-align: left;
}
.path-mod-book .navtop {
margin-bottom: 0.5em;
}
/* == Fake toc block == */
/* toc style NONE */
.path-mod-book .book_toc_none {
font-size: 0.8em;
}
.path-mod-book .book_toc_none ul {
margin-left: 5px;
padding-left: 0px;
}
.path-mod-book .book_toc_none ul ul {
margin-left: 0px;
padding-left: 0px;
}
.path-mod-book .book_toc_none li {
margin-top: 5px;
.path-mod-book .block_book_toc ul {
margin: 0 0 0 5px;
padding-left: 0;
padding-right: 0;
}
.dir-rtl.path-mod-book .block_book_toc ul { margin: 0 5px 0 0; }
.path-mod-book .block_book_toc li {
clear: both;
list-style: none;
margin-top: .5em;
}
.path-mod-book .book_toc_none li li {
margin-top: 0px;
.path-mod-book .block_book_toc li li {
list-style: none;
}
.path-mod-book .block_book_toc .action-list { float: right; }
.dir-rtl.path-mod-book .block_book_toc .action-list { float: left; }
.path-mod-book .block_book_toc .action-list img.smallicon {
margin: 0 3px;
}
/* toc style NONE */
.path-mod-book .book_toc_none {
font-size: 0.8em;
}
.path-mod-book .book_toc_none ul ul,
.dir-rtl.path-mod-book .book_toc_none ul ul {
margin-left: 0;
margin-right: 0;
}
/* toc style NUMBERED */
.path-mod-book .book_toc_numbered {
font-size: 0.8em;
}
.path-mod-book .book_toc_numbered ul {
margin-left: 5px;
padding-left: 0px;
}
.path-mod-book .book_toc_numbered ul ul {
margin-left: 0px;
padding-left: 0px;
}
.path-mod-book .book_toc_numbered li {
margin-top: 5px;
list-style: none;
}
.path-mod-book .book_toc_numbered li li {
margin-top: 0px;
list-style: none;
}
/*toc style BULLETS */
.path-mod-book .book_toc_bullets {
font-size: 0.8em;
}
.path-mod-book .book_toc_bullets ul {
margin-left: 5px;
padding-left: 0px;
}
.path-mod-book .book_toc_bullets ul ul {
margin-left: 20px;
padding-left: 0px;
}
.path-mod-book .book_toc_bullets li {
margin-top: 5px;
list-style: none;
.dir-rtl.path-mod-book .book_toc_bullets ul ul {
margin-left: 0;
margin-right: 20px;
}
.path-mod-book .book_toc_bullets li li {
margin-top: 0px;
list-style: circle;
}
/* toc style INDENTED*/
.path-mod-book .book_toc_indented {
font-size: 0.8em;
}
.path-mod-book .book_toc_indented ul {
margin-left: 5px;
padding-left: 0px;
}
.dir-rtl.path-mod-book .book_toc_indented ul {
margin-left: 0;
margin-right: 5px;
}
.path-mod-book .book_toc_indented ul ul {
margin-left: 15px;
padding-left: 0px;
}
.path-mod-book .book_toc_indented li {
margin-top: 5px;
list-style: none;
.dir-rtl.path-mod-book .book_toc_indented ul ul {
margin-left: 0;
margin-right: 15px;
}
.path-mod-book .book_toc_indented li li {
margin-top: 0px;
list-style: none;
}
......@@ -142,21 +142,25 @@ foreach ($chapters as $ch) {
$last = $ch->id;
}
$navprevicon = right_to_left() ? 'nav_next' : 'nav_prev';
$navnexticon = right_to_left() ? 'nav_prev' : 'nav_next';
$navprevdisicon = right_to_left() ? 'nav_next_dis' : 'nav_prev_dis';
$chnavigation = '';
if ($previd) {
$chnavigation .= '<a title="'.get_string('navprev', 'book').'" href="view.php?id='.$cm->id.
'&amp;chapterid='.$previd.'"><img src="'.$OUTPUT->pix_url('nav_prev', 'mod_book').'" class="bigicon" alt="'.get_string('navprev', 'book').'"/></a>';
'&amp;chapterid='.$previd.'"><img src="'.$OUTPUT->pix_url($navprevicon, 'mod_book').'" class="icon" alt="'.get_string('navprev', 'book').'"/></a>';
} else {
$chnavigation .= '<img src="'.$OUTPUT->pix_url('nav_prev_dis', 'mod_book').'" class="bigicon" alt="" />';
$chnavigation .= '<img src="'.$OUTPUT->pix_url($navprevdisicon, 'mod_book').'" class="icon" alt="" />';
}
if ($nextid) {
$chnavigation .= '<a title="'.get_string('navnext', 'book').'" href="view.php?id='.$cm->id.
'&amp;chapterid='.$nextid.'"><img src="'.$OUTPUT->pix_url('nav_next', 'mod_book').'" class="bigicon" alt="'.get_string('navnext', 'book').'" /></a>';
'&amp;chapterid='.$nextid.'"><img src="'.$OUTPUT->pix_url($navnexticon, 'mod_book').'" class="icon" alt="'.get_string('navnext', 'book').'" /></a>';
} else {
$sec = $DB->get_field('course_sections', 'section', array('id' => $cm->section));
$returnurl = course_get_url($course, $sec);
$chnavigation .= '<a title="'.get_string('navexit', 'book').'" href="'.$returnurl.'"><img src="'.$OUTPUT->pix_url('nav_exit', 'mod_book').
'" class="bigicon" alt="'.get_string('navexit', 'book').'" /></a>';
'" class="icon" alt="'.get_string('navexit', 'book').'" /></a>';
// we are cheating a bit here, viewing the last page means user has viewed the whole book
$completion = new completion_info($course);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment