Moodle
  1. Moodle
  2. MDL-44701

Warning message if leaving the grader without saving

    Details

    • Testing Instructions:
      Hide

      In a course with enrolled users and the 'enableajax' grader preference turned off:

      View the gradebook for the course.
      Enter editing mode.
      Put some grades in the input boxes and don't save them.
      Attempt to use a link on the page to browse somewhere else.
      You should see a warning dialogue telling you that you have unsaved changes, giving you the chance to not navigate away.

      With the enableajax preference turned on, you should see no such warning.

      Lastly, with the preference off, enter some grades and save the changes. You should not be warned about unsaved changes (since you're saving them).

      Show
      In a course with enrolled users and the 'enableajax' grader preference turned off: View the gradebook for the course. Enter editing mode. Put some grades in the input boxes and don't save them. Attempt to use a link on the page to browse somewhere else. You should see a warning dialogue telling you that you have unsaved changes, giving you the chance to not navigate away. With the enableajax preference turned on, you should see no such warning. Lastly, with the preference off, enter some grades and save the changes. You should not be warned about unsaved changes (since you're saving them).
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull 2.6 Branch:
    • Pull Master Branch:

      Description

      If the ajax editing option isn't enabled and you're using quick grading to enter a bunch of grades in the grader report, it's easy to click a link to another page (say a name letter filter or any other link) and be navigated away to another page and lose all the grades you just entered as you hadn't clicked the save/update button.

      This enhancement adds a check with onbeforeunload that checks to see if any of the input elements in the grader report have changed since the page was loaded and if so, present the user with a warning giving them the chance to cancel the navigation and save.

      If the ajax-saving is enabled, this enhancement does nothing - the changes get saved dynamically as you enter them after all.

        Gliffy Diagrams

          Activity

          Hide
          CiBoT added a comment -

          Results for MDL-44701

          • Remote repository: git://github.com/aolley/moodle.git
          Show
          CiBoT added a comment - Results for MDL-44701 Remote repository: git://github.com/aolley/moodle.git Remote branch MDL-44701 to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2362 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2362/artifact/work/smurf.html
          Hide
          Marina Glancy added a comment -

          Hi Adam, thanks for working on it. We already have a module in Moodle to track form changes, all you need is to include module 'moodle-core-formchangechecker' calling init function for the grader form. Search code for examples.
          Thanks again

          Show
          Marina Glancy added a comment - Hi Adam, thanks for working on it. We already have a module in Moodle to track form changes, all you need is to include module 'moodle-core-formchangechecker' calling init function for the grader form. Search code for examples. Thanks again
          Hide
          Andrew Davis added a comment -

          As Marina mentioned this is probably better off using moodle-core-formchangechecker. See line 2644 of /lib/formslib.php to see an example.

          Show
          Andrew Davis added a comment - As Marina mentioned this is probably better off using moodle-core-formchangechecker. See line 2644 of /lib/formslib.php to see an example.
          Hide
          Andrew Davis added a comment -

          Adam, as you have done all of the work on this so far I have added you as the assignee. Feel free to remove yourself if you are unable to work on this any further.

          Show
          Andrew Davis added a comment - Adam, as you have done all of the work on this so far I have added you as the assignee. Feel free to remove yourself if you are unable to work on this any further.
          Hide
          Adam Olley added a comment -

          I wasn't aware of formchangechecker. I'll change it to make use of that.

          Show
          Adam Olley added a comment - I wasn't aware of formchangechecker. I'll change it to make use of that.
          Hide
          Adam Olley added a comment -

          I've now changed it to use the formchangechecker module. I had to give the form a id for it, hopefully "gradereport_grader" is okay for that.

          Show
          Adam Olley added a comment - I've now changed it to use the formchangechecker module. I had to give the form a id for it, hopefully "gradereport_grader" is okay for that.
          Hide
          CiBoT added a comment -

          Results for MDL-44701

          • Remote repository: git://github.com/aolley/moodle.git
          Show
          CiBoT added a comment - Results for MDL-44701 Remote repository: git://github.com/aolley/moodle.git Remote branch MDL-44701 to be integrated into upstream master Executed job http://social.srv.in.moodle.com/job/Precheck%20remote%20branch/2482 Details: http://social.srv.in.moodle.com/job/Precheck%20remote%20branch/2482/artifact/work/smurf.html
          Hide
          Marina Glancy added a comment -

          Thanks a lot Adam.
          I would call it a bug and backport it to supported versions (2.5 and 2.6), what do you think?

          Show
          Marina Glancy added a comment - Thanks a lot Adam. I would call it a bug and backport it to supported versions (2.5 and 2.6), what do you think?
          Hide
          Adam Olley added a comment -

          I have no problem classifying it as such, it's certainly quite painful for graders that accidentally browse away and don't realise they hadn't saved.

          Show
          Adam Olley added a comment - I have no problem classifying it as such, it's certainly quite painful for graders that accidentally browse away and don't realise they hadn't saved.
          Hide
          Andrew Davis added a comment -

          Looks good.

          There is one scenario not covered by the testing instructions. ajaxenabled off and actually save the changes. Presumably you tested this yourself but its nice to see it recorded so we can be sure that still works.

          +1 for backporting provided moodle-core-formchangechecker exists in 2.6 and 2.5. I don't recall when it was introduced. If it exists in 2.6 but not 2.5 backport to 2.6 but its probably not worth bothering with 2.5

          Put this up for integration whenever you are ready.

          Show
          Andrew Davis added a comment - Looks good. There is one scenario not covered by the testing instructions. ajaxenabled off and actually save the changes. Presumably you tested this yourself but its nice to see it recorded so we can be sure that still works. +1 for backporting provided moodle-core-formchangechecker exists in 2.6 and 2.5. I don't recall when it was introduced. If it exists in 2.6 but not 2.5 backport to 2.6 but its probably not worth bothering with 2.5 Put this up for integration whenever you are ready.
          Hide
          Andrew Nicols added a comment -

          Andrew Davis
          ajaxenabled no longer exists.
          formchangechecker has existed since 2.3.

          Show
          Andrew Nicols added a comment - Andrew Davis ajaxenabled no longer exists. formchangechecker has existed since 2.3.
          Hide
          Adam Olley added a comment -

          Hi Andrew,

          Yes, I tested submitting and making sure submit didn't warn you and that the resulting page would let you browse away (since results were saved).

          formchangechecker in its current form was introduced in M2.5 (MDL-38520).

          Show
          Adam Olley added a comment - Hi Andrew, Yes, I tested submitting and making sure submit didn't warn you and that the resulting page would let you browse away (since results were saved). formchangechecker in its current form was introduced in M2.5 ( MDL-38520 ).
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          CiBoT added a comment -

          Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

          Show
          CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
          Hide
          Marina Glancy added a comment -

          Apparently I was not officially peer reviewing so I can integrate it

          Show
          Marina Glancy added a comment - Apparently I was not officially peer reviewing so I can integrate it
          Hide
          Marina Glancy added a comment -

          Thanks Adam, integrated in 2.5, 2.6 and master

          Show
          Marina Glancy added a comment - Thanks Adam, integrated in 2.5, 2.6 and master
          Hide
          Damyon Wiese added a comment -

          Tested on 25, 26 and master.

          I noticed one tiny thing that does not matter much. If ajax is enabled and a change a value, and then click on a link, some little error window comes up as the page is changing - but the value gets saved - so no problem.

          Passing!

          Show
          Damyon Wiese added a comment - Tested on 25, 26 and master. I noticed one tiny thing that does not matter much. If ajax is enabled and a change a value, and then click on a link, some little error window comes up as the page is changing - but the value gets saved - so no problem. Passing!
          Hide
          Adam Olley added a comment -

          Hi Damyon,

          What browser/os did you get that behaviour in?

          Show
          Adam Olley added a comment - Hi Damyon, What browser/os did you get that behaviour in?
          Hide
          Damyon Wiese added a comment -

          Chrome / Linux

          Show
          Damyon Wiese added a comment - Chrome / Linux
          Hide
          Marina Glancy added a comment -

          Thanks for your hard work. Your code is now part of Moodle.

          Show
          Marina Glancy added a comment - Thanks for your hard work. Your code is now part of Moodle.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: