iassign-integration-functions.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. // Função para ler parâmetros informados pelo iTarefa via URL
  2. // Apesar de não ser obrigatório, será muito útil para capturar os parâmetros
  3. function getParameterByName (name, defaultReturn = null) {
  4. var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
  5. return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : defaultReturn;
  6. }
  7. // Criando um object com os parâmetros informados pelo iTarefa
  8. // Observe que para cada parâmetro, é realizada a chamada do método getParameterByName, implementado acima
  9. var iLMparameters = {
  10. iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
  11. iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"),
  12. iLM_PARAM_AssignmentURL: getParameterByName("iLM_PARAM_AssignmentURL"),
  13. iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
  14. iLM_PARAM_TeacherAutoEval: getParameterByName("iLM_PARAM_TeacherAutoEval"),
  15. lang: getParameterByName("lang", "pt")
  16. };
  17. // Set the lang parameter to the localStorage for easy access
  18. // and no dependency to the global scope, avoind future 'strict mode' problems
  19. //localStorage.setItem('ivprog.lang', iLMparameters.lang);
  20. // Função chamada pelo iTarefa quando o professor finaliza a criação da atividade
  21. // ou quando o aluno finaliza a resolução do exercício
  22. // O retorno é um JSON com os dados do exercício ou da resolução
  23. // Esse retorno será armazenado no banco de dados do Moodle, pelo iTarefa
  24. function getAnswer () {
  25. // Se o parâmetro "iLM_PARAM_SendAnswer" for false,
  26. // então trata-se de resolução de atividade
  27. if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
  28. // Montar o retorno com a resposta do aluno
  29. var contentToSend = previousContent.split("\n::algorithm::")[0];
  30. contentToSend += '\n::algorithm::\n';
  31. contentToSend += JSON.stringify(window.program_obj, function(key, value) {
  32. if (key == 'dom_object') {
  33. return;
  34. }
  35. return value;
  36. });
  37. contentToSend += '\n::logs::';
  38. contentToSend += getTrackingLogs();
  39. return contentToSend;
  40. } else {
  41. // Montar o retorno com a criação da atividade do professor
  42. var ret = ' { ' + prepareTestCases()
  43. + ',\n"settings_data_types": \n' + JSON.stringify($('form[name="settings_data_types"]').serializeArray())
  44. + ',\n"settings_commands": \n' + JSON.stringify($('form[name="settings_commands"]').serializeArray())
  45. + ',\n"settings_functions": \n' + JSON.stringify($('form[name="settings_functions"]').serializeArray())
  46. + ' } ';
  47. if ($("input[name='include_algo']").is(':checked')) {
  48. ret += '\n::algorithm::\n';
  49. ret += JSON.stringify(window.program_obj, function(key, value) {
  50. if (key == 'dom_object') {
  51. return;
  52. }
  53. return value;
  54. });
  55. }
  56. return ret;
  57. }
  58. }
  59. function prepareTestCases () {
  60. var ret = ' \n "testcases" : [ '
  61. var test_cases_array = $('form[name="test_cases"]').serializeArray();
  62. console.log(test_cases_array);
  63. for (var i = 0; i < test_cases_array.length; i = i + 2) {
  64. ret += '\n{ ';
  65. ret += '\n "input": [';
  66. var inps = test_cases_array[i].value.match(/[^\r\n]+/g);
  67. if (inps) {
  68. for (var j = 0; j < inps.length; j++) {
  69. ret += '"' + inps[j].trim() + '"';
  70. if ((j + 1) < inps.length) {
  71. ret += ', ';
  72. }
  73. }
  74. }
  75. ret += '], \n "output": [';
  76. var outs = test_cases_array[i+1].value.match(/[^\r\n]+/g);
  77. if (outs) {
  78. for (var j = 0; j < outs.length; j++) {
  79. ret += '"' + outs[j].trim() + '"';
  80. if ((j + 1) < outs.length) {
  81. ret += ', ';
  82. }
  83. }
  84. }
  85. ret += ']';
  86. ret += '\n}'
  87. if ((i + 2) < test_cases_array.length) {
  88. ret += ',';
  89. }
  90. }
  91. ret += '\n] ';
  92. return ret;
  93. }
  94. // Função chamada pelo iTarefa para receber a nota do aluno na atividade
  95. // O retorno é um valor entre 0.0 e 1.0
  96. function getEvaluation () {
  97. if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
  98. // A chamada do método abaixo é obrigatória!
  99. // Observe que a chamada parte do iLM para o iTarefa
  100. //parent.getEvaluationCallback(window.studentGrade);
  101. runCodeAssessment();
  102. }
  103. }
  104. //var testCases = null;
  105. var settingsDataTypes = null;
  106. var settingsCommands = null;
  107. var settingsFunctions = null;
  108. var algorithm_in_ilm = null;
  109. var previousContent = null;
  110. // Função para que o iMA leia os dados da atividade fornecidos pelo iTarefa
  111. function getiLMContent () {
  112. // O parâmetro "iLM_PARAM_Assignment" fornece o URL do endereço que deve ser
  113. // requisitado via AJAX para a captura dos dados da atividade
  114. $.get(iLMparameters.iLM_PARAM_Assignment, function (data) {
  115. //professor invocou a avaliação automática dos exercícios do bloco
  116. if (iLMparameters.iLM_PARAM_TeacherAutoEval != null) {
  117. teacherAutoEval(data);
  118. //não deve exibir nenhuma interface...
  119. return;
  120. } else if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
  121. // Aluno está trabalhando em alguma atividade:
  122. previousContent = data;
  123. prepareActivityToStudent(data);
  124. } else { // Professor está editando uma atividade:
  125. previousContent = data;
  126. prepareActivityToEdit(data);
  127. }
  128. window.block_render = false;
  129. renderAlgorithm();
  130. });
  131. }
  132. function prepareActivityToEdit (ilm_cont) {
  133. //var content = JSON.parse(ilm_cont.split('\n::algorithm::')[0]);
  134. // Ver arquivo js/util/iassignHelpers.js
  135. var content = ivprogCore.prepareActivityToStudentHelper(ilm_cont);
  136. var testCases = ivprogCore.getTestCases();
  137. settingsDataTypes = content.settingsDataTypes;
  138. settingsCommands = content.settingsCommands;
  139. settingsFunctions = content.settingsFunctions;
  140. for (var i = 0; i < testCases.length; i++) {
  141. addTestCase(testCases[i]);
  142. }
  143. if (content.algorithmInIlm != null) {
  144. algorithm_in_ilm = content.algorithmInIlm;
  145. $("input[name='include_algo']").prop('checked', true);
  146. includePreviousAlgorithm();
  147. renderAlgorithm();
  148. }
  149. }
  150. function parsePreviousAlgorithm () {
  151. window.program_obj.functions = JSON.parse(algorithm_in_ilm).functions;
  152. window.program_obj.globals = JSON.parse(algorithm_in_ilm).globals;
  153. }
  154. function includePreviousAlgorithm () {
  155. parsePreviousAlgorithm();
  156. window.watchW.watch(window.program_obj.globals, function(){
  157. if (window.insertContext) {
  158. setTimeout(function(){ renderAlgorithm(); }, 300);
  159. window.insertContext = false;
  160. } else {
  161. renderAlgorithm();
  162. }
  163. }, 1);
  164. for (var i = 0; i < window.program_obj.functions.length; i ++) {
  165. window.watchW.watch(window.program_obj.functions[i].parameters_list, function(){
  166. if (window.insertContext) {
  167. setTimeout(function(){ renderAlgorithm(); }, 300);
  168. window.insertContext = false;
  169. } else {
  170. renderAlgorithm();
  171. }
  172. }, 1);
  173. window.watchW.watch(window.program_obj.functions[i].variables_list, function(){
  174. if (window.insertContext) {
  175. setTimeout(function(){ renderAlgorithm(); }, 300);
  176. window.insertContext = false;
  177. } else {
  178. renderAlgorithm();
  179. }
  180. }, 1);
  181. if (window.program_obj.functions[i].is_main) {
  182. window.program_obj.functions[i].name = LocalizedStrings.getUI("start");
  183. }
  184. }
  185. window.watchW.watch(window.program_obj.functions, function(){
  186. if (window.insertContext) {
  187. setTimeout(function(){ renderAlgorithm(); }, 300);
  188. window.insertContext = false;
  189. } else {
  190. renderAlgorithm();
  191. }
  192. }, 1);
  193. }
  194. function prepareActivityToStudent (ilm_cont) {
  195. // Ver arquivo js/util/iassignHelpers.js
  196. var content = ivprogCore.prepareActivityToStudentHelper(ilm_cont);
  197. // Casos de testes agora são delegados ao tratamento apropriado pela função acima
  198. // var testCases = content.testcases;
  199. settingsDataTypes = content.settingsDataTypes;
  200. settingsCommands = content.settingsCommands;
  201. settingsFunctions = content.settingsFunctions;
  202. if (content.algorithmInIlm != null) {
  203. algorithm_in_ilm = content.algorithmInIlm;
  204. includePreviousAlgorithm();
  205. }
  206. $('.assessment_button').removeClass('disabled');
  207. renderAlgorithm();
  208. }
  209. // Função para organizar se para criação, visualização ou resolução de atividade
  210. function prepareEnvironment () {
  211. $('.div_to_body').click(function(e) {
  212. // trackingMatrix.push(adCoords(e, 1));
  213. ivprogCore.registerClick(e.pageX, e.pageY, e.target.classList['value']);
  214. });
  215. // Se iLM_PARAM_SendAnswer for false, então trata-se de resolução de atividade,
  216. // portanto, a "DIV" de resolução é liberada
  217. if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
  218. //$('.resolucao').css("display","block");
  219. getiLMContent();
  220. // $('.div_to_body').mousemove(function(e) {
  221. // trackingMatrix.push(adCoords(e, 0));
  222. // });
  223. // $('.div_to_body').click(function(e) {
  224. // // trackingMatrix.push(adCoords(e, 1));
  225. // ivprogCore.registerClick(e.pageX, e.pageY, e.target.classList['value']);
  226. // });
  227. } else if (iLMparameters.iLM_PARAM_Assignment) {
  228. // Caso não esteja em modo de resolução de atividade, a visualização no momento
  229. // é para a elaboração de atividade:
  230. //$('.elaboracao').css("display","block");
  231. // Se possuir o parâmetro iLMparameters.iLM_PARAM_Assignment, o professor
  232. // está editando uma atividade:
  233. getiLMContent();
  234. } else {
  235. renderAlgorithm();
  236. }
  237. if ((iLMparameters.iLM_PARAM_AssignmentURL == "true") && (iLMparameters.iLM_PARAM_SendAnswer == "true")) {
  238. prepareActivityCreation();
  239. }
  240. }
  241. function iassingIntegration () {
  242. // Disable by default...
  243. $('.assessment_button').addClass('disabled');
  244. prepareEnvironment();
  245. if (inIframe()) {
  246. orderIcons();
  247. orderWidth();
  248. }
  249. }
  250. // Função para preparar a interface para o professor criar atividade:
  251. function prepareActivityCreation () {
  252. $('.add_accordion').addClass('accordion');
  253. $('.default_visual_title').toggle();
  254. $('.default_visual_title').append('<span>'+LocalizedStrings.getUI('text_teacher_algorithm')+'</span>');
  255. $('.height_100').removeClass('height_100');
  256. $('.main_title').remove();
  257. $('.ui.accordion').addClass('styled');
  258. $('<div class="content_margin"></div>').insertBefore($('.add_accordion').find('.content').find('.div_to_body'));
  259. $('<div class="ui checkbox"><input type="checkbox" name="include_algo" class="include_algo" tabindex="0" class="hidden"><label>'+LocalizedStrings.getUI('text_teacher_algorithm_include')+'</label></div>').insertAfter('.content_margin');
  260. var cases_test_div = $('<div class="ui accordion styled"><div class="active title"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('text_teacher_test_case')+'</div><div class="active content"></div></div>');
  261. cases_test_div.insertBefore('.accordion');
  262. var config_div = $('<div class="ui accordion styled"><div class="title"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('text_teacher_config')+'</div><div class="content"></div></div>');
  263. config_div.insertAfter(cases_test_div);
  264. $('.ui.accordion').accordion();
  265. $('.ui.checkbox').checkbox();
  266. prepareTableSettings(config_div.find('.content'));
  267. prepareTableTestCases(cases_test_div.find('.content'));
  268. if (inIframe()) {
  269. $('.ui.styled.accordion').css('width', '96%');
  270. }
  271. }
  272. function prepareTableTestCases (div_el) {
  273. var table_el = '<form name="test_cases"><table class="ui blue table"><thead><tr><th width="30px">#</th><th>'+LocalizedStrings.getUI('text_teacher_test_case_input')+'</th><th>'+LocalizedStrings.getUI('text_teacher_test_case_output')+'</th><th width="80px">'+LocalizedStrings.getUI('text_teacher_test_case_actions')+'</th></tr></thead>'
  274. + '<tbody class="content_cases"></tbody></table></form>';
  275. div_el.append(table_el);
  276. div_el.append('<button class="ui teal labeled icon button button_add_case"><i class="plus icon"></i>'+LocalizedStrings.getUI('text_teacher_test_case_add')+'</button>');
  277. $('.button_add_case').on('click', function(e) {
  278. addTestCase();
  279. });
  280. }
  281. var hist = false;
  282. function addTestCase (test_case = null) {
  283. var new_row = null;
  284. if (test_case) {
  285. var text_row = '';
  286. text_row += '<tr><td class="counter"></td><td class="expandingArea"><textarea rows="'+test_case.input.length+'" name="input" class="text_area_input">';
  287. for (var i = 0; i < test_case.input.length; i ++) {
  288. text_row += test_case.input[i];
  289. if ((i + 1) < test_case.input.length) {
  290. text_row += '\n';
  291. }
  292. }
  293. text_row += '</textarea></td><td class="expandingArea"><textarea rows="'+test_case.output.length+'" name="output" class="text_area_output">';
  294. for (var i = 0; i < test_case.output.length; i ++) {
  295. text_row += test_case.output[i];
  296. if ((i + 1) < test_case.output.length) {
  297. text_row += '\n';
  298. }
  299. }
  300. text_row += '</textarea></td><td class="btn_actions"><div class="ui button_remove_case"><i class="red icon times large"></i></div></td></tr>';
  301. new_row = $(text_row);
  302. } else {
  303. new_row = $('<tr><td class="counter"></td><td class="expandingArea"><textarea rows="1" name="input" class="text_area_input"></textarea></td><td class="expandingArea"><textarea rows="1" name="output" class="text_area_output"></textarea></td><td class="btn_actions"><div class="ui button_remove_case"><i class="red icon times large"></i></div></td></tr>');
  304. }
  305. $('.content_cases').append(new_row);
  306. new_row.find('.button_remove_case').click(function(e) {
  307. new_row.remove();
  308. updateTestCaseCounter();
  309. });
  310. new_row.find('textarea').on('input', function(e) {
  311. var lines = $(this).val().split('\n').length;
  312. $(this).attr('rows', lines);
  313. });
  314. updateTestCaseCounter();
  315. $('.text_area_output').keydown(function(e) {
  316. var code = e.keyCode || e.which;
  317. if (code == 9 && $(this).closest("tr").is(":last-child")) {
  318. hist = true;
  319. addTestCase();
  320. }
  321. });
  322. if (test_case == null) {
  323. if (!hist) {
  324. $( ".content_cases tr:last" ).find('.text_area_input').focus();
  325. } else {
  326. hist = false;
  327. }
  328. }
  329. }
  330. function updateTestCaseCounter () {
  331. var i = 1;
  332. $( ".content_cases" ).find('tr').each(function() {
  333. $( this ).find('.counter').text(i);
  334. ++i;
  335. });
  336. }
  337. function prepareTableSettings (div_el) {
  338. div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_data_types')+'</h4>');
  339. div_el.append('<form name="settings_data_types"><div class="ui stackable five column grid">'
  340. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="integer_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('integer')+'</label></div></div>'
  341. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="real_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('real')+'</label></div></div>'
  342. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="text_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text')+'</label></div></div>'
  343. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="boolean_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('boolean')+'</label></div></div>'
  344. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="void_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('void')+'</label></div></div>'
  345. +'</div></form>');
  346. div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_commands')+'</h4>');
  347. div_el.append('<form name="settings_commands"><div class="ui stackable three column grid">'
  348. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_read" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_read_var')+'</label></div></div>'
  349. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_write" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_write_var')+'</label></div></div>'
  350. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_comment" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_comment')+'</label></div></div>'
  351. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_attribution" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_attribution')+'</label></div></div>'
  352. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_functioncall" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_functioncall')+'</label></div></div>'
  353. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_iftrue" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_iftrue')+'</label></div></div>'
  354. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_repeatNtimes" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_repeatNtimes')+'</label></div></div>'
  355. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_while" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_whiletrue')+'</label></div></div>'
  356. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_dowhile" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_dowhiletrue')+'</label></div></div>'
  357. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_switch" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_switch')+'</label></div></div>'
  358. +'</div></form>');
  359. div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_functions')+'</h4>');
  360. div_el.append('<form name="settings_functions"><div class="ui stackable one column grid">'
  361. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="functions_creation" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_teacher_create_functions')+'</label></div></div>'
  362. +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="functions_move" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_teacher_create_movement_functions')+'</label></div></div>'
  363. +'</div></form>');
  364. $('.ui.checkbox').checkbox();
  365. }
  366. function getTrackingLogs () {
  367. return ivprogCore.getLogsAsString();
  368. // var ret = "";
  369. // for (var i = 0; i < trackingMatrix.length; ++i) {
  370. // ret += "\n" + trackingMatrix[i][0] + "," + trackingMatrix[i][1] + "," + trackingMatrix[i][2];
  371. // if (trackingMatrix[i][3] === 1) {
  372. // ret += ',' + trackingMatrix[i][3] + ',"' + trackingMatrix[i][4] + '"';
  373. // }
  374. // }
  375. // return ret;
  376. }
  377. // Tracking mouse movements
  378. // var trackingMatrix = [];
  379. /* function adCoords(e, code){
  380. var x = e.pageX;
  381. var y = e.pageY;
  382. if (code === 1) {
  383. return [new Date().getTime(), x, y, code, e.target.classList['value']];
  384. } else {
  385. return [x, y, code];
  386. }
  387. } */
  388. // $( document ).ready(function() {
  389. // if (inIframe()) {
  390. // orderIcons();
  391. // orderWidth();
  392. // }
  393. // renderAlgorithm();
  394. // });
  395. function orderWidth() {
  396. $('.ui.raised.container.segment.div_to_body').css('width', '100%');
  397. $('.ui.one.column.container.segment.ivprog_visual_panel').css('width', '100%');
  398. }
  399. function orderIcons() {
  400. $('.ui.one.column.doubling.stackable.grid.container').css('display', 'none');
  401. $('.only_in_frame').css('display', 'block');
  402. }
  403. function inIframe () {
  404. try {
  405. return window.self !== window.top;
  406. } catch (e) {
  407. return true;
  408. }
  409. }
  410. function full_screen() {
  411. // check if user allows full screen of elements. This can be enabled or disabled in browser config. By default its enabled.
  412. //its also used to check if browser supports full screen api.
  413. if("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || "mozFullScreenEnabled" in document || "msFullscreenEnabled" in document) {
  414. if(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) {
  415. var element = document.getElementById("ui_main_div");
  416. //requestFullscreen is used to display an element in full screen mode.
  417. if("requestFullscreen" in element) {
  418. element.requestFullscreen();
  419. }
  420. else if ("webkitRequestFullscreen" in element) {
  421. element.webkitRequestFullscreen();
  422. }
  423. else if ("mozRequestFullScreen" in element) {
  424. element.mozRequestFullScreen();
  425. }
  426. else if ("msRequestFullscreen" in element) {
  427. element.msRequestFullscreen();
  428. }
  429. }
  430. } else {
  431. $('.expand_button').addClass('disabled');
  432. }
  433. }
  434. function teacherAutoEval (data) {
  435. $.get(iLMparameters.iLM_PARAM_TeacherAutoEval, function (originalData) {
  436. // Ver arquivo js/util/iassignHelpers.js
  437. var content = ivprogCore.prepareActivityToStudentHelper(data);
  438. // Casos de testes agora são delegados ao tratamento apropriado pela função acima
  439. // var testCases = content.testcases;
  440. settingsDataTypes = content.settingsDataTypes;
  441. settingsCommands = content.settingsCommands;
  442. settingsFunctions = content.settingsFunctions;
  443. if (content.algorithmInIlm != null) {
  444. algorithm_in_ilm = content.algorithmInIlm;
  445. parsePreviousAlgorithm();
  446. ivprogCore.autoEval(originalData, parent.getEvaluationCallback);
  447. }
  448. });
  449. }