Skip to content
Snippets Groups Projects
Commit f7cc8500 authored by Isabel Uffinger's avatar Isabel Uffinger
Browse files

removed debugging output

parent a0a55e0c
No related branches found
No related tags found
No related merge requests found
define ("qtype_moopt/creation_via_drag_and_drop",["core/ajax","qtype_moopt/edit_editor_content"],function(a,b){return{init:function init(a){var b=this;document.querySelector("#loadproformataskfilebutton").addEventListener("click",function(){b.extractInformation(a)})},extractInformation:function extractInformation(){var c=document.querySelector("#id_proformataskfileupload").parentNode,d=null;c.childNodes.forEach(function(a){if("proformataskfileupload"==a.name&&null===d){d=a.value}});a.call([{methodname:"qtype_moopt_extract_task_infos_from_draft_file",args:{itemid:d},done:function done(c){if("undefined"!=typeof c.error){document.querySelector("#id_error_ajaxerrorlabel").parentNode.children.item(0).innerHTML="<div>"+c.error+"</div>";document.querySelector("#id_error_ajaxwarnlabel").parentNode.children.item(0).innerHTML="";return}document.querySelector("#id_error_ajaxerrorlabel").parentNode.children.item(0).innerHTML="";document.querySelector("#id_name").value=c.title;b.setContents("id_questiontext",c.description);b.setContents("id_internaldescription",c.internaldescription);b.setContents("id_taskuuid",c.taskuuid);b.setContents("id_defaultmark",c.maxscoregradinghints);b.setContents("id_generalfeedback",c.filesdisplayedingeneralfeedback);a.call([{methodname:"qtype_moopt_get_grader_data",args:{},done:function done(a){if(0<a.length){for(var b=a[0],d=document.querySelector("#id_graderselect"),e=d.options[d.selectedIndex].value,f=0,g;f<a.length;f++){g=a[f].html_representation;if(g===e){b=a[f];break}}var h=[];a.forEach(function(a){if("proglangs"in a){for(var b=0;b<a.proglangs.length;b++){if(a.proglangs[b].toLowerCase()===c.proglang.toLowerCase()){h.push(a);break}}}});if(0<h.length){var j=[],l=h[0].name;h.forEach(function(a){if(a.name===l){j.push(a)}});if(0<j.length){b=j[0];for(var m=1;m<j.length;m++){for(var n=j[m].version.split("."),o=b.version.split("."),p=0;2>p;p++){if(parseInt(n[p])>parseInt(o[p])){b=j[m];break}else if(parseInt(n[p])<parseInt(o[p])){break}}}}}var q=b.html_representation;setSelectionSafely("#id_graderselect option[value='"+q+"']");var r=document.querySelectorAll("[id^=form_autocomplete_input]")[0];console.log(r);r.value=c.proglang;console.log(r.value);enterKeyEvent(r);var s=document.querySelector("#id_graderselect option[value='"+q+"']").text;r.value=s;console.log(r.value);enterKeyEvent(r);r.value="MooPT";console.log(r.value);enterKeyEvent(r);if("result_spec"in b){if("format"in b.result_spec){q=b.result_spec.format;setSelectionSafely("#id_resultspecformat option[value='"+q+"']")}if("structure"in b.result_spec){q=b.result_spec.structure;setSelectionSafely("#id_resultspecstructure option[value='"+q+"']")}if("teacher_feedback_level"in b.result_spec){q=b.result_spec.teacher_feedback_level;setSelectionSafely("#id_teacherfeedbacklevel option[value='"+q+"']")}if("student_feedback_level"in b.result_spec){q=b.result_spec.student_feedback_level;setSelectionSafely("#id_studentfeedbacklevel option[value='"+q+"']")}}}}}]);var d=document.querySelector("#id_enablefilesubmissions");d.checked=!c.enablefileinput;d.click();var e=c.freetextfilesettings.length;d=document.querySelector("#id_enablefreetextsubmissions");d.checked=!(0<e);d.click();if(0<e){d=document.querySelector("#id_ftsnuminitialfields");d.value=e;d.click();d=document.querySelector("#id_ftsmaxnumfields");d.value=e;d.click();d.dispatchEvent(new Event("change"));d=document.querySelector("#id_ftsstandardlang");for(var f=d.options,g=0;g<f.length;g++){if(f[g].text.toLowerCase()===c.proglang.toLowerCase()){d.selectedIndex=g}}d=document.querySelector("#id_enablecustomsettingsforfreetextinputfields");d.checked=!1;d.click();for(var h=0;h<c.freetextfilesettings.length;h++){d=document.querySelector("#id_enablecustomsettingsforfreetextinputfield"+h);d.checked=!c.freetextfilesettings[h].enablecustomsettings;d.click();if(!0==c.freetextfilesettings[h].usefixedfilename){d=document.querySelector("#id_namesettingsforfreetextinput"+h+"_0");d.checked=!1;d.click()}else{d=document.querySelector("#id_namesettingsforfreetextinput"+h+"_1");d.checked=!1;d.click()}document.querySelector("#id_freetextinputfieldname"+h).value=c.freetextfilesettings[h].defaultfilename;document.querySelector("#id_freetextinputfieldtemplate"+h).value=c.freetextfilesettings[h].filecontent;document.querySelector("#id_ftsoverwrittenlang"+h).value=c.freetextfilesettings[h].proglang;document.querySelector("#id_ftsinitialdisplayrows"+h).value=c.freetextfilesettings[h].initialdisplayrows}}var j="";if("undefined"!=typeof c.moodleValidationProformaNamespace){j+="<p>Detected ProFormA-version "+c.moodleValidationProformaNamespace+"</p>"}if("undefined"!=typeof c.moodleValidationWarningInvalidNamespace){j+="<p>"+c.moodleValidationWarningInvalidNamespace+"</p>"}if("undefined"!=typeof c.moodleValidationWarnings){j+="<p>Found the following problems during validation but still continued:</p><ul>";c.moodleValidationWarnings.forEach(function(a){j+="<li>"+a.msg+"</li>"});j+="</ul>"}document.querySelector("#id_error_ajaxwarninglabel").parentNode.children.item(0).innerHTML=j;document.querySelector("#loadproformataskfilebutton").focus()},fail:function fail(a){console.log(a);document.querySelector("#id_error_ajaxerrorlabel").parentNode.children.item(0).innerHTML="<div>"+a.debuginfo+"</div><div> For more information see browser console.</div>";document.querySelector("#id_error_ajaxwarninglabel").parentNode.children.item(0).innerHTML=""}}])}}});function setSelectionSafely(a){select=document.querySelector(a);if(null!==select)select.selected=!0}function enterKeyEvent(a){var b=new KeyboardEvent("keydown",{bubbles:!0,cancelBubble:!1,cancelable:!0,charCode:0,code:"Enter",isTrusted:!0,key:"Enter",keyCode:13,repeat:!1,type:"keydown",which:13});a.dispatchEvent(b)}
define ("qtype_moopt/creation_via_drag_and_drop",["core/ajax","qtype_moopt/edit_editor_content"],function(a,b){return{init:function init(a){var b=this;document.querySelector("#loadproformataskfilebutton").addEventListener("click",function(){b.extractInformation(a)})},extractInformation:function extractInformation(){var c=document.querySelector("#id_proformataskfileupload").parentNode,d=null;c.childNodes.forEach(function(a){if("proformataskfileupload"==a.name&&null===d){d=a.value}});a.call([{methodname:"qtype_moopt_extract_task_infos_from_draft_file",args:{itemid:d},done:function done(c){if("undefined"!=typeof c.error){document.querySelector("#id_error_ajaxerrorlabel").parentNode.children.item(0).innerHTML="<div>"+c.error+"</div>";document.querySelector("#id_error_ajaxwarnlabel").parentNode.children.item(0).innerHTML="";return}document.querySelector("#id_error_ajaxerrorlabel").parentNode.children.item(0).innerHTML="";document.querySelector("#id_name").value=c.title;b.setContents("id_questiontext",c.description);b.setContents("id_internaldescription",c.internaldescription);b.setContents("id_taskuuid",c.taskuuid);b.setContents("id_defaultmark",c.maxscoregradinghints);b.setContents("id_generalfeedback",c.filesdisplayedingeneralfeedback);a.call([{methodname:"qtype_moopt_get_grader_data",args:{},done:function done(a){if(0<a.length){for(var b=a[0],d=document.querySelector("#id_graderselect"),e=d.options[d.selectedIndex].value,f=0,g;f<a.length;f++){g=a[f].html_representation;if(g===e){b=a[f];break}}var h=[];a.forEach(function(a){if("proglangs"in a){for(var b=0;b<a.proglangs.length;b++){if(a.proglangs[b].toLowerCase()===c.proglang.toLowerCase()){h.push(a);break}}}});if(0<h.length){var j=[],l=h[0].name;h.forEach(function(a){if(a.name===l){j.push(a)}});if(0<j.length){b=j[0];for(var m=1;m<j.length;m++){for(var n=j[m].version.split("."),o=b.version.split("."),p=0;2>p;p++){if(parseInt(n[p])>parseInt(o[p])){b=j[m];break}else if(parseInt(n[p])<parseInt(o[p])){break}}}}}var q=b.html_representation;setSelectionSafely("#id_graderselect option[value='"+q+"']");var r=document.querySelectorAll("[id^=form_autocomplete_input]")[0];r.value=c.proglang;enterKeyEvent(r);var s=document.querySelector("#id_graderselect option[value='"+q+"']").text;r.value=s;enterKeyEvent(r);r.value="MooPT";enterKeyEvent(r);if("result_spec"in b){if("format"in b.result_spec){q=b.result_spec.format;setSelectionSafely("#id_resultspecformat option[value='"+q+"']")}if("structure"in b.result_spec){q=b.result_spec.structure;setSelectionSafely("#id_resultspecstructure option[value='"+q+"']")}if("teacher_feedback_level"in b.result_spec){q=b.result_spec.teacher_feedback_level;setSelectionSafely("#id_teacherfeedbacklevel option[value='"+q+"']")}if("student_feedback_level"in b.result_spec){q=b.result_spec.student_feedback_level;setSelectionSafely("#id_studentfeedbacklevel option[value='"+q+"']")}}}}}]);var d=document.querySelector("#id_enablefilesubmissions");d.checked=!c.enablefileinput;d.click();var e=c.freetextfilesettings.length;d=document.querySelector("#id_enablefreetextsubmissions");d.checked=!(0<e);d.click();if(0<e){d=document.querySelector("#id_ftsnuminitialfields");d.value=e;d.click();d=document.querySelector("#id_ftsmaxnumfields");d.value=e;d.click();d.dispatchEvent(new Event("change"));d=document.querySelector("#id_ftsstandardlang");for(var f=d.options,g=0;g<f.length;g++){if(f[g].text.toLowerCase()===c.proglang.toLowerCase()){d.selectedIndex=g}}d=document.querySelector("#id_enablecustomsettingsforfreetextinputfields");d.checked=!1;d.click();for(var h=0;h<c.freetextfilesettings.length;h++){d=document.querySelector("#id_enablecustomsettingsforfreetextinputfield"+h);d.checked=!c.freetextfilesettings[h].enablecustomsettings;d.click();if(!0==c.freetextfilesettings[h].usefixedfilename){d=document.querySelector("#id_namesettingsforfreetextinput"+h+"_0");d.checked=!1;d.click()}else{d=document.querySelector("#id_namesettingsforfreetextinput"+h+"_1");d.checked=!1;d.click()}document.querySelector("#id_freetextinputfieldname"+h).value=c.freetextfilesettings[h].defaultfilename;document.querySelector("#id_freetextinputfieldtemplate"+h).value=c.freetextfilesettings[h].filecontent;document.querySelector("#id_ftsoverwrittenlang"+h).value=c.freetextfilesettings[h].proglang;document.querySelector("#id_ftsinitialdisplayrows"+h).value=c.freetextfilesettings[h].initialdisplayrows}}var j="";if("undefined"!=typeof c.moodleValidationProformaNamespace){j+="<p>Detected ProFormA-version "+c.moodleValidationProformaNamespace+"</p>"}if("undefined"!=typeof c.moodleValidationWarningInvalidNamespace){j+="<p>"+c.moodleValidationWarningInvalidNamespace+"</p>"}if("undefined"!=typeof c.moodleValidationWarnings){j+="<p>Found the following problems during validation but still continued:</p><ul>";c.moodleValidationWarnings.forEach(function(a){j+="<li>"+a.msg+"</li>"});j+="</ul>"}document.querySelector("#id_error_ajaxwarninglabel").parentNode.children.item(0).innerHTML=j;document.querySelector("#loadproformataskfilebutton").focus()},fail:function fail(a){console.log(a);document.querySelector("#id_error_ajaxerrorlabel").parentNode.children.item(0).innerHTML="<div>"+a.debuginfo+"</div><div> For more information see browser console.</div>";document.querySelector("#id_error_ajaxwarninglabel").parentNode.children.item(0).innerHTML=""}}])}}});function setSelectionSafely(a){select=document.querySelector(a);if(null!==select)select.selected=!0}function enterKeyEvent(a){var b=new KeyboardEvent("keydown",{bubbles:!0,cancelBubble:!1,cancelable:!0,charCode:0,code:"Enter",isTrusted:!0,key:"Enter",keyCode:13,repeat:!1,type:"keydown",which:13});a.dispatchEvent(b)}
//# sourceMappingURL=creation_via_drag_and_drop.min.js.map
......@@ -120,16 +120,12 @@ define(['core/ajax',
//setting the proglang and gradername as tag (easiest point to access selected grader name)
let tagInput = document.querySelectorAll('[id^=form_autocomplete_input]')[0];
console.log(tagInput);
tagInput.value = result.proglang;
console.log(tagInput.value);
enterKeyEvent(tagInput);
let gradername = document.querySelector("#id_graderselect option[value='" + searchVal + "']").text;
tagInput.value = gradername;
console.log(tagInput.value);
enterKeyEvent(tagInput);
tagInput.value = "MooPT";
console.log(tagInput.value);
enterKeyEvent(tagInput);
if ('result_spec' in selectedGrader) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment