MDL-17275: Completion system - needs reload if you use Back button to return to page after changing ticks

This commit is contained in:
sam_marshall
2008-11-18 14:45:13 +00:00
parent 587a1ea358
commit 9a5a069450
2 changed files with 17 additions and 1 deletions
+10 -1
View File
@@ -2,7 +2,15 @@ var completion_strsaved, completion_strtitley, completion_strtitlen,
completion_stralty, completion_straltn;
var completion_wwwroot;
function completion_init() {
function completion_init() {
// Check the reload-forcing
var changeDetector=document.getElementById('completion_dynamic_change');
if(changeDetector.value==1) {
changeDetector.value=0;
window.location.reload();
return;
}
var toggles=YAHOO.util.Dom.getElementsByClassName('togglecompletion', 'form');
for(var i=0;i<toggles.length;i++) {
completion_init_toggle(toggles[i]);
@@ -35,6 +43,7 @@ function completion_init_toggle(form) {
}
function completion_handle_response(o) {
document.getElementById('completion_dynamic_change').value=1;
if(o.responseText!='OK') {
alert('An error occurred when attempting to save your tick mark.\n\n('+o.responseText+'.)');
return;
+7
View File
@@ -208,6 +208,13 @@
'completion_stralty' => get_string('completion-alt-manual-y','completion'),
'completion_straltn' => get_string('completion-alt-manual-n','completion'),
));
// This value tracks whether there has been a dynamic change to the page.
// It is used so that if a user does this - (a) set some tickmarks, (b)
// go to another page, (c) clicks Back button - the page will
// automatically reload. Otherwise it would start with the wrong tick
// values.
print '<form action="."><div><input type="hidden" id="completion_dynamic_change"
name="completion_dynamic_change" value="0" /></div></form>';
}
// Course wrapper start.