MDL-56295 mod_book: JS Confirmation of chapter removal

This commit is contained in:
Andrew Nicols 2016-10-06 16:03:04 +08:00
parent 6a69cda97d
commit 6942122290

View File

@ -299,9 +299,20 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'id' => $ch->id)),
$OUTPUT->pix_icon('t/edit', get_string('editchapter', 'mod_book', $title)),
array('title' => get_string('editchapter', 'mod_book', $titleunescaped)));
$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('deletechapter', 'mod_book', $title)),
array('title' => get_string('deletechapter', 'mod_book', $titleunescaped)));
$deleteaction = new confirm_action(get_string('deletechapter', 'mod_book', $titleunescaped));
$toc .= $OUTPUT->action_icon(
new moodle_url('delete.php', [
'id' => $cm->id,
'chapterid' => $ch->id,
'sesskey' => sesskey(),
'confirm' => 1,
]),
new pix_icon('t/delete', get_string('deletechapter', 'mod_book', $title)),
$deleteaction,
['title' => get_string('deletechapter', 'mod_book', $titleunescaped)]
);
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('showchapter', 'mod_book', $title)),