Loading [MathJax]/extensions/tex2jax.js
User: No user logged in.


Assisted form

Storyboard

>Model

ID:(1927, 0)


// cnt_storyboard function show_div(num) { for (i = 0; i < num; i++) { $("#fld_" + i.toString()).show(); } } function one_div(idx, num) { for (i = 0; i < num; i++) { if (idx == i) { $("#fld_" + i.toString()).show(); } else { $("#fld_" + i.toString()).hide(); } } } function sound(txt) { const synth = window.speechSynthesis; slang = "en"; slang = slang + "-" + slang.toUpperCase(); sentences = txt.replace(/\$/g, '').replace(/<[^>]*>?/gm, '').split(/[\\.!?]/); for (i = 0; i < sentences.length; i++) { var utterThis = new SpeechSynthesisUtterance(sentences[i]); utterThis.lang = slang; synth.speak(utterThis); } } // adapt function content_adapt() { // keys var language = ['','en','es','de','pt','fr']; var code = getCookie('druyd1'); if(code == '' || code == '[]'){ code = '{}'; setCookie('druyd1',code,365); } arrcode = JSON.parse(code); // base var cookie = getCookie('druyd0'); if(cookie != '' && cookie.length > 0){ url_structure = window.location.href.split('/'); structure_arr = url_structure[url_structure.length-2].split('-'); dim = structure_arr.length; slang = url_structure[url_structure.length-1]; nlang = language.indexOf(slang); if(nlang == undefined){ nlang = 1; } var code = getCookie('druyd1'); var obj = JSON.parse(code); student = obj.student; if(student == ''){ student = user_data[0]; } if(dim == 1){ $('#title').text("Subject"); $('#cb_main').prop('disabled', true); $('#generate').removeAttr('hidden'); $('#review').removeAttr('hidden'); $('#eva').removeAttr('hidden'); $('#select_variables').hide(); $('#clear').removeAttr('hidden'); $('#generate').show(); id_main = obj.id_subjet; $.ajax({ type:'POST', url: '/getSubjectModel', data: JSON.stringify(["Select",nlang]), contentType:'application/json', dataType: 'json', success: function(data){ main_idx = getIdxComboBox(id_main, data); setupCombobox($('#cb_main'), '100%', data, main_idx, false); if(main_idx == 0){ id_type = 0; } else { id_type = 1; } loadMap(id_main, id_type); } }); } else if(dim == 2){ semester = url_structure[url_structure.length-2].split('-')[1]; $('#title').text("Test"); $('#cb_main').prop('disabled', true); $('#generate').removeAttr('hidden'); $('#review').removeAttr('hidden'); $('#eva').removeAttr('hidden'); $('#clear').removeAttr('hidden'); $('#return').removeAttr('hidden'); $('#select_variables').hide(); $('#generate').show(); $.ajax({ type:'POST', url: '/getSemesterTests', data: JSON.stringify([semester,"Select",nlang]), contentType:'application/json', dataType: 'json', success: function(data){ main_idx = getIdxComboBox(id_main, data[0]); setupCombobox($('#cb_main'), '100%', data[0], main_idx, false); id_type = 2; loadMap(id_main, id_type); } }); } else { // user en_user_cookie = getCookie('druyd'); if(en_user_cookie != '' && en_user_cookie.length > 0){ if(structure_arr.length == 3){ semester = url_structure[url_structure.length-2].split('-')[1]; arr = url_structure[url_structure.length-2].split('-')[2].split('#'); test = arr[0]; if(arr[1] > 1){ subtest = arr[1]; } else { subtest = test; } $('#title').text("Problema"); $('body').css('cursor', 'progress'); $('#cb_main').prop('disabled', true); $('#generate').hide(); if(user_data[0] == 1){ $('#correct').removeAttr('hidden'); $('#correct').show(); $('#ctl_model').removeAttr('hidden'); $('#ctl_model').show(); } $.ajax({ type:'POST', url: '/getMap', data: JSON.stringify([semester, subtest, 3, nlang]), contentType:'application/json', dataType: 'json', success: function(data){ setdata(data); getCbs("Select"); $.ajax({ type:"POST", url:"/setupProblem", data: JSON.stringify([semester, test, student, "Select", "Exercise"]), contentType:"application/json", dataType: 'json', success:function (data) { test_work = data[0]; problem_ctrl = data[1]; setupCombobox($('#cb_main'), '100%', data[2], 0, false); if(test_work < 2){ $('#send').removeAttr('hidden'); $('#password').removeAttr('hidden'); $('#save').removeAttr('hidden'); $('#clear').removeAttr('hidden'); } else { $('#return').removeAttr('hidden'); $('#eva').removeAttr('hidden'); } $('body').css('cursor', 'default'); $('#cb_main').prop('disabled', false); } }); } }); } } else { window.location = window.location.href+'/login'; } } } en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ user_data = JSON.parse(de_user_cookie); if(user_data[0] == 1){ $('#save_clipboard').removeAttr('hidden'); $('#load_clipboard').removeAttr('hidden'); } if(dim < 3){ $('#savefile').removeAttr('hidden'); $('#loadfile').removeAttr('hidden'); } } } // actions $(document).ready(function () { content_adapt() // content_action in cnt_storyboard $('#cb_main').on('select',function(event){ $('#problem_text').html(''); clearForm(); if(dim == 1){ main_idx = $('#cb_main').jqxComboBox('getSelectedIndex'); id_main = $('#cb_main').val(); var code = getCookie('druyd1'); if(code == '[]'){ code = '{}'; } var obj = JSON.parse(code); obj.id_subject = id_main; code = JSON.stringify(obj); setCookie('druyd1',code,365); if(main_idx == 0){ id_type = 0; } else { id_type = 1; } loadMap(semester, id_main, id_type) } else if(dim == 2){ main_idx = $('#cb_main').jqxComboBox('getSelectedIndex'); id_main = $('#cb_main').val(); var code = getCookie('druyd1'); if(code == '[]'){ code = '{}'; } var obj = JSON.parse(code); obj.id_test = id_main; code = JSON.stringify(obj); setCookie('druyd1',code,365); id_type = 2; loadMap(semester, id_main, id_type) } else if(dim > 2){ var code = getCookie('druyd1'); if(code == '[]'){ code = '{}'; } var obj = JSON.parse(code); obj.problem = $('#cb_main').val(); answer_id = $('#cb_main').jqxComboBox('getSelectedIndex'); main_idx = answer_id - 1; var code2 = JSON.stringify(obj); setCookie('druyd1',code2,365); if(problem_ctrl[main_idx] == 0){ var pnew = genProblem(pproblem, convert_list); var xml = buildProblemXml(pnew); problem_ctrl[main_idx] = 1; } else { var xml = ''; } $.ajax({ type:"POST", url:"/getProblemXml", data: JSON.stringify([semester, test, student, obj.problem, xml]), contentType:"application/json", dataType: 'json', success:function (data) { if(select_eq[0] == -1){ setupCombobox($('#equation_0'), '100%', cb_eq_list, 0, false); $('#clip0').removeAttr('hidden'); } if(select_eq[1] == -1){ setupCombobox($('#equation_1'), '100%', cb_eq_list, 0, false); $('#clip1').removeAttr('hidden'); } if(select_eq[2] == -1){ setupCombobox($('#equation_2'), '100%', cb_eq_list, 0, false); $('#clip2').removeAttr('hidden'); } if(select_eq[3] == -1){ setupCombobox($('#equation_3'), '100%', cb_eq_list, 0, false); $('#clip3').removeAttr('hidden'); } /* html = getModelEquation(model_idx); $('#equations').html(html); MathJax.Hub.Queue(['Typeset',MathJax.Hub,'equations']); $('#problem-content2').hide(); $('#problem-content1').show(); $('#help-content2').hide(); $('#help-content1').show(); */ pproblem = loadProblemToStructure(pproblem, data[0], 0); var text = writeQuestion(pproblem, 1, nlang); $('#problem_text').html(text); clearForm(); writeForm(pproblem); loadResponceXml2(data[1]); if(test_work == 2){ loadEvaluateXml2(data[2]); writeReviewForm(); mark = Math.round(100*data[3]); $('#eva').html(' 
'+mark+'%
'); } } }); } if(main_idx > -1){ setupCombobox($('#model'), '100%', cb_model_list, 0, false); for(var i = 0;i < 4;i++){ if(select_eq[i] == -1){ setupCombobox($('#equation_'+i), '100%', cb_eq_list, 0, false); } $('#calc_'+i).prop('disabled',true); } } }); $('#model').on('select',function(event){ model_idx = $('#model').jqxComboBox('getSelectedIndex') - 1; if(model_idx > -1){ getModelParameter('parameters', par_list[model_idx][1], units_list[model_idx][1]); vform_network = setupNetworkModel(model_idx, par_list[model_idx][1], eqcnt_list[model_idx][1], eqpar_list[model_idx][1], units_list[model_idx][1]); network_form_calc('form',vform_network,$('#form_network').width(),800); getModelEquation('equations', eqcnt_list[model_idx][1], eqpar_list[model_idx][1], 2); } else { $('#model-content').hide(); } }); $('#generate').click(function(){ main_idx = $('#cb_main').jqxComboBox('getSelectedIndex'); if(main_idx == 0){ Swal.fire({icon:'error', title: "Error",text: "{{no_topic_selected}}"}); } else { problem_idx = getProblemQuestion('problem_text', 'parameter_text', problem_list, eqpar_list); $('#select_variables').show(); } }); $('#send').click(function(){ if($('#password').val().length == 0){ Swal.fire({icon:'error',title: "Error",text: "No password provided."}); } else { var url_structure = window.location.href.split('/'); url = '/'; for(var i = 3;i < url_structure.length - 2;i++){ url = url + url_structure[i] + '/'; } $.ajax({ type:"POST", url:"/sendTest", data: JSON.stringify([user_data[1], $('#password').val(), semester, test, student]), contentType:"application/json", dataType: 'json', success:function (data) { if(data[0] == 1){ Swal.fire({icon:'success',title: "Success",text: "Test delivered successfully."}); window.location.href = url + 'tests-'+semester+'/'+slang; } else { Swal.fire({icon:'error',title: "Error",text: "Wrong Password, Test Not Delivered."}); } } }); } }); $('#return').click(function(){ window.location.href = '/work/tools/solving.problems/generating.problems/tests-'+semester+'/'+slang; }); $('#answer_save').click(function(){ if(pproblem != {}){ score = reviewForm(pproblem); answer = $('#cb_main').jqxComboBox('getSelectedIndex'); en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ var user_data = JSON.parse(de_user_cookie); de_user = user_data[0]; de_code = user_data[4]; var xml_responce = buildResponceXml2(); var xml_evaluate = buildEvaluateXml2(); $.ajax({ type:"POST", url:"/saveAnswer", data: JSON.stringify([de_user, de_code, semester, test, student, answer, xml_responce, xml_evaluate, score]), contentType:"application/json", dataType: 'json', success:function (data) { if(data['processed'] == 'true'){ Swal.fire({icon:'success',title: "Success",text: "Successful stored."}); } else if(data['meassage'] == 'exercise do not exist'){ Swal.fire({icon:'error',title: "Error",text: "Exercise does not exist." }); } else if(data['meassage'] == 'test not open'){ Swal.fire({icon:'error',title: "Error",text: "Unpaid test." }); } else if(data['meassage'] == 'test not generated'){ Swal.fire({icon:'error',title: "Error",text: "Test not generated." }); } } }); } } }); $('#eva_save').click(function(){ if(pproblem != {}){ answer = $('#cb_main').jqxComboBox('getSelectedIndex'); en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ var user_data = JSON.parse(de_user_cookie); de_user = user_data[0]; de_code = user_data[4]; var score = reviewForm(pproblem); $.ajax({ type:"POST", url:"/saveScore", data: JSON.stringify([de_user, de_code, semester, test, student, answer, score]), contentType:"application/json", dataType: 'json', success:function (data) { if(data['processed'] == 'true'){ Swal.fire({icon:'success',title: "Success",text: "Successful stored."}); } } }); } } }); $('#corr').click(function(){ if(test_work == 0 || test_work == 2){ var mark = reviewForm(pproblem); writeReviewForm(); eva = Math.round(100*mark); $('#eva').html(' 
'+eva+'%
'); $('#mark').val(mark); } }); $('#corr_save').click(function(){ if(pproblem != {}){ answer = $('#cb_main').jqxComboBox('getSelectedIndex'); en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ var user_data = JSON.parse(de_user_cookie); de_user = user_data[0]; de_code = user_data[4]; var score = reviewForm(pproblem); var xml_evaluate = buildEvaluateXml2(); $.ajax({ type:"POST", url:"/saveEvaluation", data: JSON.stringify([de_user, de_code, semester, test, student, answer, xml_evaluate, score]), contentType:"application/json", dataType: 'json', success:function (data) { if(data['processed'] == 'true'){ Swal.fire({icon:'success',title: "Success",text: "Successful stored."}); } } }); } } }); $('#review').click(function(){ if(test_work == 0 || test_work == 2){ var eva = reviewForm(pproblem); writeReviewForm(); mark = Math.round(100*eva); $('#eva').html(' 
'+mark+'%
'); } }); $('#clear').click(function(){ clearForm(); }); $('#save').click(function(){ if(pproblem != {}){ score = reviewForm(pproblem); answer = $('#cb_main').jqxComboBox('getSelectedIndex'); en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ var user_data = JSON.parse(de_user_cookie); de_user = user_data[0]; de_code = user_data[4]; var xml_responce = buildResponceXml2(); var xml_evaluate = buildEvaluateXml2(); $.ajax({ type:"POST", url:"/saveAnswer", data: JSON.stringify([de_user, de_code, semester, test, student, answer, xml_responce, xml_evaluate, score]), contentType:"application/json", dataType: 'json', success:function (data) { if(data['processed'] == 'true'){ Swal.fire({icon:'success',title: "Success",text: "Successful stored."}); } else if(data['meassage'] == 'exercise do not exist'){ Swal.fire({icon:'error',title: "Error",text: "Exercise does not exist." }); } else if(data['meassage'] == 'test not open'){ Swal.fire({icon:'error',title: "Error",text: "Unpaid test." }); } else if(data['meassage'] == 'test not generated'){ Swal.fire({icon:'error',title: "Error",text: "Test not generated." }); } } }); } } }); $('#load').click(function(){ if(main_idx > -1){ $.ajax({ type:"POST", url:"/loadClipboard", data: '1', contentType:"application/json", dataType: 'json', success:function (data) { loadResponceXml1(pproblem,data); } }); } else { Swal.fire({icon:'error',title: "Error",text: "{{no_topic_selected}}"}); } }); $('#save_clipboard').click(function(){ if(pproblem != {}){ en_user_cookie = getCookie('druyd'); if(de_user_cookie != '' && de_user_cookie.length > 0){ var user_data = JSON.parse(de_user_cookie); de_user = user_data[0]; de_code = user_data[4]; var xml = buildProblemXml(pproblem); $.ajax({ type:"POST", url:"/saveClipboard", data: JSON.stringify([de_user, de_code, xml, semester, 2]), contentType:"application/json", dataType: 'json', success:function (data) { // } }); } } }); $('#load_clipboard').click(function(){ if(main_idx > -1){ $.ajax({ type:"POST", url:"/loadClipboard", data: JSON.stringify([semester, 2]), contentType:"application/json", dataType: 'json', success:function (data) { pproblem = loadProblemToStructure(pproblem,data); var text = writeQuestion(pproblem, 1, nlang); $('#problem_text').html(text); clearForm(); writeForm(pproblem); $('#review').prop('disabled',false); $('#eva').html(''); } }); } else { Swal.fire({icon:'error',title: "Error",text: "{{no_topic_selected}}"}); } }); $('#savefile').click(function(){ var xml = 'gPhysicsSolver2.0
'+id_main+'
'+id_type+'
'; var xml_problem = buildProblemXml(pproblem); var xml_responce = buildResponceXml2(); saveFile(xml+'@#@#@'+xml_problem+'@#@#@'+xml_responce); }); $('#loadfile').click(function(){ loadFile(); }); var idx = 0; var num = "1"; $("#lr").hide() $("#content").css({ 'height': (window.innerHeight - $('#head').height() - 16) + 'px' }); $('#select input[type=radio]').change(function () { $("#content").css({ 'height': (window.innerHeight - $('#head').height() - 16) + 'px' }); if ($(this).val() == 2) { $("#lr").show(num); cnt = idx + 1 $('#cnt').text(cnt.toString() + ' of ' + num.toString()); one_div(idx, num); $("#fld_video").hide(); } else { $("#lr").hide(); if ($(this).val() == 3) { one_div(-1, num); $("#fld_video").show(); } else { show_div(num); $("#fld_video").hide(); } } }); $('#select input[type=label]').click(function () { }); $("#left").click(function () { idx--; if (idx < 0) { idx = num - 1; } cnt = idx + 1 $('#cnt').text(cnt.toString() + ' of ' + num.toString()); one_div(idx, num); }); $("#right").click(function () { idx++; if (idx > num - 1) { idx = 0; } cnt = idx + 1 $('#cnt').text(cnt.toString() + ' of ' + num.toString()); one_div(idx, num); }); $("#ctrl").click(function () { if ($("#index-panel").is(":visible") == true) { $("#index-panel").hide(); $('#mainSplitter').jqxSplitter({ panels: [{ size: '0%' }, { size: '100%' }] }); $("#arrow").attr("src", "/static/icons/chevronright32b.png"); } else { $("#index-panel").show(); $('#mainSplitter').jqxSplitter({ panels: [{ size: '25%' }, { size: '75%' }] }); $("#arrow").attr("src", "/static/icons/chevronleft32b.png"); } }); // radiobuttons of Model $('#networkEquation').on("click", function () { setNetworkEquation(vgraph_network); }); $('#networkNumber').on("click", function () { setNetworkNumber(vgraph_network); }); });