mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-33843' of git://github.com/netspotau/moodle-mod_assign
This commit is contained in:
commit
ec1ca38996
3 changed files with 9 additions and 49 deletions
|
@ -48,13 +48,15 @@ class mod_assign_grading_options_form extends moodleform {
|
||||||
$mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
|
$mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
|
||||||
// visible elements
|
// visible elements
|
||||||
$options = array(-1=>'All',10=>'10', 20=>'20', 50=>'50', 100=>'100');
|
$options = array(-1=>'All',10=>'10', 20=>'20', 50=>'50', 100=>'100');
|
||||||
$mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options, array('class'=>'ignoredirty'));
|
$mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options);
|
||||||
$options = array(''=>get_string('filternone', 'assign'), ASSIGN_FILTER_SUBMITTED=>get_string('filtersubmitted', 'assign'), ASSIGN_FILTER_REQUIRE_GRADING=>get_string('filterrequiregrading', 'assign'));
|
$options = array('' => get_string('filternone', 'assign'),
|
||||||
$mform->addElement('select', 'filter', get_string('filter', 'assign'), $options, array('class'=>'ignoredirty'));
|
ASSIGN_FILTER_SUBMITTED => get_string('filtersubmitted', 'assign'),
|
||||||
|
ASSIGN_FILTER_REQUIRE_GRADING => get_string('filterrequiregrading', 'assign'));
|
||||||
|
$mform->addElement('select', 'filter', get_string('filter', 'assign'), $options);
|
||||||
|
|
||||||
// quickgrading
|
// quickgrading
|
||||||
if ($instance['showquickgrading']) {
|
if ($instance['showquickgrading']) {
|
||||||
$mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', array('class'=>'ignoredirty'));
|
$mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '');
|
||||||
$mform->addHelpButton('quickgrading', 'quickgrading', 'assign');
|
$mform->addHelpButton('quickgrading', 'quickgrading', 'assign');
|
||||||
$mform->setDefault('quickgrading', $instance['quickgrading']);
|
$mform->setDefault('quickgrading', $instance['quickgrading']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||||
|
|
||||||
// Select
|
// Select
|
||||||
$columns[] = 'select';
|
$columns[] = 'select';
|
||||||
$headers[] = get_string('select') . '<div class="selectall"><input type="checkbox" class="ignoredirty" name="selectall" title="' . get_string('selectall') . '"/></div>';
|
$headers[] = get_string('select') . '<div class="selectall"><input type="checkbox" name="selectall" title="' . get_string('selectall') . '"/></div>';
|
||||||
|
|
||||||
// Edit links
|
// Edit links
|
||||||
if (!$this->is_downloading()) {
|
if (!$this->is_downloading()) {
|
||||||
|
@ -303,7 +303,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function col_select(stdClass $row) {
|
function col_select(stdClass $row) {
|
||||||
return '<input type="checkbox" name="selectedusers" value="' . $row->userid . '" class="ignoredirty"/>';
|
return '<input type="checkbox" name="selectedusers" value="' . $row->userid . '"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,27 +110,8 @@ M.mod_assign.init_grading_table = function(Y) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
M.mod_assign.check_dirty_quickgrading_form = function(e) {
|
|
||||||
if (!M.core_formchangechecker.get_form_dirty_state()) {
|
|
||||||
// the form is not dirty, so don't display any message
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is the error message that we'll show to browsers which support it
|
|
||||||
var warningmessage = 'There are unsaved quickgrading changes. Do you really wanto to leave this page?';
|
|
||||||
|
|
||||||
// Most browsers are happy with the returnValue being set on the event
|
|
||||||
// But some browsers do not consistently pass the event
|
|
||||||
if (e) {
|
|
||||||
e.returnValue = warningmessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// But some require it to be returned instead
|
|
||||||
return warningmessage;
|
|
||||||
}
|
|
||||||
M.mod_assign.init_grading_options = function(Y) {
|
M.mod_assign.init_grading_options = function(Y) {
|
||||||
Y.use('node', function(Y) {
|
Y.use('node', function(Y) {
|
||||||
|
|
||||||
var paginationelement = Y.one('#id_perpage');
|
var paginationelement = Y.one('#id_perpage');
|
||||||
paginationelement.on('change', function(e) {
|
paginationelement.on('change', function(e) {
|
||||||
Y.one('form.gradingoptionsform').submit();
|
Y.one('form.gradingoptionsform').submit();
|
||||||
|
@ -145,28 +126,5 @@ M.mod_assign.init_grading_options = function(Y) {
|
||||||
Y.one('form.gradingoptionsform').submit();
|
Y.one('form.gradingoptionsform').submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
};
|
|
||||||
// override the default dirty form behaviour to ignore any input with the class "ignoredirty"
|
|
||||||
M.mod_assign.set_form_changed = M.core_formchangechecker.set_form_changed;
|
|
||||||
M.core_formchangechecker.set_form_changed = function(e) {
|
|
||||||
var target = e.currentTarget;
|
|
||||||
if (!target.hasClass('ignoredirty')) {
|
|
||||||
M.mod_assign.set_form_changed(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
M.mod_assign.get_form_dirty_state = M.core_formchangechecker.get_form_dirty_state;
|
|
||||||
M.core_formchangechecker.get_form_dirty_state = function() {
|
|
||||||
var state = M.core_formchangechecker.stateinformation;
|
|
||||||
if (state.focused_element) {
|
|
||||||
if (state.focused_element.element.hasClass('ignoredirty')) {
|
|
||||||
state.focused_element.initial_value = state.focused_element.element.get('value')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return M.mod_assign.get_form_dirty_state();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue