1const customGraderReportJavascript=()=>{if(!document.querySelector('tr.controls')){return} 2const courseid=document.querySelector('#gradereport_grader div input[name=id]').value;const autoSaveInterval=5000;const isAttendanceColumn=(str)=>{return/day(\s|\.|-|:|;)*[0-9]+/i.test(str)} 3const showLoadingScreen=()=>{window.onbeforeunload=null;const loadingScreen=document.getElementById('bulkOpLoadingScreen');loadingScreen.style.display='block';loadingScreen.querySelector('div.modal-dialog').focus()} 4const createTrap=(tabbableElems)=>{return(e)=>{const isTabPressed=e.key==='Tab'||e.keyCode===9;const firstFocusableElement=tabbableElems[0];const lastFocusableElement=tabbableElems[tabbableElems.length-1];if(!isTabPressed){return} 5if(e.shiftKey){if(document.activeElement===firstFocusableElement){lastFocusableElement.focus();e.preventDefault()}}else{if(document.activeElement===lastFocusableElement){firstFocusableElement.focus();e.preventDefault()}}}} 6const detectIdle=(autoSaveIntervalId)=>{const updateIntervalMillis=10000;const maxSecondsIdle=300;const page=document.getElementById('page');let secondsIdle=0;const incrementTimer=()=>{secondsIdle+=updateIntervalMillis/1000;if(secondsIdle>maxSecondsIdle){const reloadButton=document.querySelector('#idleDetectedScreen button.confirm');const trapInModal=createTrap([reloadButton]);document.getElementById('idleDetectedScreen').style.display='block';reloadButton.focus();document.addEventListener('keydown',trapInModal);window.removeEventListener('beforeunload',save);clearInterval(autoSaveIntervalId);clearInterval(timerIntervalId)}} 7const timerIntervalId=setInterval(incrementTimer,updateIntervalMillis);page.addEventListener('mousemove',()=>secondsIdle=0);page.addEventListener('keydown',()=>secondsIdle=0);page.addEventListener('click',()=>secondsIdle=0)} 8const addAttendanceButtons=(autoSaveIntervalId)=>{const attendanceGradeItemElements=Object.values(document.querySelectorAll('span[title^=Day i]'));const gradeItemIds=attendanceGradeItemElements.filter(node=>isAttendanceColumn(node.title)&&node.parentElement.nodeName=='TH').map(node=>node.parentElement.getAttribute('data-itemid'));gradeItemIds.forEach(id=>{const controlsCell=document.querySelector('td.controls.icons.i'+id);const formid='attendance_item_'+id;const formNode=document.createElement('form');formNode.setAttribute('id',formid);formNode.setAttribute('action','customForms.php?id='+courseid+`&attendancegradeitemid=`+id);formNode.setAttribute('method','post');formNode.addEventListener('submit',(event)=>{window.clearInterval(autoSaveIntervalId);showLoadingScreen();formNode.submit()});document.querySelector('body').appendChild(formNode);const newHtml=` 9 <div style='display: flex; flex-direction: column;'> 10 <label style='margin-bottom: 2px;' for='attendanceselection'>Set column to:</label> 11 <select id='select_`+formid+`' name='attendanceselection' form='`+formid+`' required> 12 <option value=''>NO SELECTION</option> 13 <option value='2'>Yes</option> 14 <option value='1'>No</option> 15 <option value='0'>No grade</option> 16 </select> 17 </div> 18 `;controlsCell.innerHTML=controlsCell.innerHTML+newHtml;var inputid='select_'+formid;var selectElement=document.getElementById(inputid);selectElement.addEventListener('change',function(){let submittedval=this.value;let urltovisit=document.getElementById(this.getAttribute('form')).getAttribute('action')+'&attendanceselection='+submittedval;console.log(this.getAttribute('form'));let http=new XMLHttpRequest() 19http.open('POST',urltovisit) 20http.onload=function(){if(submittedval!=''){if(submittedval=='0'){submittedval='-1'} 21$('td.i'+id).each(function(){if($(this).find('select').attr('name')!='attendanceselection'){$(this).find('select').val(submittedval)}});$('[name="attendanceselection"]').val('')}} 22http.send()})})} 23const addCertificationEarnedToggle=(autoSaveIntervalId)=>{const certEarnedElem=document.querySelector('span[title="Certification
23Earned"');if(!certEarnedElem){return} 24const id=certEarnedElem.parentElement.getAttribute('data-itemid');const controlsCell=document.querySelector('td.controls.icons.i'+id);const formid='certification_earned_'+id;const formNode=document.createElement('form');formNode.setAttribute('id',formid);formNode.setAttribute('action','customForms.php?id='+courseid+`&certificationearnedgradeitemid=`+id);formNode.setAttribute('method','post');document.querySelector('body').appendChild(formNode);const handleChange=(event)=>{const certConfirm=document.getElementById('certificationConfirmation');certConfirm.style.display='block';const OKButton=document.querySelector('#certificationConfirmation button.confirm');const cancelButton=document.querySelector('#certificationConfirmation button.cancel');cancelButton.focus();const trapInModal=createTrap([OKButton,cancelButton]);document.addEventListener('keydown',trapInModal);const handleOK=(event)=>{certConfirm.style.display='none';OKButton.removeEventListener('click',handleOK);cancelButton.removeEventListener('click',handleCancel);document.removeEventListener('keydown',trapInModal);window.clearInterval(autoSaveIntervalId)};const handleCancel=(event)=>{certConfirm.style.display='none';document.getElementById('select_'+formid).selectedIndex=0;cancelButton.removeEventListener('click',handleCancel);OKButton.removeEventListener('click',handleOK);document.removeEventListener('keydown',trapInModal)};OKButton.addEventListener('click',handleOK);cancelButton.addEventListener('click',handleCancel)};const certEarnedCol=document.querySelector('span[title="Certification Earned"') 25const itemId=certEarnedCol.parentElement.dataset.itemid;const certEarnedSelect=document.querySelector('td.grade.i'+itemId+' select');const newHtml=` 26 <div style='display: flex; flex-direction: column;'> 27 <label style='margin-bottom: 2px;' for='certificationEarnedSelection'>Set column to:</label> 28 <select id='select_`+formid+`' name='certificationEarnedSelection' form='`+formid+`' required> 29 </select> 30 </div> 31 `;controlsCell.innerHTML=controlsCell.innerHTML+newHtml;const select=document.getElementById('select_'+formid);select.innerHTML=select.innerHTML+`<option value=''>NO SELECTION</option>`+certEarnedSelect.innerHTML;select.selectedIndex=0;select.addEventListener('change',handleChange);$("button#certificatepopup").click(function(e){var submittedval=$("select[name=certificationEarnedSelection]").val();let urltovisit=$('#'+$("select[name=certificationEarnedSelection]").attr("form")).attr('action')+'&certificationEarnedSelection='+submittedval;let http=new XMLHttpRequest() 32http.open('POST',urltovisit) 33http.onload=function(){if(submittedval!=''){$('td.i'+id).each(function(){if($(this).find('select').attr('name')!='certificationEarnedSelection'){$(this).find('select').val(submittedval)}});$('[name="certificationEarnedSelection"]').val('');$('#bulkOpLoadingScreen').hide()}} 34http.send()})} 35const addCertificationSelectListeners=()=>{const certEarnedCol=document.querySelector('span[title="Certification Earned"') 36if(!certEarnedCol){return} 37const itemId=certEarnedCol.parentElement.dataset.itemid;Object.values(document.querySelectorAll('td.grade.i'+itemId+' select')).forEach(selectElem=>{const handleChange=(event)=>{const newSelection=selectElem.selectedIndex;selectElem.selectedIndex=selectElem.dataset.previousSelection;const certConfirm=document.getElementById('certificationConfirmation');certConfirm.style.display='block';const OKButton=document.querySelector('#certificationConfirmation button.confirm');const cancelButton=document.querySelector('#certificationConfirmation button.cancel');cancelButton.focus();const trapInModal=createTrap([OKButton,cancelButton]);document.addEventListener('keydown',trapInModal);const handleOK=(event)=>{certConfirm.style.display='none';selectElem.selectedIndex=newSelection;OKButton.removeEventListener('click',handleOK);cancelButton.removeEventListener('click',handleCancel);document.removeEventListener('keydown',trapInModal)};const handleCancel=(event)=>{certConfirm.style.display='none';cancelButton.removeEventListener('click',handleCancel);OKButton.removeEventListener('click',handleOK);document.removeEventListener('keydown',trapInModal)};OKButton.addEventListener('click',handleOK);cancelButton.addEventListener('click',handleCancel)};selectElem.addEventListener('focus',(event)=>selectElem.dataset.previousSelection=selectElem.selectedIndex);selectElem.addEventListener('change',handleChange)})} 38const hideFields=()=>{Object.values(document.querySelectorAll('.grade_icons')).forEac
38h(elem=>elem.style.display='none')} 39const addStyles=()=>{const attendanceGradeItemElements=Object.values(document.querySelectorAll('span[title^=Day i]'));const gradeItemIds=attendanceGradeItemElements.filter(node=>isAttendanceColumn(node.title)&&node.parentElement.nodeName=='TH').map(node=>node.parentElement.getAttribute('data-itemid'));const gradeItemsToAlter=gradeItemIds.map(id=>Object.values(document.querySelectorAll('td.grade.i'+id+' select')));[].concat(...gradeItemsToAlter).forEach(gradeItem=>gradeItem.style.width='90%')} 40const save=()=>{const form=document.getElementById('gradereport_grader');const timepageload=form.firstChild.querySelector('input[name="timepageload"');const data=new URLSearchParams(new FormData(form));fetch('index.php',{method:'post',body:data}).then(timepageload.setAttribute('value',Math.round(Date.now()/1000)))} 41let timeout;$("#user-grades textarea").on('keyup',function(){clearTimeout(timeout);timeout=setTimeout(function(){const note=$(this).val().replaceAll('\n','\\n');const courseid=$(this).data('courseid');const userid=$(this).data('userid');fetch('ajax_notes.php?action=get_notesdetails&courseid='+courseid+'&userid='+userid+'&content='+note,{method:'get'})}.bind(this),2000)});const certificationConfirmationInnerHTML=` 42 <div class="modal moodle-has-zindex show" data-region="modal-container" aria-hidden="false" role="dialog" tabindex="-1" style="z-index: 1052;"> 43 <div class="modal-dialog " role="document" data-region="modal" aria-labelledby="4-modal-title" tabindex="0"> 44 45 <div class="modal-content"> 46 47 <div class="modal-header " data-region="header"> 48 <h5 class="modal-title" data-region="title">Confirm</h5> 49 </div> 50 51 <div class="modal-body" data-region="body"> 52 Choose OK to apply your change(s) 53 for certification earned. All changes will be applied immediately and 54 users will be able to access any related certificates. 55 If you do not want to make changes or are unsure, 56 choose Cancel and no changes will be made. 57 </div> 58 59 <div class="modal-footer" data-region="footer"> 60 <button type="button" class="btn btn-primary confirm" id="certificatepopup" data-action="save">OK</button> 61 <button type="button" class="btn btn-secondary cancel" data-action="cancel">Cancel</button> 62 </div> 63 </div> 64 </div> 65 </div> 66 <div class="modal moodle-has-zindex show" data-region="modal-container" aria-hidden="false" role="dialog" tabindex="-1" style="z-index: 1051; background-color: black; opacity: 0.7;"> 67 ` 68const certificationConfirmation=document.createElement('div');certificationConfirmation.setAttribute('id','certificationConfirmation');certificationConfirmation.style.display='none';certificationConfirmation.innerHTML=certificationConfirmationInnerHTML;document.querySelector('body').appendChild(certificationConfirmation);const bulkOpLoadingScreenInnerHTML=` 69 <div class="modal moodle-has-zindex show" data-region="modal-container" aria-hidden="false" role="dialog" tabindex="-1" style="z-index: 1052;"> 70 <div class="modal-dialog " role="document" data-region="modal" aria-labelledby="4-modal-title" tabindex="0"> 71 72 <div class="modal-content"> 73 74 <div class="modal-header " data-region="header"> 75 <h5 class="modal-title" data-region="title">Please wait while your edits are loading.</h5> 76 </div> 77 78 <div class="modal-body" data-region="body"> 79 This operation may take between 5-20 seconds. 80 </div> 81 82 </div> 83 </div> 84 </div> 85 <div class="modal moodle-has-zindex show" data-region="modal-container" aria-hidden="false" role="dialog" tabindex="-1" style="z-index: 1051; background-color: black; opacity: 0.7;"> 86 ` 87const bulkOpLoadingScreen=document.createElement('div');bulkOpLoadingScreen.setAttribute('id','bulkOpLoadingScreen');bulkOpLoadingScreen.style.display='none';bulkOpLoadingScreen.innerHTML=bulkOpLoadingScreenInnerHTML;document.querySelector('body').appendChild(bulkOpLoadingScreen);const idleDetectedScreenInnerHTML=` 88 <div class="modal moodle-has-zindex show" data-region="modal-container" aria-hidden="false" role="dialog" tabindex="-1" style="z-index: 1052;"> 89 <div class="modal-dialog " role="document" data-region="modal" aria-labelledby="4-modal-title" tabindex="0"> 90 91 <div class="modal-content"> 92 93 <div class="modal-header " data-region="header"> 94 <h5 class="modal-title" data-region="title">Idle detected</h5> 95 </div> 96 97 <div class="modal-body" data-region="body"> 98 In an effort to reduce unwanted or accidental edits, this site is set to pause after five minutes 99 of inactivity. To continue updating the gradebook, please click Reload. 100 </div> 101 102 <div class="modal-footer" data-region="footer"> 103 <button type="button" class="btn btn-primary confirm">Reload</button> 104 </div> 105 </div> 106 </div> 107 </div> 108 <div class="modal moodle-has-zindex show" data-region="modal-container" aria-hidden="false" role="dialog" tabindex="-1" style="z-index: 1051; background-color: black; opacity: 0.7;"> 109 ` 110const idleDetectedScreen=document.createElement('div');idleDetectedScreen.setAttribute('id','idleDetectedScreen');idleDetectedScreen.style.display='none';idleDetectedScreen.innerHTML=idleDetectedScreenInnerHTML;document.querySelector('body').appendChild(idleDetectedScreen);document.querySelector('#idleDetectedScreen button.confirm').addEventListener('click',()=>location.reload());window.addEventListener("beforeunload",save);window.setTimeout(()=>{window.onbeforeunload=null},750);const entryTipsContainer=document.createElement('div');entryTipsContainer.style.display='flex';const notesEntryTips=document.createElement('p');notesEntryTips.style.margin='0 5em 0 0.5em';notesEntryTips.innerHTML=`Changes are saved automatically every ${autoSaveInterval / 1000} seconds.`;const certificationEntryTips=document.createElement('p');certificationEntryTips.style.fontWeight='bold';certificationEntryTips.innerHTML=`The WMA Office considers a course complete when the
111 Certification Earned and Attendance columns and the Skill Proficiency Checklist activity 112 are completed. Remember to designate downgrades and failures. Certifications should be handed out 113 on the last day of class. To facilitate this, the WMA office will ship certifications to the contact 114 designated on the booking form as soon as the roster in Moodle is confirmed via email by the CI or 115 IOR. In the event of a last-minute enrollment, a downgrade, or a misspelled name on a certification 116 card, the WMA office will ship those certifications to the students directly after the course. WMA should not 117 receive requests directly from students for these certifications. 118 The instructor must enter the studentâs mailing address in the Moodle Notes column next to student 119 name, to facilitate this. We expect these requests to be infrequent.`;entryTipsContainer.appendChild(notesEntryTips);entryTipsContainer.appendChild(certificationEntryTips);const gradereport=document.getElementById('gradereport_grader');gradereport.parentElement.insertBefore(entryTipsContainer,gradereport);const autoSaveIntervalId=setInterval(()=>save(),autoSaveInterval);hideFields();addStyles();addAttendanceButtons(autoSaveIntervalId);addCertificationEarnedToggle(autoSaveIntervalId);addCertificationSelectListeners();detectIdle(autoSaveIntervalId)} 120const customGraderReportJavascriptEditingOff=()=>{const elems=document.querySelectorAll('.hidemeplease');const makeWidthZero=elements=>{for(const elem of elements){elem.style.width='0';elem.style.margin='0';elem.style.padding='0';elem.style.border='0';elem.classList.add('hidemeplease');makeWidthZero(elem.children)}} 121makeWidthZero(elems)} 122if(document.getElementById('page-grade-report-grader-index')){document.addEventListener('DOMContentLoaded',()=>customGraderReportJavascript());document.addEventListener('DOMContentLoaded',()=>customGraderReportJavascriptEditingOff())}; 123document.addEventListener('DOMContentLoaded',()=>{if(!document.getElementById('page-login-signup')){return} 124const cityInput=document.getElementById('fitem_id_city');if(cityInput){cityInput.style.display='none'} 125const enrollkeyInput=document.getElementById('id_signup_token');if(enrollkeyInput){if(/^\s+$/.test(enrollkeyInput.value)){enrollkeyInput.value=''}}}); 126$(document).ready(function(){if($("body#page-mod-h5pactivity-view").length>0){function getUrlParams(){const urlParams={};const queryString=window.location.search.slice(1);const paramPairs=queryString.split('&');for(const pair of paramPairs){const[key,value]=pair.split('=');urlParams[key]=decodeURIComponent(value.replace(/\+/g,' '))} 127return urlParams} 128const params=getUrlParams();if(params.id){var h5pinterval=setInterval(function(){var url=M.cfg.wwwroot+'/theme/boost/checkh5pstatus.php';var datasend={'h5pactivityid':params.id};fetch(url,{method:'POST',body:JSON.stringify(datasend),headers:{'Content-Type':'application/json'}}).then(response=>{if(!response.ok){throw new Error("Network response was not ok.")} 129return response.json()}).then(data=>{if(data){if(data.completionstate==1){var el=$("ul.courseindex-sectioncontent").find('li[id$="course-index-cm-'+params.id+'"]');if(el.find('span.completion_incomplete').length>0){el.find('span.completion_incomplete').removeClass("completion_incomplete").addClass("completion_complete");el.find('span.completion_complete').attr('data-value','1');el.find('span>i').removeClass('fa-circle-thin').addClass('fa-circle');el.find('span>i').attr({'title':'Done','aria-label':'Done'})} 130clearInterval(h5pinterval)}}else{console.log("Data not available or an error occurred.")}}).catch(error=>{console.error("Unexpected error occurred:",error)})},5000)}}})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.