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]);
}
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;
'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.