mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL-65938-master' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
2db07ee59c
12 changed files with 104 additions and 185 deletions
|
@ -38,6 +38,9 @@ use renderable;
|
||||||
*/
|
*/
|
||||||
class edit_renderer extends \plugin_renderer_base {
|
class edit_renderer extends \plugin_renderer_base {
|
||||||
|
|
||||||
|
/** @var string The toggle group name of the checkboxes for the toggle-all functionality. */
|
||||||
|
protected $togglegroup = 'quiz-questions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the edit page
|
* Render the edit page
|
||||||
*
|
*
|
||||||
|
@ -249,7 +252,11 @@ class edit_renderer extends \plugin_renderer_base {
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'id' => 'selectmultipledeletecommand',
|
'id' => 'selectmultipledeletecommand',
|
||||||
'value' => get_string('deleteselected', 'mod_quiz'),
|
'value' => get_string('deleteselected', 'mod_quiz'),
|
||||||
'class' => 'btn btn-secondary'
|
'class' => 'btn btn-secondary',
|
||||||
|
'data-action' => 'toggle',
|
||||||
|
'data-togglegroup' => $this->togglegroup,
|
||||||
|
'data-toggle' => 'action',
|
||||||
|
'disabled' => true
|
||||||
);
|
);
|
||||||
$buttoncanceloptions = array(
|
$buttoncanceloptions = array(
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
|
@ -259,7 +266,7 @@ class edit_renderer extends \plugin_renderer_base {
|
||||||
);
|
);
|
||||||
|
|
||||||
$groupoptions = array(
|
$groupoptions = array(
|
||||||
'class' => 'btn-group selectmultiplecommand actions',
|
'class' => 'btn-group selectmultiplecommand actions m-1',
|
||||||
'role' => 'group'
|
'role' => 'group'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -270,29 +277,26 @@ class edit_renderer extends \plugin_renderer_base {
|
||||||
$buttoncanceloptions), $groupoptions);
|
$buttoncanceloptions), $groupoptions);
|
||||||
|
|
||||||
$toolbaroptions = array(
|
$toolbaroptions = array(
|
||||||
'class' => 'btn-toolbar',
|
'class' => 'btn-toolbar m-1',
|
||||||
'role' => 'toolbar',
|
'role' => 'toolbar',
|
||||||
'aria-label' => get_string('selectmultipletoolbar', 'quiz'),
|
'aria-label' => get_string('selectmultipletoolbar', 'quiz'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Select all/deselect all questions.
|
// Select all/deselect all questions.
|
||||||
$buttonselectalloptions = array(
|
$selectallid = 'questionselectall';
|
||||||
'role' => 'button',
|
$selectalltext = get_string('selectall', 'moodle');
|
||||||
'id' => 'questionselectall',
|
$deselectalltext = get_string('deselectall', 'moodle');
|
||||||
'class' => 'btn btn-link'
|
$mastercheckbox = new \core\output\checkbox_toggleall($this->togglegroup, true, [
|
||||||
);
|
'id' => $selectallid,
|
||||||
$buttondeselectalloptions = array(
|
'name' => $selectallid,
|
||||||
'role' => 'button',
|
'value' => 1,
|
||||||
'id' => 'questiondeselectall',
|
'label' => $selectalltext,
|
||||||
'class' => 'btn btn-link'
|
'selectall' => $selectalltext,
|
||||||
);
|
'deselectall' => $deselectalltext,
|
||||||
$output .= html_writer::tag('div',
|
], true);
|
||||||
html_writer::tag('div',
|
|
||||||
html_writer::link('#', get_string('selectall', 'quiz'), $buttonselectalloptions) .
|
$selectdeselect = html_writer::div($this->render($mastercheckbox), 'selectmultiplecommandbuttons');
|
||||||
html_writer::tag('span', "/", ['class' => 'separator']) .
|
$output .= html_writer::tag('div', $selectdeselect, $toolbaroptions);
|
||||||
html_writer::link('#', get_string('selectnone', 'quiz'), $buttondeselectalloptions),
|
|
||||||
array('class' => 'btn-group selectmultiplecommandbuttons')),
|
|
||||||
$toolbaroptions);
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,10 +732,13 @@ class edit_renderer extends \plugin_renderer_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= html_writer::start_div('mod-indent-outer');
|
$output .= html_writer::start_div('mod-indent-outer');
|
||||||
$output .= html_writer::tag('input', '', array('id' => 'selectquestion-' .
|
$checkbox = new \core\output\checkbox_toggleall($this->togglegroup, false, [
|
||||||
$structure->get_displayed_number_for_slot($slot), 'name' => 'selectquestion[]',
|
'id' => 'selectquestion-' . $structure->get_displayed_number_for_slot($slot),
|
||||||
'type' => 'checkbox', 'class' => 'select-multiple-checkbox',
|
'name' => 'selectquestion[]',
|
||||||
'value' => $structure->get_displayed_number_for_slot($slot)));
|
'value' => $structure->get_displayed_number_for_slot($slot),
|
||||||
|
'classes' => 'select-multiple-checkbox',
|
||||||
|
]);
|
||||||
|
$output .= $this->render($checkbox);
|
||||||
$output .= $this->question_number($structure->get_displayed_number_for_slot($slot));
|
$output .= $this->question_number($structure->get_displayed_number_for_slot($slot));
|
||||||
|
|
||||||
// This div is used to indent the content.
|
// This div is used to indent the content.
|
||||||
|
|
|
@ -75,6 +75,9 @@ abstract class quiz_attempts_report_table extends table_sql {
|
||||||
/** @var bool whether to include the column with checkboxes to select each attempt. */
|
/** @var bool whether to include the column with checkboxes to select each attempt. */
|
||||||
protected $includecheckboxes;
|
protected $includecheckboxes;
|
||||||
|
|
||||||
|
/** @var string The toggle group name for the checkboxes in the checkbox column. */
|
||||||
|
protected $togglegroup = 'quiz-attempts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param string $uniqueid
|
* @param string $uniqueid
|
||||||
|
@ -108,9 +111,17 @@ abstract class quiz_attempts_report_table extends table_sql {
|
||||||
* @return string HTML content to go inside the td.
|
* @return string HTML content to go inside the td.
|
||||||
*/
|
*/
|
||||||
public function col_checkbox($attempt) {
|
public function col_checkbox($attempt) {
|
||||||
|
global $OUTPUT;
|
||||||
|
|
||||||
if ($attempt->attempt) {
|
if ($attempt->attempt) {
|
||||||
return html_writer::checkbox('attemptid[]', $attempt->attempt, false,
|
$checkbox = new \core\output\checkbox_toggleall($this->togglegroup, false, [
|
||||||
get_string('selectattempt', 'quiz'), [], ['class' => 'accesshide']);
|
'id' => "attemptid_{$attempt->attempt}",
|
||||||
|
'name' => 'attemptid[]',
|
||||||
|
'value' => $attempt->attempt,
|
||||||
|
'label' => get_string('selectattempt', 'quiz'),
|
||||||
|
'labelclasses' => 'accesshide',
|
||||||
|
]);
|
||||||
|
return $OUTPUT->render($checkbox);
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -610,22 +621,6 @@ abstract class quiz_attempts_report_table extends table_sql {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div id="commands">';
|
echo '<div id="commands">';
|
||||||
echo '<a id="checkattempts" href="#">' .
|
|
||||||
get_string('selectall', 'quiz') . '</a> / ';
|
|
||||||
echo '<a id="uncheckattempts" href="#">' .
|
|
||||||
get_string('selectnone', 'quiz') . '</a> ';
|
|
||||||
$PAGE->requires->js_amd_inline("
|
|
||||||
require(['jquery'], function($) {
|
|
||||||
$('#checkattempts').click(function(e) {
|
|
||||||
$('#attemptsform').find('input:checkbox').prop('checked', true);
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
$('#uncheckattempts').click(function(e) {
|
|
||||||
$('#attemptsform').find('input:checkbox').prop('checked', false);
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
});");
|
|
||||||
echo ' ';
|
|
||||||
$this->submit_buttons();
|
$this->submit_buttons();
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
@ -640,10 +635,47 @@ abstract class quiz_attempts_report_table extends table_sql {
|
||||||
protected function submit_buttons() {
|
protected function submit_buttons() {
|
||||||
global $PAGE;
|
global $PAGE;
|
||||||
if (has_capability('mod/quiz:deleteattempts', $this->context)) {
|
if (has_capability('mod/quiz:deleteattempts', $this->context)) {
|
||||||
echo '<input type="submit" class="btn btn-secondary mr-1" id="deleteattemptsbutton" name="delete" value="' .
|
$deletebuttonparams = [
|
||||||
get_string('deleteselected', 'quiz_overview') . '"/>';
|
'type' => 'submit',
|
||||||
|
'class' => 'btn btn-secondary mr-1',
|
||||||
|
'id' => 'deleteattemptsbutton',
|
||||||
|
'name' => 'delete',
|
||||||
|
'value' => get_string('deleteselected', 'quiz_overview'),
|
||||||
|
'data-action' => 'toggle',
|
||||||
|
'data-togglegroup' => $this->togglegroup,
|
||||||
|
'data-toggle' => 'action',
|
||||||
|
'disabled' => true
|
||||||
|
];
|
||||||
|
echo html_writer::empty_tag('input', $deletebuttonparams);
|
||||||
$PAGE->requires->event_handler('#deleteattemptsbutton', 'click', 'M.util.show_confirm_dialog',
|
$PAGE->requires->event_handler('#deleteattemptsbutton', 'click', 'M.util.show_confirm_dialog',
|
||||||
array('message' => get_string('deleteattemptcheck', 'quiz')));
|
array('message' => get_string('deleteattemptcheck', 'quiz')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the contents for the checkbox column header.
|
||||||
|
*
|
||||||
|
* It returns the HTML for a master \core\output\checkbox_toggleall component that selects/deselects all quiz attempts.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function checkbox_col_header() {
|
||||||
|
global $OUTPUT;
|
||||||
|
|
||||||
|
// Build the select/deselect all control.
|
||||||
|
$selectallid = $this->uniqueid . '-selectall-attempts';
|
||||||
|
$selectalltext = get_string('selectall', 'quiz');
|
||||||
|
$deselectalltext = get_string('selectnone', 'quiz');
|
||||||
|
$mastercheckbox = new \core\output\checkbox_toggleall($this->togglegroup, true, [
|
||||||
|
'id' => $selectallid,
|
||||||
|
'name' => $selectallid,
|
||||||
|
'value' => 1,
|
||||||
|
'label' => $selectalltext,
|
||||||
|
'labelclasses' => 'accesshide',
|
||||||
|
'selectall' => $selectalltext,
|
||||||
|
'deselectall' => $deselectalltext,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $OUTPUT->render($mastercheckbox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,8 +213,17 @@ class quiz_overview_table extends quiz_attempts_report_table {
|
||||||
|
|
||||||
protected function submit_buttons() {
|
protected function submit_buttons() {
|
||||||
if (has_capability('mod/quiz:regrade', $this->context)) {
|
if (has_capability('mod/quiz:regrade', $this->context)) {
|
||||||
echo '<input type="submit" class="btn btn-secondary mr-1" name="regrade" value="' .
|
$regradebuttonparams = [
|
||||||
get_string('regradeselected', 'quiz_overview') . '"/>';
|
'type' => 'submit',
|
||||||
|
'class' => 'btn btn-secondary mr-1',
|
||||||
|
'name' => 'regrade',
|
||||||
|
'value' => get_string('regradeselected', 'quiz_overview'),
|
||||||
|
'data-action' => 'toggle',
|
||||||
|
'data-togglegroup' => $this->togglegroup,
|
||||||
|
'data-toggle' => 'action',
|
||||||
|
'disabled' => true
|
||||||
|
];
|
||||||
|
echo html_writer::empty_tag('input', $regradebuttonparams);
|
||||||
}
|
}
|
||||||
parent::submit_buttons();
|
parent::submit_buttons();
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ class quiz_overview_report extends quiz_attempts_report {
|
||||||
|
|
||||||
if (!$table->is_downloading() && $options->checkboxcolumn) {
|
if (!$table->is_downloading() && $options->checkboxcolumn) {
|
||||||
$columns[] = 'checkbox';
|
$columns[] = 'checkbox';
|
||||||
$headers[] = null;
|
$headers[] = $table->checkbox_col_header();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->add_user_columns($table, $columns, $headers);
|
$this->add_user_columns($table, $columns, $headers);
|
||||||
|
|
|
@ -142,7 +142,7 @@ class quiz_responses_report extends quiz_attempts_report {
|
||||||
|
|
||||||
if (!$table->is_downloading() && $options->checkboxcolumn) {
|
if (!$table->is_downloading() && $options->checkboxcolumn) {
|
||||||
$columns[] = 'checkbox';
|
$columns[] = 'checkbox';
|
||||||
$headers[] = null;
|
$headers[] = $table->checkbox_col_header();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->add_user_columns($table, $columns, $headers);
|
$this->add_user_columns($table, $columns, $headers);
|
||||||
|
|
|
@ -1137,12 +1137,8 @@ table#categoryquestions {
|
||||||
|
|
||||||
/* Bulk edit actions */
|
/* Bulk edit actions */
|
||||||
|
|
||||||
#page-mod-quiz-edit .selectmultiplecommandbuttons {
|
|
||||||
margin: 0.6em 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page-mod-quiz-edit .btn-group.selectmultiplecommand,
|
#page-mod-quiz-edit .btn-group.selectmultiplecommand,
|
||||||
#page-mod-quiz-edit .btn-group.selectmultiplecommandbuttons,
|
#page-mod-quiz-edit .selectmultiplecommandbuttons,
|
||||||
#page-mod-quiz-edit .select-multiple-checkbox {
|
#page-mod-quiz-edit .select-multiple-checkbox {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -1150,21 +1146,7 @@ table#categoryquestions {
|
||||||
#page-mod-quiz-edit.select-multiple .selectmultiplecommand,
|
#page-mod-quiz-edit.select-multiple .selectmultiplecommand,
|
||||||
#page-mod-quiz-edit.select-multiple .selectmultiplecommandbuttons,
|
#page-mod-quiz-edit.select-multiple .selectmultiplecommandbuttons,
|
||||||
#page-mod-quiz-edit.select-multiple .select-multiple-checkbox {
|
#page-mod-quiz-edit.select-multiple .select-multiple-checkbox {
|
||||||
display: inherit;
|
display: inline-block;
|
||||||
}
|
|
||||||
|
|
||||||
#page-mod-quiz-edit.select-multiple .selectmultiplecommandbuttons .separator {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: .5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page-mod-quiz-edit #questionselectall {
|
|
||||||
padding-right: .1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page-mod-quiz-edit #questiondeselectall {
|
|
||||||
padding-left: .1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#page-mod-quiz-edit.select-multiple input.select-multiple-checkbox[type="checkbox"] {
|
#page-mod-quiz-edit.select-multiple input.select-multiple-checkbox[type="checkbox"] {
|
||||||
|
|
|
@ -131,7 +131,7 @@ Feature: Edit quiz page - remove multiple questions
|
||||||
|
|
||||||
# Delete all questions in page. Page contains multiple questions
|
# Delete all questions in page. Page contains multiple questions
|
||||||
When I click on "Select multiple items" "button"
|
When I click on "Select multiple items" "button"
|
||||||
Then I click on "Select all" "link"
|
Then I press "Select all"
|
||||||
And I click on "Delete selected" "button"
|
And I click on "Delete selected" "button"
|
||||||
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
||||||
|
|
||||||
|
@ -162,10 +162,10 @@ Feature: Edit quiz page - remove multiple questions
|
||||||
|
|
||||||
# Delete last question in last page. Page contains multiple questions
|
# Delete last question in last page. Page contains multiple questions
|
||||||
When I click on "Select multiple items" "button"
|
When I click on "Select multiple items" "button"
|
||||||
And I click on "Select all" "link"
|
And I press "Select all"
|
||||||
Then the field "selectquestion-3" matches value "1"
|
Then the field "selectquestion-3" matches value "1"
|
||||||
|
|
||||||
When I click on "Deselect all" "link"
|
When I press "Deselect all"
|
||||||
Then the field "selectquestion-3" matches value "0"
|
Then the field "selectquestion-3" matches value "0"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
|
|
|
@ -47,7 +47,6 @@ var CSS = {
|
||||||
CONTENTAFTERLINK: 'div.contentafterlink',
|
CONTENTAFTERLINK: 'div.contentafterlink',
|
||||||
CONTENTWITHOUTLINK: 'div.contentwithoutlink',
|
CONTENTWITHOUTLINK: 'div.contentwithoutlink',
|
||||||
DELETESECTIONICON: 'a.editing_delete .icon',
|
DELETESECTIONICON: 'a.editing_delete .icon',
|
||||||
DESELECTALL: '#questiondeselectall',
|
|
||||||
EDITMAXMARK: 'a.editing_maxmark',
|
EDITMAXMARK: 'a.editing_maxmark',
|
||||||
EDITSECTION: 'a.editing_section',
|
EDITSECTION: 'a.editing_section',
|
||||||
EDITSECTIONICON: 'a.editing_section .icon',
|
EDITSECTIONICON: 'a.editing_section .icon',
|
||||||
|
@ -322,28 +321,8 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||||
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
|
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click select all link to check all the checkboxes.
|
|
||||||
Y.one(SELECTOR.SELECTALL).on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX).set('checked', 'checked');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click deselect all link to show the select all checkboxes.
|
|
||||||
Y.one(SELECTOR.DESELECTALL).on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX).set('checked', '');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Disable delete multiple button by default.
|
|
||||||
Y.one(SELECTOR.SELECTMULTIPLEDELETEBUTTON).setAttribute('disabled', 'disabled');
|
|
||||||
|
|
||||||
// Assign the delete method to the delete multiple button.
|
// Assign the delete method to the delete multiple button.
|
||||||
Y.delegate('click', this.delete_multiple_action, BODY, SELECTOR.SELECTMULTIPLEDELETEBUTTON, this);
|
Y.delegate('click', this.delete_multiple_action, BODY, SELECTOR.SELECTMULTIPLEDELETEBUTTON, this);
|
||||||
|
|
||||||
// Enable the delete all button only when at least one slot is selected.
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.SELECTMULTIPLECHECKBOX, this);
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.SELECTALL, this);
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.DESELECTALL, this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -416,22 +395,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* If a select multiple checkbox is checked enable the buttons in the select multiple
|
|
||||||
* toolbar otherwise disable it.
|
|
||||||
*
|
|
||||||
* @method toggle_select_all_buttons_enabled
|
|
||||||
*/
|
|
||||||
toggle_select_all_buttons_enabled: function() {
|
|
||||||
var checked = Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked');
|
|
||||||
var deletebutton = Y.one(SELECTOR.SELECTMULTIPLEDELETEBUTTON);
|
|
||||||
if (checked && !checked.isEmpty()) {
|
|
||||||
deletebutton.removeAttribute('disabled');
|
|
||||||
} else {
|
|
||||||
deletebutton.setAttribute('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the given activity or resource after confirmation.
|
* Deletes the given activity or resource after confirmation.
|
||||||
*
|
*
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -47,7 +47,6 @@ var CSS = {
|
||||||
CONTENTAFTERLINK: 'div.contentafterlink',
|
CONTENTAFTERLINK: 'div.contentafterlink',
|
||||||
CONTENTWITHOUTLINK: 'div.contentwithoutlink',
|
CONTENTWITHOUTLINK: 'div.contentwithoutlink',
|
||||||
DELETESECTIONICON: 'a.editing_delete .icon',
|
DELETESECTIONICON: 'a.editing_delete .icon',
|
||||||
DESELECTALL: '#questiondeselectall',
|
|
||||||
EDITMAXMARK: 'a.editing_maxmark',
|
EDITMAXMARK: 'a.editing_maxmark',
|
||||||
EDITSECTION: 'a.editing_section',
|
EDITSECTION: 'a.editing_section',
|
||||||
EDITSECTIONICON: 'a.editing_section .icon',
|
EDITSECTIONICON: 'a.editing_section .icon',
|
||||||
|
@ -322,28 +321,8 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||||
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
|
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click select all link to check all the checkboxes.
|
|
||||||
Y.one(SELECTOR.SELECTALL).on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX).set('checked', 'checked');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click deselect all link to show the select all checkboxes.
|
|
||||||
Y.one(SELECTOR.DESELECTALL).on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX).set('checked', '');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Disable delete multiple button by default.
|
|
||||||
Y.one(SELECTOR.SELECTMULTIPLEDELETEBUTTON).setAttribute('disabled', 'disabled');
|
|
||||||
|
|
||||||
// Assign the delete method to the delete multiple button.
|
// Assign the delete method to the delete multiple button.
|
||||||
Y.delegate('click', this.delete_multiple_action, BODY, SELECTOR.SELECTMULTIPLEDELETEBUTTON, this);
|
Y.delegate('click', this.delete_multiple_action, BODY, SELECTOR.SELECTMULTIPLEDELETEBUTTON, this);
|
||||||
|
|
||||||
// Enable the delete all button only when at least one slot is selected.
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.SELECTMULTIPLECHECKBOX, this);
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.SELECTALL, this);
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.DESELECTALL, this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -416,22 +395,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* If a select multiple checkbox is checked enable the buttons in the select multiple
|
|
||||||
* toolbar otherwise disable it.
|
|
||||||
*
|
|
||||||
* @method toggle_select_all_buttons_enabled
|
|
||||||
*/
|
|
||||||
toggle_select_all_buttons_enabled: function() {
|
|
||||||
var checked = Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked');
|
|
||||||
var deletebutton = Y.one(SELECTOR.SELECTMULTIPLEDELETEBUTTON);
|
|
||||||
if (checked && !checked.isEmpty()) {
|
|
||||||
deletebutton.removeAttribute('disabled');
|
|
||||||
} else {
|
|
||||||
deletebutton.setAttribute('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the given activity or resource after confirmation.
|
* Deletes the given activity or resource after confirmation.
|
||||||
*
|
*
|
||||||
|
|
36
mod/quiz/yui/src/toolboxes/js/resource.js
vendored
36
mod/quiz/yui/src/toolboxes/js/resource.js
vendored
|
@ -88,28 +88,8 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||||
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
|
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click select all link to check all the checkboxes.
|
|
||||||
Y.one(SELECTOR.SELECTALL).on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX).set('checked', 'checked');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click deselect all link to show the select all checkboxes.
|
|
||||||
Y.one(SELECTOR.DESELECTALL).on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX).set('checked', '');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Disable delete multiple button by default.
|
|
||||||
Y.one(SELECTOR.SELECTMULTIPLEDELETEBUTTON).setAttribute('disabled', 'disabled');
|
|
||||||
|
|
||||||
// Assign the delete method to the delete multiple button.
|
// Assign the delete method to the delete multiple button.
|
||||||
Y.delegate('click', this.delete_multiple_action, BODY, SELECTOR.SELECTMULTIPLEDELETEBUTTON, this);
|
Y.delegate('click', this.delete_multiple_action, BODY, SELECTOR.SELECTMULTIPLEDELETEBUTTON, this);
|
||||||
|
|
||||||
// Enable the delete all button only when at least one slot is selected.
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.SELECTMULTIPLECHECKBOX, this);
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.SELECTALL, this);
|
|
||||||
Y.delegate('click', this.toggle_select_all_buttons_enabled, BODY, SELECTOR.DESELECTALL, this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,22 +162,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* If a select multiple checkbox is checked enable the buttons in the select multiple
|
|
||||||
* toolbar otherwise disable it.
|
|
||||||
*
|
|
||||||
* @method toggle_select_all_buttons_enabled
|
|
||||||
*/
|
|
||||||
toggle_select_all_buttons_enabled: function() {
|
|
||||||
var checked = Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked');
|
|
||||||
var deletebutton = Y.one(SELECTOR.SELECTMULTIPLEDELETEBUTTON);
|
|
||||||
if (checked && !checked.isEmpty()) {
|
|
||||||
deletebutton.removeAttribute('disabled');
|
|
||||||
} else {
|
|
||||||
deletebutton.setAttribute('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the given activity or resource after confirmation.
|
* Deletes the given activity or resource after confirmation.
|
||||||
*
|
*
|
||||||
|
|
1
mod/quiz/yui/src/toolboxes/js/toolbox.js
vendored
1
mod/quiz/yui/src/toolboxes/js/toolbox.js
vendored
|
@ -45,7 +45,6 @@ var CSS = {
|
||||||
CONTENTAFTERLINK: 'div.contentafterlink',
|
CONTENTAFTERLINK: 'div.contentafterlink',
|
||||||
CONTENTWITHOUTLINK: 'div.contentwithoutlink',
|
CONTENTWITHOUTLINK: 'div.contentwithoutlink',
|
||||||
DELETESECTIONICON: 'a.editing_delete .icon',
|
DELETESECTIONICON: 'a.editing_delete .icon',
|
||||||
DESELECTALL: '#questiondeselectall',
|
|
||||||
EDITMAXMARK: 'a.editing_maxmark',
|
EDITMAXMARK: 'a.editing_maxmark',
|
||||||
EDITSECTION: 'a.editing_section',
|
EDITSECTION: 'a.editing_section',
|
||||||
EDITSECTIONICON: 'a.editing_section .icon',
|
EDITSECTIONICON: 'a.editing_section .icon',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue