');this.editfeedback=this.report.ajax.showquickfeedback;this.grade=this.report.Y.Node.create('');this.gradetype='value';this.inputdiv.append(this.grade);if(this.report.ajax.showquickfeedback){this.feedback=this.report.Y.Node.create('');this.inputdiv.append(this.feedback)}};M.gradereport_grader.classes.textfield.prototype.keyevents=[];M.gradereport_grader.classes.textfield.prototype.editable=!1;M.gradereport_grader.classes.textfield.prototype.gradetype=null;M.gradereport_grader.classes.textfield.prototype.grade=null;M.gradereport_grader.classes.textfield.prototype.report=null;M.gradereport_grader.classes.textfield.prototype.node=null;M.gradereport_grader.classes.textfield.prototype.gradespam=null;M.gradereport_grader.classes.textfield.prototype.inputdiv=null;M.gradereport_grader.classes.textfield.prototype.editfeedback=!1;M.gradereport_grader.classes.textfield.prototype.replace=function(){this.set_grade(this.get_grade());if(this.editfeedback){this.set_feedback(this.get_feedback())}
this.node.replaceChild(this.inputdiv,this.gradespan);if(this.grade){this.grade.focus()}else if(this.feedback){this.feedback.focus()}
this.editable=!0;return this};M.gradereport_grader.classes.textfield.prototype.commit=function(){var result=(function(field){field.editable=!1;var oldgrade=field.get_grade();if(oldgrade=='-'){oldgrade=''}
var feedback=null;var oldfeedback=null;if(field.editfeedback){oldfeedback=field.get_feedback()}
field.editable=!0;if(field.editfeedback){feedback=field.get_feedback()}
return{gradetype:field.gradetype,editablefeedback:field.editfeedback,grade:field.get_grade(),oldgrade:oldgrade,feedback:feedback,oldfeedback:oldfeedback}})(this);this.set_grade(result.grade);if(this.editfeedback){this.set_feedback(result.feedback)}
return result};M.gradereport_grader.classes.textfield.prototype.revert=function(){this.node.replaceChild(this.gradespan,this.inputdiv);for(var i in this.keyevents){if(this.keyevents[i]){this.keyevents[i].detach()}}
this.keyevents=[];this.node.on('click',this.report.ajax.make_editable,this.report.ajax)};M.gradereport_grader.classes.textfield.prototype.get_grade=function(){if(this.editable){return this.grade.get('value')}
return this.gradespan.get('innerHTML')};M.gradereport_grader.classes.textfield.prototype.set_grade=function(value){if(!this.editable){if(value=='-'){value=''}
this.grade.set('value',value)}else{if(value==''){value='-'}
this.gradespan.set('innerHTML',value)}};M.gradereport_grader.classes.textfield.prototype.get_feedback=function(){if(this.editable){if(this.feedback){return this.feedback.get('value')}else{return null}}
var properties=this.report.get_cell_info(this.node);if(properties){return properties.feedback}
return ''};M.gradereport_grader.classes.textfield.prototype.set_feedback=function(value){if(!this.editable){if(this.feedback){this.feedback.set('value',value)}}else{var properties=this.report.get_cell_info(this.node);this.report.update_feedback(properties.userid,properties.itemid,value)}};M.gradereport_grader.classes.textfield.prototype.has_changed=function(){if(!this.editable){return!1}
if(this.editfeedback){var properties=this.report.get_cell_info(this.node);if(this.get_feedback()!=properties.feedback){return!0}}
if(this.grade){return(this.get_grade()!=this.gradespan.get('innerHTML'))}else{return!1}};M.gradereport_grader.classes.textfield.prototype.attach_key_events=function(){var a=this.report.ajax;if(this.editfeedback){if(this.grade){this.keyevents.push(this.report.Y.on('key',a.keypress_tab,this.grade,'down:9+shift',a))}
this.keyevents.push(this.report.Y.on('key',a.keypress_tab,this.feedback,'down:9',a,!0));this.keyevents.push(this.report.Y.on('key',a.keypress_enter,this.feedback,'up:13',a))}else{if(this.grade){this.keyevents.push(this.report.Y.on('key',a.keypress_tab,this.grade,'down:9',a))}}
this.keyevents.push(this.report.Y.on('key',a.keypress_arrows,this.inputdiv.ancestor('td'),'down:37,38,39,40+ctrl',a));if(this.grade){this.keyevents.push(this.report.Y.on('key',a.keypress_enter,this.grade,'up:13',a));this.keyevents.push(this.report.Y.on('key',function(e){e.preventDefault()},this.grade,'down:37,38,39,40+ctrl'));this.keyevents.push(this.report.Y.on('key',function(e){e.preventDefault()},this.grade,'press:37,38,39,40+ctrl'));this.keyevents.push(this.report.Y.on('key',function(e){e.preventDefault()},this.grade,'up:37,38,39,40+ctrl'))}};M.gradereport_grader.classes.feedbackfield=function(report,node){this.report=report;this.node=node;this.gradespan=node.one('.gradevalue');this.inputdiv=this.report.Y.Node.create('');this.editfeedback=this.report.ajax.showquickfeedback;this.gradetype='text';if(this.report.ajax.showquickfeedback){this.feedback=this.report.Y.Node.create('');this.inputdiv.append(this.feedback)}};M.gradereport_grader.classes.feedbackfield.prototype.get_grade=function(){return null};M.gradereport_grader.classes.feedbackfield.prototype.set_grade=function(){return};for(var i in M.gradereport_grader.classes.textfield.prototype){if(!M.gradereport_grader.classes.feedbackfield.prototype[i]){M.gradereport_grader.classes.feedbackfield.prototype[i]=M.gradereport_grader.classes.textfield.prototype[i]}}
M.gradereport_grader.classes.scalefield=function(report,node){this.report=report;this.node=node;this.gradespan=node.one('.gradevalue');this.inputdiv=this.report.Y.Node.create('');this.editfeedback=this.report.ajax.showquickfeedback;this.grade=this.report.Y.Node.create('');this.gradetype='scale';this.inputdiv.append(this.grade);if(this.editfeedback){this.feedback=this.report.Y.Node.create('');this.inputdiv.append(this.feedback)}
var properties=this.report.get_cell_info(node);this.scale=this.report.ajax.scales[properties.itemscale];for(var i in this.scale){if(this.scale[i]){this.grade.append(this.report.Y.Node.create(''))}}};M.gradereport_grader.classes.scalefield.prototype.scale=[];M.gradereport_grader.classes.scalefield.prototype.get_grade=function(){if(this.editable){return this.grade.all('option').item(this.grade.get('selectedIndex')).get('value')}else{var value=this.gradespan.get('innerHTML');for(var i in this.scale){if(this.scale[i]==value){return parseFloat(i)+1}}
return-1}};M.gradereport_grader.classes.scalefield.prototype.set_grade=function(value){if(!this.editable){if(value=='-'){value='-1'}
this.grade.all('option').each(function(node){if(node.get('value')==value){node.set('selected',!0)}})}else{if(value==''||value=='-1'){value='-'}else{value=this.scale[parseFloat(value)-1]}
this.gradespan.set('innerHTML',value)}};M.gradereport_grader.classes.scalefield.prototype.has_changed=function(){if(!this.editable){return!1}
var gradef=this.get_grade();this.editable=!1;var gradec=this.get_grade();this.editable=!0;if(this.editfeedback){var properties=this.report.get_cell_info(this.node);var feedback=properties.feedback;return(gradef!=gradec||this.get_feedback()!=feedback)}
return(gradef!=gradec)};for(var i in M.gradereport_grader.classes.textfield.prototype){if(!M.gradereport_grader.classes.scalefield.prototype[i]){M.gradereport_grader.classes.scalefield.prototype[i]=M.gradereport_grader.classes.textfield.prototype[i]}}