Merge branch 'MDL-43730-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
@@ -45,11 +45,17 @@ If the custom titles checkbox is ticked, the chapter title is NOT displayed as a
|
||||
$string['chapters'] = 'Chapters';
|
||||
$string['chaptertitle'] = 'Chapter title';
|
||||
$string['content'] = 'Content';
|
||||
$string['deletechapter'] = 'Delete chapter "{$a}"';
|
||||
$string['editingchapter'] = 'Editing chapter';
|
||||
$string['eventchaptercreated'] = 'Chapter created';
|
||||
$string['eventchapterdeleted'] = 'Chapter deleted';
|
||||
$string['eventchapterupdated'] = 'Chapter updated';
|
||||
$string['eventchapterviewed'] = 'Chapter viewed';
|
||||
$string['editchapter'] = 'Edit chapter "{$a}"';
|
||||
$string['hidechapter'] = 'Hide chapter "{$a}"';
|
||||
$string['movechapterup'] = 'Move chapter up "{$a}"';
|
||||
$string['movechapterdown'] = 'Move chapter down "{$a}"';
|
||||
$string['showchapter'] = 'Show chapter "{$a}"';
|
||||
$string['subchapter'] = 'Subchapter';
|
||||
$string['navimages'] = 'Images';
|
||||
$string['navoptions'] = 'Available options for navigational links';
|
||||
|
||||
+12
-6
@@ -282,22 +282,28 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
|
||||
$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')));
|
||||
$OUTPUT->pix_icon('t/up', get_string('movechapterup', 'mod_book', $title)),
|
||||
array('title' => get_string('movechapterup', 'mod_book', $title)));
|
||||
}
|
||||
if ($i != count($chapters)) {
|
||||
$toc .= html_writer::link(new moodle_url('move.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'up' => '0', 'sesskey' => $USER->sesskey)),
|
||||
$OUTPUT->pix_icon('t/down', get_string('down')), array('title' => get_string('down')));
|
||||
$OUTPUT->pix_icon('t/down', get_string('movechapterdown', 'mod_book', $title)),
|
||||
array('title' => get_string('movechapterdown', 'mod_book', $title)));
|
||||
}
|
||||
$toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'id' => $ch->id)),
|
||||
$OUTPUT->pix_icon('t/edit', get_string('edit')), array('title' => get_string('edit')));
|
||||
$OUTPUT->pix_icon('t/edit', get_string('editchapter', 'mod_book', $title)),
|
||||
array('title' => get_string('editchapter', 'mod_book', $title)));
|
||||
$toc .= html_writer::link(new moodle_url('delete.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)),
|
||||
$OUTPUT->pix_icon('t/delete', get_string('delete')), array('title' => get_string('delete')));
|
||||
$OUTPUT->pix_icon('t/delete', get_string('deletechapter', 'mod_book', $title)),
|
||||
array('title' => get_string('deletechapter', 'mod_book', $title)));
|
||||
if ($ch->hidden) {
|
||||
$toc .= html_writer::link(new moodle_url('show.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)),
|
||||
$OUTPUT->pix_icon('t/show', get_string('show')), array('title' => get_string('show')));
|
||||
$OUTPUT->pix_icon('t/show', get_string('showchapter', 'mod_book', $title)),
|
||||
array('title' => get_string('showchapter', 'mod_book', $title)));
|
||||
} else {
|
||||
$toc .= html_writer::link(new moodle_url('show.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)),
|
||||
$OUTPUT->pix_icon('t/hide', get_string('hide')), array('title' => get_string('hide')));
|
||||
$OUTPUT->pix_icon('t/hide', get_string('hidechapter', 'mod_book', $title)),
|
||||
array('title' => get_string('hidechapter', 'mod_book', $title)));
|
||||
}
|
||||
$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')));
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
@mod @mod_book
|
||||
Feature: Book activity chapter visibility management
|
||||
In order to properly manage chapters in a book activity
|
||||
As a teacher
|
||||
I need to be able to show or hide chapters.
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Book" to section "1" and I fill the form with:
|
||||
| Name | Test book |
|
||||
| Description | A book about dreams! |
|
||||
And I follow "Test book"
|
||||
And I set the following fields to these values:
|
||||
| Chapter title | First chapter |
|
||||
| Content | First chapter |
|
||||
And I press "Save changes"
|
||||
And I click on "a[href*='pagenum=1']" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Chapter title | Second chapter |
|
||||
| Content | Second chapter |
|
||||
And I press "Save changes"
|
||||
And I click on "a[href*='pagenum=2']" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Chapter title | Sub chapter |
|
||||
| subchapter | 1 |
|
||||
| Content | Sub chapter |
|
||||
And I press "Save changes"
|
||||
And I click on "a[href*='pagenum=3']" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Chapter title | Third chapter |
|
||||
| subchapter | 0 |
|
||||
| Content | Third chapter |
|
||||
And I press "Save changes"
|
||||
And I click on "a[href*='pagenum=4']" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Chapter title | Fourth chapter |
|
||||
| Content | Fourth chapter |
|
||||
And I press "Save changes"
|
||||
|
||||
@javascript
|
||||
Scenario: Show/hide chapters and subchapters
|
||||
When I follow "Hide chapter \"2 Second chapter\""
|
||||
And I follow "Hide chapter \"2 Third chapter\""
|
||||
And I follow "Turn editing off"
|
||||
And I am on homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Test book"
|
||||
Then I should not see "Second chapter" in the "Table of contents" "block"
|
||||
And I should not see "Third chapter" in the "Table of contents" "block"
|
||||
And I follow "Next"
|
||||
And I should see "Fourth chapter" in the ".book_content" "css_element"
|
||||
And I follow "Exit book"
|
||||
And I follow "Test book"
|
||||
And I should see "First chapter" in the ".book_content" "css_element"
|
||||
And I follow "Turn editing on"
|
||||
And I follow "Next"
|
||||
And I should see "Second chapter" in the ".book_content" "css_element"
|
||||
And I should not see "Exit book"
|
||||
And I follow "Next"
|
||||
And I should see "Sub chapter" in the ".book_content" "css_element"
|
||||
And I follow "Next"
|
||||
And I should see "Third chapter" in the ".book_content" "css_element"
|
||||
And I follow "Next"
|
||||
And I should see "Fourth chapter" in the ".book_content" "css_element"
|
||||
And I follow "Exit book"
|
||||
|
||||
Reference in New Issue
Block a user