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;i0.999) { var pos=YAHOO.util.Dom.getXY(form.image); pos[0]+=20; // Icon size + 4px border YAHOO.util.Dom.setStyle(form.saved,'display','block'); YAHOO.util.Dom.setXY(form.saved,pos); } setTimeout(function() { completion_update_animation(form,opacity-0.1); },100); } function completion_handle_failure(o) { alert('An error occurred when attempting to connect to our server. The tick mark will not be saved.\n\n('+ o.status+' '+o.statusText+')'); } function completion_toggle(e) { YAHOO.util.Event.preventDefault(e); // By setting completion_wwwroot you can cause it to use absolute path // otherwise script assumes it is called from somewhere in /course var target = moodle_cfg.wwwroot + '/course/togglecompletion.php'; YAHOO.util.Connect.asyncRequest('POST',target, {success:completion_handle_response,failure:completion_handle_failure,scope:this}, 'id='+this.cmid+'&completionstate='+this.otherState+'&fromajax=1'); } function completion_set_progressicon_visibility(spanid,displaystatus) { // Check if the progress icon exists if (document.getElementById(spanid)!= null) { if (displaystatus=='show') { document.getElementById(spanid).style.display="block"; } else if (displaystatus=='hide') { document.getElementById(spanid).style.display="none"; } else { alert ("An error occurred when calling completion_set_progressicon_visibility() function."); } } }