MDL-45781 quiz autosave: detect and report when the session is lost.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 30 May 2014 15:20:19 +0000 (16:20 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 30 May 2014 15:26:23 +0000 (16:26 +0100)
and also other errors.

mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-debug.js
mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-min.js
mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave.js
mod/quiz/yui/src/autosave/js/autosave.js

index eb8240d..c9fccf5 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-debug.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-debug.js differ
index aefb7ab..ccbd6a6 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-min.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave-min.js differ
index 75a3a4f..e6a8f44 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave.js and b/mod/quiz/yui/build/moodle-mod_quiz-autosave/moodle-mod_quiz-autosave.js differ
index 3a51aef..546d722 100644 (file)
@@ -341,7 +341,14 @@ M.mod_quiz.autosave = {
         });
     },
 
-    save_done: function() {
+    save_done: function(transactionid, response) {
+        if (response.responseText !== 'OK') {
+            // Because IIS is useless, Moodle can't send proper HTTP response
+            // codes, so we have to detect failures manually.
+            this.save_failed(transactionid, response);
+            return;
+        }
+
         Y.log('Save completed.');
         this.save_transaction = null;