Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-33843: Remove custom dirty form handling and use default behaviou…

…r in assignment
  • Loading branch information...
commit 5382eabbec3a70dd9f59d58a8b0f4a8caded8a29 1 parent 1ee9b37
Damyon Wiese authored
View
10 mod/assign/gradingoptionsform.php
@@ -48,13 +48,15 @@ function definition() {
$mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
// visible elements
$options = array(-1=>'All',10=>'10', 20=>'20', 50=>'50', 100=>'100');
- $mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options, array('class'=>'ignoredirty'));
- $options = array(''=>get_string('filternone', 'assign'), ASSIGN_FILTER_SUBMITTED=>get_string('filtersubmitted', 'assign'), ASSIGN_FILTER_REQUIRE_GRADING=>get_string('filterrequiregrading', 'assign'));
- $mform->addElement('select', 'filter', get_string('filter', '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'));
+ $mform->addElement('select', 'filter', get_string('filter', 'assign'), $options);
// quickgrading
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->setDefault('quickgrading', $instance['quickgrading']);
}
View
4 mod/assign/gradingtable.php
@@ -119,7 +119,7 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
// 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
if (!$this->is_downloading()) {
@@ -303,7 +303,7 @@ function col_fullname($row) {
* @return string
*/
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 . '"/>';
}
/**
View
38 mod/assign/module.js
@@ -110,24 +110,6 @@ 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) {
Y.use('node', function(Y) {
@@ -150,23 +132,3 @@ M.mod_assign.init_grading_options = function(Y) {
};
-// 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();
-}
-
Please sign in to comment.
Something went wrong with that request. Please try again.