|
@@ -1,12 +1,16 @@
|
|
-// Função para ler parâmetros informados pelo iTarefa via URL
|
|
|
|
-// Apesar de não ser obrigatório, será muito útil para capturar os parâmetros
|
|
|
|
|
|
+// iVProg - www.usp.br/line/ivprog
|
|
|
|
+// LInE - Free Education, Private Data
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// Funcao para ler parametros informados pelo iTarefa via URL
|
|
|
|
+// Apesar de nao ser obrigatorio, sera muito util para capturar os parametros
|
|
function getParameterByName (name, defaultReturn = null) {
|
|
function getParameterByName (name, defaultReturn = null) {
|
|
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
|
|
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
|
|
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : defaultReturn;
|
|
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : defaultReturn;
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-// Criando um object com os parâmetros informados pelo iTarefa
|
|
|
|
-// Observe que para cada parâmetro, é realizada a chamada do método getParameterByName, implementado acima
|
|
|
|
|
|
+// Criando um object com os parametros informados pelo iTarefa
|
|
|
|
+// Observe que para cada parametro, e realizada a chamada do metodo getParameterByName, implementado acima
|
|
var iLMparameters = {
|
|
var iLMparameters = {
|
|
iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
|
|
iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
|
|
iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"),
|
|
iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"),
|
|
@@ -14,7 +18,7 @@ var iLMparameters = {
|
|
iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
|
|
iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
|
|
iLM_PARAM_TeacherAutoEval: getParameterByName("iLM_PARAM_TeacherAutoEval"),
|
|
iLM_PARAM_TeacherAutoEval: getParameterByName("iLM_PARAM_TeacherAutoEval"),
|
|
lang: getParameterByName("lang", "pt")
|
|
lang: getParameterByName("lang", "pt")
|
|
-};
|
|
|
|
|
|
+ };
|
|
|
|
|
|
// Set the lang parameter to the localStorage for easy access
|
|
// Set the lang parameter to the localStorage for easy access
|
|
// and no dependency to the global scope, avoind future 'strict mode' problems
|
|
// and no dependency to the global scope, avoind future 'strict mode' problems
|
|
@@ -23,57 +27,53 @@ var iLMparameters = {
|
|
function removeCollapseValue (command) {
|
|
function removeCollapseValue (command) {
|
|
if (command.collapsed) {
|
|
if (command.collapsed) {
|
|
delete command.collapsed;
|
|
delete command.collapsed;
|
|
- }
|
|
|
|
|
|
+ }
|
|
if (command.type == 'iftrue') {
|
|
if (command.type == 'iftrue') {
|
|
if (command.commands_block)
|
|
if (command.commands_block)
|
|
for (var i = 0; i < command.commands_block.length; i++) {
|
|
for (var i = 0; i < command.commands_block.length; i++) {
|
|
removeCollapseValue(command.commands_block[i]);
|
|
removeCollapseValue(command.commands_block[i]);
|
|
- }
|
|
|
|
|
|
+ }
|
|
if (command.commands_else)
|
|
if (command.commands_else)
|
|
for (var i = 0; i < command.commands_else.length; i++) {
|
|
for (var i = 0; i < command.commands_else.length; i++) {
|
|
removeCollapseValue(command.commands_else[i]);
|
|
removeCollapseValue(command.commands_else[i]);
|
|
- }
|
|
|
|
- } else if (command.type == 'repeatNtimes'
|
|
|
|
- || command.type == 'whiletrue'
|
|
|
|
- || command.type == 'dowhiletrue' ) {
|
|
|
|
|
|
+ }
|
|
|
|
+ } else if (command.type == 'repeatNtimes' || command.type == 'whiletrue' || command.type == 'dowhiletrue' ) {
|
|
if (command.commands_block)
|
|
if (command.commands_block)
|
|
for (var i = 0; i < command.commands_block.length; i++) {
|
|
for (var i = 0; i < command.commands_block.length; i++) {
|
|
removeCollapseValue(command.commands_block[i]);
|
|
removeCollapseValue(command.commands_block[i]);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function configAuxiliar (form_element) {
|
|
function configAuxiliar (form_element) {
|
|
var _array = form_element.serializeArray();
|
|
var _array = form_element.serializeArray();
|
|
var temp = _array.reduce(function(map, obj) {
|
|
var temp = _array.reduce(function(map, obj) {
|
|
map[obj.name] = obj.value == "on";
|
|
map[obj.name] = obj.value == "on";
|
|
return map;
|
|
return map;
|
|
- }, {});
|
|
|
|
-
|
|
|
|
|
|
+ }, {});
|
|
return temp;
|
|
return temp;
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function configAuxiliarProgrammingType (form_element) {
|
|
function configAuxiliarProgrammingType (form_element) {
|
|
var _array = form_element.serializeArray();
|
|
var _array = form_element.serializeArray();
|
|
var temp = _array.reduce(function(map, obj) {
|
|
var temp = _array.reduce(function(map, obj) {
|
|
map[obj.name] = obj.value;
|
|
map[obj.name] = obj.value;
|
|
return map;
|
|
return map;
|
|
- }, {});
|
|
|
|
|
|
+ }, {});
|
|
|
|
|
|
return temp;
|
|
return temp;
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-// Função chamada pelo iTarefa quando o professor finaliza a criação da atividade
|
|
|
|
-// ou quando o aluno finaliza a resolução do exercício
|
|
|
|
-// O retorno é um JSON com os dados do exercício ou da resolução
|
|
|
|
-// Esse retorno será armazenado no banco de dados do Moodle, pelo iTarefa
|
|
|
|
|
|
+// Funcao chamada pelo iTarefa quando o professor finaliza a criacao da atividade
|
|
|
|
+// ou quando o aluno finaliza a resolucao do exercício
|
|
|
|
+// O retorno e um JSON com os dados do exercício ou da resolucao
|
|
|
|
+// Esse retorno sera armazenado no banco de dados do Moodle, pelo iTarefa
|
|
function getAnswer () {
|
|
function getAnswer () {
|
|
-
|
|
|
|
var objAnswer = new Object();
|
|
var objAnswer = new Object();
|
|
objAnswer.version = '1.0';
|
|
objAnswer.version = '1.0';
|
|
|
|
|
|
- // Se o parâmetro "iLM_PARAM_SendAnswer" for false,
|
|
|
|
- // então trata-se de resolução de atividade
|
|
|
|
|
|
+ // Se o parametro "iLM_PARAM_SendAnswer" for false,
|
|
|
|
+ // entao trata-se de resolucao de atividade
|
|
if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
// Montar o retorno com a resposta do aluno
|
|
// Montar o retorno com a resposta do aluno
|
|
|
|
|
|
@@ -87,8 +87,8 @@ function getAnswer () {
|
|
"datatypes": Object.fromEntries(ivprogCore.Config.activity_datatypes),
|
|
"datatypes": Object.fromEntries(ivprogCore.Config.activity_datatypes),
|
|
"commands": Object.fromEntries(ivprogCore.Config.activity_commands),
|
|
"commands": Object.fromEntries(ivprogCore.Config.activity_commands),
|
|
"filter": Object.fromEntries(ivprogCore.Config.activity_filter)
|
|
"filter": Object.fromEntries(ivprogCore.Config.activity_filter)
|
|
- };
|
|
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
+ }
|
|
catch(e) {
|
|
catch(e) {
|
|
objAnswer.settings = {
|
|
objAnswer.settings = {
|
|
"programming": [],
|
|
"programming": [],
|
|
@@ -96,41 +96,33 @@ function getAnswer () {
|
|
"datatypes": [],
|
|
"datatypes": [],
|
|
"commands": [],
|
|
"commands": [],
|
|
"filter": []
|
|
"filter": []
|
|
- };
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ };
|
|
|
|
+ }
|
|
return JSON.stringify(objAnswer, null, 4);
|
|
return JSON.stringify(objAnswer, null, 4);
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
objAnswer.test_cases = prepareTestCases();
|
|
objAnswer.test_cases = prepareTestCases();
|
|
-
|
|
|
|
objAnswer.settings = {
|
|
objAnswer.settings = {
|
|
"programming": configAuxiliarProgrammingType($('form[name="settings_programming_type"]')),
|
|
"programming": configAuxiliarProgrammingType($('form[name="settings_programming_type"]')),
|
|
"functions": configAuxiliar($('form[name="settings_functions"]')),
|
|
"functions": configAuxiliar($('form[name="settings_functions"]')),
|
|
"datatypes": configAuxiliar($('form[name="settings_data_types"]')),
|
|
"datatypes": configAuxiliar($('form[name="settings_data_types"]')),
|
|
"commands": configAuxiliar($('form[name="settings_commands"]')),
|
|
"commands": configAuxiliar($('form[name="settings_commands"]')),
|
|
"filter": configAuxiliar($('form[name="settings_filter"]'))
|
|
"filter": configAuxiliar($('form[name="settings_filter"]'))
|
|
- };
|
|
|
|
|
|
+ };
|
|
|
|
|
|
if ($("input[name='include_algo']").is(':checked')) {
|
|
if ($("input[name='include_algo']").is(':checked')) {
|
|
objAnswer.algorithm = generator();
|
|
objAnswer.algorithm = generator();
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
return JSON.stringify(objAnswer, null, 4);
|
|
return JSON.stringify(objAnswer, null, 4);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function prepareTestCases () {
|
|
function prepareTestCases () {
|
|
-
|
|
|
|
var test_cases_array = $('form[name="test_cases"]').serializeArray();
|
|
var test_cases_array = $('form[name="test_cases"]').serializeArray();
|
|
-
|
|
|
|
var cases = [];
|
|
var cases = [];
|
|
|
|
|
|
for (var i = 0; i < test_cases_array.length; i = i + 2) {
|
|
for (var i = 0; i < test_cases_array.length; i = i + 2) {
|
|
-
|
|
|
|
var temp = new Object();
|
|
var temp = new Object();
|
|
-
|
|
|
|
temp.input = [];
|
|
temp.input = [];
|
|
temp.output = [];
|
|
temp.output = [];
|
|
|
|
|
|
@@ -138,36 +130,36 @@ function prepareTestCases () {
|
|
if (inps) {
|
|
if (inps) {
|
|
for (var j = 0; j < inps.length; j++) {
|
|
for (var j = 0; j < inps.length; j++) {
|
|
temp.input.push(inps[j]);
|
|
temp.input.push(inps[j]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
var outs = test_cases_array[i+1].value.match(/[^\r\n]+/g);
|
|
var outs = test_cases_array[i+1].value.match(/[^\r\n]+/g);
|
|
if (outs) {
|
|
if (outs) {
|
|
for (var j = 0; j < outs.length; j++) {
|
|
for (var j = 0; j < outs.length; j++) {
|
|
temp.output.push(outs[j]);
|
|
temp.output.push(outs[j]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
cases.push(temp);
|
|
cases.push(temp);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
return cases;
|
|
return cases;
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-// Função chamada pelo iTarefa para receber a nota do aluno na atividade
|
|
|
|
-// O retorno é um valor entre 0.0 e 1.0
|
|
|
|
|
|
+// Funcao chamada pelo iTarefa para receber a nota do aluno na atividade
|
|
|
|
+// O retorno e um valor entre 0.0 e 1.0
|
|
function getEvaluation () {
|
|
function getEvaluation () {
|
|
if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
- // A chamada do método abaixo é obrigatória!
|
|
|
|
|
|
+ // A chamada do metodo abaixo e obrigatoria!
|
|
// Observe que a chamada parte do iLM para o iTarefa
|
|
// Observe que a chamada parte do iLM para o iTarefa
|
|
//parent.getEvaluationCallback(window.studentGrade);
|
|
//parent.getEvaluationCallback(window.studentGrade);
|
|
|
|
|
|
var canRunAssessment = runCodeAssessment();
|
|
var canRunAssessment = runCodeAssessment();
|
|
- if(canRunAssessment === -1) {
|
|
|
|
|
|
+ if (canRunAssessment === -1) {
|
|
parent.getEvaluationCallback(-1);
|
|
parent.getEvaluationCallback(-1);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
//var testCases = null
|
|
//var testCases = null
|
|
var settingsDataTypes = null;
|
|
var settingsDataTypes = null;
|
|
@@ -178,39 +170,38 @@ var settingsFilter = null;
|
|
var algorithm_in_ilm = null;
|
|
var algorithm_in_ilm = null;
|
|
var previousContent = null;
|
|
var previousContent = null;
|
|
|
|
|
|
-// Função para que o iMA leia os dados da atividade fornecidos pelo iTarefa
|
|
|
|
|
|
+// Funcao para que o iMA leia os dados da atividade fornecidos pelo iTarefa
|
|
function getiLMContent () {
|
|
function getiLMContent () {
|
|
-
|
|
|
|
- // O parâmetro "iLM_PARAM_Assignment" fornece o URL do endereço que deve ser
|
|
|
|
|
|
+ // O parametro "iLM_PARAM_Assignment" fornece o URL do endereco que deve ser
|
|
// requisitado via AJAX para a captura dos dados da atividade
|
|
// requisitado via AJAX para a captura dos dados da atividade
|
|
$.get(iLMparameters.iLM_PARAM_Assignment, function (data) {
|
|
$.get(iLMparameters.iLM_PARAM_Assignment, function (data) {
|
|
- //professor invocou a avaliação automática dos exercícios do bloco
|
|
|
|
|
|
+ //professor invocou a avaliacao automatica dos exercícios do bloco
|
|
if (iLMparameters.iLM_PARAM_TeacherAutoEval != null) {
|
|
if (iLMparameters.iLM_PARAM_TeacherAutoEval != null) {
|
|
- teacherAutoEval(data);
|
|
|
|
- //não deve exibir nenhuma interface...
|
|
|
|
- return;
|
|
|
|
|
|
+ teacherAutoEval(data);
|
|
|
|
+ //nao deve exibir nenhuma interface...
|
|
|
|
+ return;
|
|
} else if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
} else if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
- // Aluno está trabalhando em alguma atividade:
|
|
|
|
- previousContent = data;
|
|
|
|
- prepareActivityToStudent(data);
|
|
|
|
- } else { // Professor está editando uma atividade:
|
|
|
|
- previousContent = data;
|
|
|
|
- prepareActivityToEdit(data);
|
|
|
|
- }
|
|
|
|
|
|
+ // Aluno esta trabalhando em alguma atividade:
|
|
|
|
+ previousContent = data;
|
|
|
|
+ prepareActivityToStudent(data);
|
|
|
|
+ } else { // Professor esta editando uma atividade:
|
|
|
|
+ previousContent = data;
|
|
|
|
+ prepareActivityToEdit(data);
|
|
|
|
+ }
|
|
|
|
|
|
window.block_render = false;
|
|
window.block_render = false;
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- });
|
|
|
|
-}
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
function prepareActivityToEdit (ilm_cont) {
|
|
function prepareActivityToEdit (ilm_cont) {
|
|
//var content = JSON.parse(ilm_cont.split('\n::algorithm::')[0]);
|
|
//var content = JSON.parse(ilm_cont.split('\n::algorithm::')[0]);
|
|
// Ver arquivo js/util/iassignHelpers.js
|
|
// Ver arquivo js/util/iassignHelpers.js
|
|
var content = ivprogCore.prepareActivityToStudentHelper(ilm_cont).getOrElse(null);
|
|
var content = ivprogCore.prepareActivityToStudentHelper(ilm_cont).getOrElse(null);
|
|
- if(!content) {
|
|
|
|
|
|
+ if (!content) {
|
|
showInvalidData();
|
|
showInvalidData();
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }
|
|
var testCases = ivprogCore.getTestCases();
|
|
var testCases = ivprogCore.getTestCases();
|
|
|
|
|
|
settingsProgrammingTypes = content.settingsProgrammingType;
|
|
settingsProgrammingTypes = content.settingsProgrammingType;
|
|
@@ -221,30 +212,30 @@ function prepareActivityToEdit (ilm_cont) {
|
|
|
|
|
|
for (var i = 0; i < testCases.length; i++) {
|
|
for (var i = 0; i < testCases.length; i++) {
|
|
addTestCase(testCases[i]);
|
|
addTestCase(testCases[i]);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
if (content.algorithmInIlm != null) {
|
|
if (content.algorithmInIlm != null) {
|
|
algorithm_in_ilm = content.algorithmInIlm;
|
|
algorithm_in_ilm = content.algorithmInIlm;
|
|
$("input[name='include_algo']").prop('checked', true);
|
|
$("input[name='include_algo']").prop('checked', true);
|
|
includePreviousAlgorithm();
|
|
includePreviousAlgorithm();
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
ivprogTextualOrVisual();
|
|
ivprogTextualOrVisual();
|
|
if (settingsFilter && settingsFilter[0]) {
|
|
if (settingsFilter && settingsFilter[0]) {
|
|
blockAllEditingOptions();
|
|
blockAllEditingOptions();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function parsePreviousAlgorithm () {
|
|
function parsePreviousAlgorithm () {
|
|
window.program_obj.functions = JSON.parse(algorithm_in_ilm).functions;
|
|
window.program_obj.functions = JSON.parse(algorithm_in_ilm).functions;
|
|
window.program_obj.globals = JSON.parse(algorithm_in_ilm).globals;
|
|
window.program_obj.globals = JSON.parse(algorithm_in_ilm).globals;
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function includePreviousAlgorithm () {
|
|
function includePreviousAlgorithm () {
|
|
if (settingsProgrammingTypes == "textual") {
|
|
if (settingsProgrammingTypes == "textual") {
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
parsePreviousAlgorithm();
|
|
parsePreviousAlgorithm();
|
|
|
|
|
|
@@ -254,8 +245,8 @@ function includePreviousAlgorithm () {
|
|
window.insertContext = false;
|
|
window.insertContext = false;
|
|
} else {
|
|
} else {
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- }
|
|
|
|
- }, 1);
|
|
|
|
|
|
+ }
|
|
|
|
+ }, 1);
|
|
|
|
|
|
for (var i = 0; i < window.program_obj.functions.length; i ++) {
|
|
for (var i = 0; i < window.program_obj.functions.length; i ++) {
|
|
window.watchW.watch(window.program_obj.functions[i].parameters_list, function(){
|
|
window.watchW.watch(window.program_obj.functions[i].parameters_list, function(){
|
|
@@ -264,8 +255,8 @@ function includePreviousAlgorithm () {
|
|
window.insertContext = false;
|
|
window.insertContext = false;
|
|
} else {
|
|
} else {
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- }
|
|
|
|
- }, 1);
|
|
|
|
|
|
+ }
|
|
|
|
+ }, 1);
|
|
|
|
|
|
window.watchW.watch(window.program_obj.functions[i].variables_list, function(){
|
|
window.watchW.watch(window.program_obj.functions[i].variables_list, function(){
|
|
if (window.insertContext) {
|
|
if (window.insertContext) {
|
|
@@ -273,13 +264,13 @@ function includePreviousAlgorithm () {
|
|
window.insertContext = false;
|
|
window.insertContext = false;
|
|
} else {
|
|
} else {
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- }
|
|
|
|
- }, 1);
|
|
|
|
|
|
+ }
|
|
|
|
+ }, 1);
|
|
|
|
|
|
if (window.program_obj.functions[i].is_main) {
|
|
if (window.program_obj.functions[i].is_main) {
|
|
- window.program_obj.functions[i].name = LocalizedStrings.getUI("start");
|
|
|
|
|
|
+ window.program_obj.functions[i].name = LocalizedStrings.getUI("start");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
window.watchW.watch(window.program_obj.functions, function(){
|
|
window.watchW.watch(window.program_obj.functions, function(){
|
|
if (window.insertContext) {
|
|
if (window.insertContext) {
|
|
@@ -287,107 +278,103 @@ function includePreviousAlgorithm () {
|
|
window.insertContext = false;
|
|
window.insertContext = false;
|
|
} else {
|
|
} else {
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- }
|
|
|
|
- }, 1);
|
|
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
+ }, 1);
|
|
|
|
+ }
|
|
|
|
|
|
function prepareActivityToStudent (ilm_cont, ignore_logs = false) {
|
|
function prepareActivityToStudent (ilm_cont, ignore_logs = false) {
|
|
|
|
+ // File version (1.0):
|
|
|
|
+ try {
|
|
|
|
+ var jsonObj = JSON.parse(ilm_cont);
|
|
|
|
+ ivprogCore.prepareActivityToStudentHelperJSON(jsonObj);
|
|
|
|
|
|
- // File version (1.0):
|
|
|
|
- try {
|
|
|
|
- var jsonObj = JSON.parse(ilm_cont);
|
|
|
|
- ivprogCore.prepareActivityToStudentHelperJSON(jsonObj);
|
|
|
|
-
|
|
|
|
- if (ivprogCore.getTestCases())
|
|
|
|
- $('.assessment_button').removeClass('disabled');
|
|
|
|
|
|
+ if (ivprogCore.getTestCases())
|
|
|
|
+ $('.assessment_button').removeClass('disabled');
|
|
|
|
|
|
- renderAlgorithm();
|
|
|
|
|
|
+ renderAlgorithm();
|
|
|
|
|
|
- $('.ivprog_visual_panel').removeClass("loading");
|
|
|
|
- return;
|
|
|
|
|
|
+ $('.ivprog_visual_panel').removeClass("loading");
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- catch (e) {
|
|
|
|
- console.log('Previous file format!');
|
|
|
|
- console.log(e);
|
|
|
|
|
|
+ catch (e) {
|
|
|
|
+ console.log('Previous file format!');
|
|
|
|
+ console.log(e);
|
|
|
|
+ console.log(ilm_cont);
|
|
}
|
|
}
|
|
|
|
|
|
- // Previous file format:
|
|
|
|
- // Ver arquivo js/util/iassignHelpers.js
|
|
|
|
- var content = ivprogCore.prepareActivityToStudentHelper(ilm_cont, ignore_logs).getOrElse(null);
|
|
|
|
- if(!content) {
|
|
|
|
- $('.ivprog_visual_panel').removeClass("loading");
|
|
|
|
- showInvalidData();
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Casos de testes agora são delegados ao tratamento apropriado pela função acima
|
|
|
|
- // var testCases = content.testcases;
|
|
|
|
- settingsProgrammingTypes = content.settingsProgrammingType;
|
|
|
|
- settingsDataTypes = content.settingsDataTypes;
|
|
|
|
- settingsCommands = content.settingsCommands;
|
|
|
|
- settingsFunctions = content.settingsFunctions;
|
|
|
|
- settingsFilter = content.settingsFilter;
|
|
|
|
-
|
|
|
|
- if (content.algorithmInIlm != null) {
|
|
|
|
- algorithm_in_ilm = content.algorithmInIlm;
|
|
|
|
- includePreviousAlgorithm();
|
|
|
|
- }
|
|
|
|
- $('.assessment_button').removeClass('disabled');
|
|
|
|
|
|
+ // Previous file format:
|
|
|
|
+ // Ver arquivo js/util/iassignHelpers.js
|
|
|
|
+ var content = ivprogCore.prepareActivityToStudentHelper(ilm_cont, ignore_logs).getOrElse(null);
|
|
|
|
+ if (!content) {
|
|
$('.ivprog_visual_panel').removeClass("loading");
|
|
$('.ivprog_visual_panel').removeClass("loading");
|
|
- renderAlgorithm();
|
|
|
|
|
|
+ showInvalidData();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Casos de testes agora sao delegados ao tratamento apropriado pela funcao acima
|
|
|
|
+ // var testCases = content.testcases;
|
|
|
|
+ settingsProgrammingTypes = content.settingsProgrammingType;
|
|
|
|
+ settingsDataTypes = content.settingsDataTypes;
|
|
|
|
+ settingsCommands = content.settingsCommands;
|
|
|
|
+ settingsFunctions = content.settingsFunctions;
|
|
|
|
+ settingsFilter = content.settingsFilter;
|
|
|
|
|
|
- ivprogTextualOrVisual();
|
|
|
|
- if (settingsFilter && settingsFilter[0]) {
|
|
|
|
- blockAllEditingOptions();
|
|
|
|
|
|
+ if (content.algorithmInIlm != null) {
|
|
|
|
+ algorithm_in_ilm = content.algorithmInIlm;
|
|
|
|
+ includePreviousAlgorithm();
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+ $('.assessment_button').removeClass('disabled');
|
|
|
|
+ $('.ivprog_visual_panel').removeClass("loading");
|
|
|
|
+ renderAlgorithm();
|
|
|
|
+
|
|
|
|
+ ivprogTextualOrVisual();
|
|
|
|
+ if (settingsFilter && settingsFilter[0]) {
|
|
|
|
+ blockAllEditingOptions();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
-// Função para organizar se para criação, visualização ou resolução de atividade
|
|
|
|
-function prepareEnvironment () {
|
|
|
|
|
|
|
|
|
|
+// Funcao para organizar se para criacao, visualizacao ou resolucao de atividade
|
|
|
|
+function prepareEnvironment () {
|
|
$('.div_to_body').click(function(e) {
|
|
$('.div_to_body').click(function(e) {
|
|
// trackingMatrix.push(adCoords(e, 1));
|
|
// trackingMatrix.push(adCoords(e, 1));
|
|
ivprogCore.registerClick(e.pageX, e.pageY, e.target.classList['value']);
|
|
ivprogCore.registerClick(e.pageX, e.pageY, e.target.classList['value']);
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
|
|
- // Se iLM_PARAM_SendAnswer for false, então trata-se de resolução de atividade,
|
|
|
|
- // portanto, a "DIV" de resolução é liberada
|
|
|
|
|
|
+ // Se iLM_PARAM_SendAnswer for false, entao trata-se de resolucao de atividade,
|
|
|
|
+ // portanto, a "DIV" de resolucao e liberada
|
|
if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
|
|
//$('.resolucao').css("display","block");
|
|
//$('.resolucao').css("display","block");
|
|
$('.ivprog_visual_panel').addClass("loading");
|
|
$('.ivprog_visual_panel').addClass("loading");
|
|
|
|
|
|
getiLMContent();
|
|
getiLMContent();
|
|
|
|
|
|
- // $('.div_to_body').mousemove(function(e) {
|
|
|
|
- // trackingMatrix.push(adCoords(e, 0));
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
|
|
+ // $('.div_to_body').mousemove(function(e) { trackingMatrix.push(adCoords(e, 0)); });
|
|
// $('.div_to_body').click(function(e) {
|
|
// $('.div_to_body').click(function(e) {
|
|
// // trackingMatrix.push(adCoords(e, 1));
|
|
// // trackingMatrix.push(adCoords(e, 1));
|
|
// ivprogCore.registerClick(e.pageX, e.pageY, e.target.classList['value']);
|
|
// ivprogCore.registerClick(e.pageX, e.pageY, e.target.classList['value']);
|
|
// });
|
|
// });
|
|
} else if (iLMparameters.iLM_PARAM_Assignment) {
|
|
} else if (iLMparameters.iLM_PARAM_Assignment) {
|
|
- // Caso não esteja em modo de resolução de atividade, a visualização no momento
|
|
|
|
- // é para a elaboração de atividade:
|
|
|
|
|
|
+ // Caso nao esteja em modo de resolucao de atividade, a visualizacao no momento
|
|
|
|
+ // e para a elaboracao de atividade:
|
|
//$('.elaboracao').css("display","block");
|
|
//$('.elaboracao').css("display","block");
|
|
|
|
|
|
- // Se possuir o parâmetro iLMparameters.iLM_PARAM_Assignment, o professor
|
|
|
|
- // está editando uma atividade:
|
|
|
|
|
|
+ // Se possuir o parametro iLMparameters.iLM_PARAM_Assignment, o professor
|
|
|
|
+ // esta editando uma atividade:
|
|
getiLMContent();
|
|
getiLMContent();
|
|
} else {
|
|
} else {
|
|
renderAlgorithm();
|
|
renderAlgorithm();
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
if ((iLMparameters.iLM_PARAM_AssignmentURL == "true") && (iLMparameters.iLM_PARAM_SendAnswer == "true")) {
|
|
if ((iLMparameters.iLM_PARAM_AssignmentURL == "true") && (iLMparameters.iLM_PARAM_SendAnswer == "true")) {
|
|
prepareActivityCreation();
|
|
prepareActivityCreation();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function blockAllEditingOptions () {
|
|
function blockAllEditingOptions () {
|
|
-
|
|
|
|
if ((iLMparameters.iLM_PARAM_AssignmentURL == "true") && (iLMparameters.iLM_PARAM_SendAnswer == "true")) {
|
|
if ((iLMparameters.iLM_PARAM_AssignmentURL == "true") && (iLMparameters.iLM_PARAM_SendAnswer == "true")) {
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
$('.add_global_button').addClass('disabled');
|
|
$('.add_global_button').addClass('disabled');
|
|
$('.move_function').addClass('disabled');
|
|
$('.move_function').addClass('disabled');
|
|
@@ -441,10 +428,9 @@ function blockAllEditingOptions () {
|
|
|
|
|
|
|
|
|
|
ivprogCore.CodeEditor.disable(true);
|
|
ivprogCore.CodeEditor.disable(true);
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function ivprogTextualOrVisual () {
|
|
function ivprogTextualOrVisual () {
|
|
-
|
|
|
|
if (settingsProgrammingTypes) {
|
|
if (settingsProgrammingTypes) {
|
|
if (settingsProgrammingTypes == "textual") {
|
|
if (settingsProgrammingTypes == "textual") {
|
|
$('.ivprog_visual_panel').css('display', 'none');
|
|
$('.ivprog_visual_panel').css('display', 'none');
|
|
@@ -456,23 +442,21 @@ function ivprogTextualOrVisual () {
|
|
$('.visual_coding_button').addClass('disabled');
|
|
$('.visual_coding_button').addClass('disabled');
|
|
|
|
|
|
let textual_code = algorithm_in_ilm;
|
|
let textual_code = algorithm_in_ilm;
|
|
- if(!textual_code) {
|
|
|
|
|
|
+ if (!textual_code) {
|
|
textual_code = ivprogCore.LocalizedStrings.getUI("initial_program_code");
|
|
textual_code = ivprogCore.LocalizedStrings.getUI("initial_program_code");
|
|
textual_code = textual_code.replace(/\\n/g,"\n");
|
|
textual_code = textual_code.replace(/\\n/g,"\n");
|
|
textual_code = textual_code.replace(/\\t/g,"\t");
|
|
textual_code = textual_code.replace(/\\t/g,"\t");
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
ivprogCore.CodeEditor.setCode(textual_code);
|
|
ivprogCore.CodeEditor.setCode(textual_code);
|
|
ivprogCore.CodeEditor.disable(false);
|
|
ivprogCore.CodeEditor.disable(false);
|
|
- }
|
|
|
|
|
|
+ }
|
|
if (settingsProgrammingTypes == "visual") {
|
|
if (settingsProgrammingTypes == "visual") {
|
|
-
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function iassingIntegration () {
|
|
function iassingIntegration () {
|
|
-
|
|
|
|
// Disable by default...
|
|
// Disable by default...
|
|
$('.assessment_button').addClass('disabled');
|
|
$('.assessment_button').addClass('disabled');
|
|
|
|
|
|
@@ -480,29 +464,25 @@ function iassingIntegration () {
|
|
if (inIframe()) {
|
|
if (inIframe()) {
|
|
orderIcons();
|
|
orderIcons();
|
|
orderWidth();
|
|
orderWidth();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
-// Função para preparar a interface para o professor criar atividade:
|
|
|
|
|
|
+// Funcao para preparar a interface para o professor criar atividade:
|
|
function prepareActivityCreation () {
|
|
function prepareActivityCreation () {
|
|
-
|
|
|
|
var menuTab = $('<div class="ui top attached tabular menu">'
|
|
var menuTab = $('<div class="ui top attached tabular menu">'
|
|
- + '<a class="item active" data-tab="testcases">' + LocalizedStrings.getUI('text_teacher_test_case') + '</a>'
|
|
|
|
- + '<a class="item" data-tab="algorithm">' + LocalizedStrings.getUI('text_teacher_algorithm') + '</a>'
|
|
|
|
- + '<a class="item" data-tab="settings">' + LocalizedStrings.getUI('text_teacher_config') + '</a>'
|
|
|
|
- + '</div>'
|
|
|
|
- + '<div class="ui bottom attached tab segment active tab_test_cases" data-tab="testcases"></div>'
|
|
|
|
- + '<div class="ui bottom attached tab segment tab_algorithm" data-tab="algorithm"></div>'
|
|
|
|
- + '<div class="ui bottom attached tab segment tab_settings" data-tab="settings"></div>');
|
|
|
|
|
|
+ + '<a class="item active" data-tab="testcases">' + LocalizedStrings.getUI('text_teacher_test_case') + '</a>'
|
|
|
|
+ + '<a class="item" data-tab="algorithm">' + LocalizedStrings.getUI('text_teacher_algorithm') + '</a>'
|
|
|
|
+ + '<a class="item" data-tab="settings">' + LocalizedStrings.getUI('text_teacher_config') + '</a>'
|
|
|
|
+ + '</div>'
|
|
|
|
+ + '<div class="ui bottom attached tab segment active tab_test_cases" data-tab="testcases"></div>'
|
|
|
|
+ + '<div class="ui bottom attached tab segment tab_algorithm" data-tab="algorithm"></div>'
|
|
|
|
+ + '<div class="ui bottom attached tab segment tab_settings" data-tab="settings"></div>');
|
|
|
|
|
|
menuTab.insertBefore('.add_accordion');
|
|
menuTab.insertBefore('.add_accordion');
|
|
$('.tabular.menu .item').tab();
|
|
$('.tabular.menu .item').tab();
|
|
-
|
|
|
|
$('.main_title').remove();
|
|
$('.main_title').remove();
|
|
$('.ui.accordion').addClass('styled');
|
|
$('.ui.accordion').addClass('styled');
|
|
-
|
|
|
|
$('<div class="content_margin"></div>').insertBefore($('.add_accordion').find('.content').find('.div_to_body'));
|
|
$('<div class="content_margin"></div>').insertBefore($('.add_accordion').find('.content').find('.div_to_body'));
|
|
-
|
|
|
|
$('<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');
|
|
$('<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');
|
|
|
|
|
|
var cases_test_div = $('<div></div>');
|
|
var cases_test_div = $('<div></div>');
|
|
@@ -512,22 +492,18 @@ function prepareActivityCreation () {
|
|
var config_div = $('<div></div>');
|
|
var config_div = $('<div></div>');
|
|
|
|
|
|
$('.tab_settings').append(config_div);
|
|
$('.tab_settings').append(config_div);
|
|
-
|
|
|
|
$('.ui.checkbox').checkbox();
|
|
$('.ui.checkbox').checkbox();
|
|
-
|
|
|
|
$('.tab_algorithm').append($('.add_accordion'));
|
|
$('.tab_algorithm').append($('.add_accordion'));
|
|
|
|
|
|
prepareTableSettings(config_div);
|
|
prepareTableSettings(config_div);
|
|
-
|
|
|
|
prepareTableTestCases(cases_test_div);
|
|
prepareTableTestCases(cases_test_div);
|
|
|
|
|
|
if (inIframe()) {
|
|
if (inIframe()) {
|
|
- $('.ui.styled.accordion').css('width', '96%');
|
|
|
|
|
|
+ $('.ui.styled.accordion').css('width', '96%');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function prepareTableTestCases (div_el) {
|
|
function prepareTableTestCases (div_el) {
|
|
-
|
|
|
|
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>'
|
|
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>'
|
|
+ '<tbody class="content_cases"></tbody></table></form>';
|
|
+ '<tbody class="content_cases"></tbody></table></form>';
|
|
|
|
|
|
@@ -540,39 +516,37 @@ function prepareTableTestCases (div_el) {
|
|
+ '</td></tr></table>';
|
|
+ '</td></tr></table>';
|
|
|
|
|
|
div_el.append(table_buttons);
|
|
div_el.append(table_buttons);
|
|
-
|
|
|
|
- div_el.append($('<div class="ui basic modal"><div class="content"><p>Olá</p></div><div class="actions"><div class="ui green ok inverted button">Fechar</div></div></div>'));
|
|
|
|
|
|
+ div_el.append($('<div class="ui basic modal"><div class="content"><p>Ola</p></div><div class="actions"><div class="ui green ok inverted button">Fechar</div></div></div>'));
|
|
|
|
|
|
$('.button_add_case').on('click', function(e) {
|
|
$('.button_add_case').on('click', function(e) {
|
|
addTestCase();
|
|
addTestCase();
|
|
- });
|
|
|
|
|
|
+ });
|
|
$('.button_generate_outputs').on('click', function(e) {
|
|
$('.button_generate_outputs').on('click', function(e) {
|
|
generateOutputs();
|
|
generateOutputs();
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
|
|
if (!iLMparameters.iLM_PARAM_Assignment)
|
|
if (!iLMparameters.iLM_PARAM_Assignment)
|
|
addTestCase();
|
|
addTestCase();
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function showAlert (msg) {
|
|
function showAlert (msg) {
|
|
$('.ui.basic.modal .content').html('<h3>'+msg+'</h3>');
|
|
$('.ui.basic.modal .content').html('<h3>'+msg+'</h3>');
|
|
$('.ui.basic.modal').modal('show');
|
|
$('.ui.basic.modal').modal('show');
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function generateOutputs () {
|
|
function generateOutputs () {
|
|
if (window.program_obj.functions.length == 1 && window.program_obj.functions[0].commands.length == 0) {
|
|
if (window.program_obj.functions.length == 1 && window.program_obj.functions[0].commands.length == 0) {
|
|
showAlert(LocalizedStrings.getUI('text_teacher_generate_outputs_algorithm'));
|
|
showAlert(LocalizedStrings.getUI('text_teacher_generate_outputs_algorithm'));
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
- // código:
|
|
|
|
|
|
+ }
|
|
|
|
+ // codigo:
|
|
var code_teacher = window.generator();
|
|
var code_teacher = window.generator();
|
|
- // array com as entradas já inseridas:
|
|
|
|
|
|
+ // array com as entradas ja inseridas:
|
|
var test_cases = prepareTestCases();
|
|
var test_cases = prepareTestCases();
|
|
ivprogCore.autoGenerateTestCaseOutput(code_teacher, test_cases).catch(function (error) {
|
|
ivprogCore.autoGenerateTestCaseOutput(code_teacher, test_cases).catch(function (error) {
|
|
- showAlert("Houve um erro durante a execução do seu programa: "+error.message);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+ showAlert("Houve um erro durante a execucao do seu programa: "+error.message);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
function outputGenerated (test_cases) {
|
|
function outputGenerated (test_cases) {
|
|
var fields = $('.text_area_output');
|
|
var fields = $('.text_area_output');
|
|
@@ -587,9 +561,7 @@ function outputGenerated (test_cases) {
|
|
$(fields[i]).attr('rows', test_cases[i].output.length);
|
|
$(fields[i]).attr('rows', test_cases[i].output.length);
|
|
}*/
|
|
}*/
|
|
animateOutput(fields, test_cases, 0);
|
|
animateOutput(fields, test_cases, 0);
|
|
-
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function animateOutput (list, test_cases, index) {
|
|
function animateOutput (list, test_cases, index) {
|
|
if (list.length == index) return;
|
|
if (list.length == index) return;
|
|
@@ -599,14 +571,14 @@ function animateOutput (list, test_cases, index) {
|
|
$(list[index]).val($(list[index]).val() + test_cases[index].output[j]);
|
|
$(list[index]).val($(list[index]).val() + test_cases[index].output[j]);
|
|
if (j < test_cases[index].output.length - 1) {
|
|
if (j < test_cases[index].output.length - 1) {
|
|
$(list[index]).val($(list[index]).val() + '\n');
|
|
$(list[index]).val($(list[index]).val() + '\n');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
$(list[index]).attr('rows', test_cases[index].output.length);
|
|
$(list[index]).attr('rows', test_cases[index].output.length);
|
|
|
|
|
|
$(list[index]).effect('highlight', null, 50, function() {
|
|
$(list[index]).effect('highlight', null, 50, function() {
|
|
animateOutput(list, test_cases, index + 1);
|
|
animateOutput(list, test_cases, index + 1);
|
|
- });
|
|
|
|
-}
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
var hist = false;
|
|
var hist = false;
|
|
|
|
|
|
@@ -621,8 +593,8 @@ function addTestCase (test_case = null) {
|
|
text_row += test_case.input[i];
|
|
text_row += test_case.input[i];
|
|
if ((i + 1) < test_case.input.length) {
|
|
if ((i + 1) < test_case.input.length) {
|
|
text_row += '\n';
|
|
text_row += '\n';
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
text_row += '</textarea></td><td class="expandingArea"><textarea rows="'+test_case.output.length+'" name="output" class="text_area_output">';
|
|
text_row += '</textarea></td><td class="expandingArea"><textarea rows="'+test_case.output.length+'" name="output" class="text_area_output">';
|
|
|
|
|
|
@@ -630,26 +602,26 @@ function addTestCase (test_case = null) {
|
|
text_row += test_case.output[i];
|
|
text_row += test_case.output[i];
|
|
if ((i + 1) < test_case.output.length) {
|
|
if ((i + 1) < test_case.output.length) {
|
|
text_row += '\n';
|
|
text_row += '\n';
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
text_row += '</textarea></td><td class="btn_actions"><div class="ui button_remove_case"><i class="red icon times large"></i></div></td></tr>';
|
|
text_row += '</textarea></td><td class="btn_actions"><div class="ui button_remove_case"><i class="red icon times large"></i></div></td></tr>';
|
|
|
|
|
|
new_row = $(text_row);
|
|
new_row = $(text_row);
|
|
} else {
|
|
} else {
|
|
- 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>');
|
|
|
|
- }
|
|
|
|
|
|
+ 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>');
|
|
|
|
+ }
|
|
$('.content_cases').append(new_row);
|
|
$('.content_cases').append(new_row);
|
|
|
|
|
|
new_row.find('.button_remove_case').click(function(e) {
|
|
new_row.find('.button_remove_case').click(function(e) {
|
|
- new_row.remove();
|
|
|
|
- updateTestCaseCounter();
|
|
|
|
- });
|
|
|
|
|
|
+ new_row.remove();
|
|
|
|
+ updateTestCaseCounter();
|
|
|
|
+ });
|
|
|
|
|
|
new_row.find('textarea').on('input', function(e) {
|
|
new_row.find('textarea').on('input', function(e) {
|
|
- var lines = $(this).val().split('\n').length;
|
|
|
|
- $(this).attr('rows', lines);
|
|
|
|
- });
|
|
|
|
|
|
+ var lines = $(this).val().split('\n').length;
|
|
|
|
+ $(this).attr('rows', lines);
|
|
|
|
+ });
|
|
|
|
|
|
updateTestCaseCounter();
|
|
updateTestCaseCounter();
|
|
|
|
|
|
@@ -658,28 +630,27 @@ function addTestCase (test_case = null) {
|
|
if (code == 9 && $(this).closest("tr").is(":last-child")) {
|
|
if (code == 9 && $(this).closest("tr").is(":last-child")) {
|
|
hist = true;
|
|
hist = true;
|
|
addTestCase();
|
|
addTestCase();
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+ });
|
|
if (test_case == null) {
|
|
if (test_case == null) {
|
|
if (!hist) {
|
|
if (!hist) {
|
|
$( ".content_cases tr:last" ).find('.text_area_input').focus();
|
|
$( ".content_cases tr:last" ).find('.text_area_input').focus();
|
|
} else {
|
|
} else {
|
|
hist = false;
|
|
hist = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function updateTestCaseCounter () {
|
|
function updateTestCaseCounter () {
|
|
- var i = 1;
|
|
|
|
- $( ".content_cases" ).find('tr').each(function() {
|
|
|
|
- $( this ).find('.counter').text(i);
|
|
|
|
- ++i;
|
|
|
|
|
|
+ var i = 1;
|
|
|
|
+ $( ".content_cases" ).find('tr').each(function() {
|
|
|
|
+ $( this ).find('.counter').text(i);
|
|
|
|
+ ++i;
|
|
});
|
|
});
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
function prepareTableSettings (div_el) {
|
|
function prepareTableSettings (div_el) {
|
|
-
|
|
|
|
div_el.append('<div class="ui segment settings_topic"><h3 class="ui header"><i class="window maximize outline icon"></i><div class="content">'+LocalizedStrings.getUI('text_config_programming')+'</div></h3>'
|
|
div_el.append('<div class="ui segment settings_topic"><h3 class="ui header"><i class="window maximize outline icon"></i><div class="content">'+LocalizedStrings.getUI('text_config_programming')+'</div></h3>'
|
|
+'<div class="content content_segment_settings"><form name="settings_programming_type"><div class="ui stackable five column grid">'
|
|
+'<div class="content content_segment_settings"><form name="settings_programming_type"><div class="ui stackable five column grid">'
|
|
+'<div class="column"><div class="ui radio"><input type="radio" name="programming_type" id="programming_textual" value="textual" tabindex="0" class="hidden small"><label for="programming_textual">'+LocalizedStrings.getUI('text_config_programming_textual')+'</label></div></div>'
|
|
+'<div class="column"><div class="ui radio"><input type="radio" name="programming_type" id="programming_textual" value="textual" tabindex="0" class="hidden small"><label for="programming_textual">'+LocalizedStrings.getUI('text_config_programming_textual')+'</label></div></div>'
|
|
@@ -722,25 +693,21 @@ function prepareTableSettings (div_el) {
|
|
|
|
|
|
$('.circular.inverted.teal.question.icon').popup({
|
|
$('.circular.inverted.teal.question.icon').popup({
|
|
content : LocalizedStrings.getUI("text_teacher_filter_help"),
|
|
content : LocalizedStrings.getUI("text_teacher_filter_help"),
|
|
- delay: {
|
|
|
|
- show: 750,
|
|
|
|
- hide: 0
|
|
|
|
- }
|
|
|
|
|
|
+ delay: { show: 750, hide: 0 }
|
|
});
|
|
});
|
|
|
|
|
|
$('.ui.checkbox').checkbox();
|
|
$('.ui.checkbox').checkbox();
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function orderWidth() {
|
|
function orderWidth() {
|
|
$('.ui.raised.container.segment.div_to_body').css('width', '100%');
|
|
$('.ui.raised.container.segment.div_to_body').css('width', '100%');
|
|
$('.ui.one.column.container.segment.ivprog_visual_panel').css('width', '100%');
|
|
$('.ui.one.column.container.segment.ivprog_visual_panel').css('width', '100%');
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function orderIcons() {
|
|
function orderIcons() {
|
|
$('.ui.one.column.doubling.stackable.grid.container').css('display', 'none');
|
|
$('.ui.one.column.doubling.stackable.grid.container').css('display', 'none');
|
|
$('.only_in_frame').css('display', 'block');
|
|
$('.only_in_frame').css('display', 'block');
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
function inIframe () {
|
|
function inIframe () {
|
|
@@ -748,48 +715,48 @@ function inIframe () {
|
|
return window.self !== window.top;
|
|
return window.self !== window.top;
|
|
} catch (e) {
|
|
} catch (e) {
|
|
return true;
|
|
return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
|
|
|
|
-function full_screen() {
|
|
|
|
|
|
+function full_screen () {
|
|
// check if user allows full screen of elements. This can be enabled or disabled in browser config. By default its enabled.
|
|
// check if user allows full screen of elements. This can be enabled or disabled in browser config. By default its enabled.
|
|
//its also used to check if browser supports full screen api.
|
|
//its also used to check if browser supports full screen api.
|
|
- if("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || "mozFullScreenEnabled" in document || "msFullscreenEnabled" in document) {
|
|
|
|
- if(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) {
|
|
|
|
|
|
+ if ("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || "mozFullScreenEnabled" in document || "msFullscreenEnabled" in document) {
|
|
|
|
+ if (document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) {
|
|
var element = document.getElementById("ui_main_div");
|
|
var element = document.getElementById("ui_main_div");
|
|
//requestFullscreen is used to display an element in full screen mode.
|
|
//requestFullscreen is used to display an element in full screen mode.
|
|
- if("requestFullscreen" in element) {
|
|
|
|
|
|
+ if ("requestFullscreen" in element) {
|
|
element.requestFullscreen();
|
|
element.requestFullscreen();
|
|
- }
|
|
|
|
|
|
+ }
|
|
else if ("webkitRequestFullscreen" in element) {
|
|
else if ("webkitRequestFullscreen" in element) {
|
|
element.webkitRequestFullscreen();
|
|
element.webkitRequestFullscreen();
|
|
- }
|
|
|
|
|
|
+ }
|
|
else if ("mozRequestFullScreen" in element) {
|
|
else if ("mozRequestFullScreen" in element) {
|
|
element.mozRequestFullScreen();
|
|
element.mozRequestFullScreen();
|
|
- }
|
|
|
|
|
|
+ }
|
|
else if ("msRequestFullscreen" in element) {
|
|
else if ("msRequestFullscreen" in element) {
|
|
element.msRequestFullscreen();
|
|
element.msRequestFullscreen();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
$('.expand_button').addClass('disabled');
|
|
$('.expand_button').addClass('disabled');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function getAutoEvalOriginalData () {
|
|
function getAutoEvalOriginalData () {
|
|
return parent.getAutoEvalOriginalData();
|
|
return parent.getAutoEvalOriginalData();
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function teacherAutoEval (data) {
|
|
function teacherAutoEval (data) {
|
|
previousContent = data;
|
|
previousContent = data;
|
|
// Ver arquivo js/util/iassignHelpers.js
|
|
// Ver arquivo js/util/iassignHelpers.js
|
|
var content = ivprogCore.prepareActivityToStudentHelper(data).getOrElse(null);
|
|
var content = ivprogCore.prepareActivityToStudentHelper(data).getOrElse(null);
|
|
- if(!content) {
|
|
|
|
|
|
+ if (!content) {
|
|
showInvalidData();
|
|
showInvalidData();
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
- // Casos de testes agora são delegados ao tratamento apropriado pela função acima
|
|
|
|
|
|
+ }
|
|
|
|
+ // Casos de testes agora sao delegados ao tratamento apropriado pela funcao acima
|
|
// var testCases = content.testcases;
|
|
// var testCases = content.testcases;
|
|
settingsProgrammingTypes = content.settingsProgrammingType;
|
|
settingsProgrammingTypes = content.settingsProgrammingType;
|
|
settingsDataTypes = content.settingsDataTypes;
|
|
settingsDataTypes = content.settingsDataTypes;
|
|
@@ -802,23 +769,20 @@ function teacherAutoEval (data) {
|
|
parsePreviousAlgorithm();
|
|
parsePreviousAlgorithm();
|
|
var originalData = getAutoEvalOriginalData();
|
|
var originalData = getAutoEvalOriginalData();
|
|
ivprogCore.autoEval(originalData, parent.postResultAutoEval);
|
|
ivprogCore.autoEval(originalData, parent.postResultAutoEval);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
ivprogTextualOrVisual();
|
|
ivprogTextualOrVisual();
|
|
if (settingsFilter && settingsFilter[0]) {
|
|
if (settingsFilter && settingsFilter[0]) {
|
|
-
|
|
|
|
blockAllEditingOptions();
|
|
blockAllEditingOptions();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
function displayGrade(grade) {
|
|
function displayGrade(grade) {
|
|
alert(grade);
|
|
alert(grade);
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function showInvalidData () {
|
|
function showInvalidData () {
|
|
- $('.ui.height_100.add_accordion').dimmer({
|
|
|
|
- closable: false
|
|
|
|
- });
|
|
|
|
|
|
+ $('.ui.height_100.add_accordion').dimmer({ closable: false });
|
|
$('.dimmer_content_message h3').html(LocalizedStrings.getUI('text_message_error_activity_file'));
|
|
$('.dimmer_content_message h3').html(LocalizedStrings.getUI('text_message_error_activity_file'));
|
|
$('.dimmer_content_message button').text(LocalizedStrings.getUI('text_message_error_activity_reload'));
|
|
$('.dimmer_content_message button').text(LocalizedStrings.getUI('text_message_error_activity_reload'));
|
|
$('.dimmer_content_message').css('display', 'block');
|
|
$('.dimmer_content_message').css('display', 'block');
|
|
@@ -826,13 +790,11 @@ function showInvalidData () {
|
|
$('.ui.height_100.add_accordion').dimmer('show');
|
|
$('.ui.height_100.add_accordion').dimmer('show');
|
|
$('.dimmer_content_message button').on('click', function(e) {
|
|
$('.dimmer_content_message button').on('click', function(e) {
|
|
window.parent.location.reload()
|
|
window.parent.location.reload()
|
|
- })
|
|
|
|
-}
|
|
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
function showMessageDialog (msg = "") {
|
|
function showMessageDialog (msg = "") {
|
|
- $('.ui.height_100.add_accordion').dimmer({
|
|
|
|
- closable: false
|
|
|
|
- });
|
|
|
|
|
|
+ $('.ui.height_100.add_accordion').dimmer({ closable: false });
|
|
$('.dimmer_content_message h3').html(msg);
|
|
$('.dimmer_content_message h3').html(msg);
|
|
$('.dimmer_content_message button').text("OK");
|
|
$('.dimmer_content_message button').text("OK");
|
|
$('.dimmer_content_message').css('display', 'block');
|
|
$('.dimmer_content_message').css('display', 'block');
|
|
@@ -841,12 +803,10 @@ function showMessageDialog (msg = "") {
|
|
$('.dimmer_content_message button').on('click', function(e) {
|
|
$('.dimmer_content_message button').on('click', function(e) {
|
|
$('.ui.height_100.add_accordion').dimmer('hide');
|
|
$('.ui.height_100.add_accordion').dimmer('hide');
|
|
})
|
|
})
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
function showInvalidFile () {
|
|
function showInvalidFile () {
|
|
- $('.ui.height_100.add_accordion').dimmer({
|
|
|
|
- closable: true
|
|
|
|
- });
|
|
|
|
|
|
+ $('.ui.height_100.add_accordion').dimmer({ closable: true });
|
|
$('.dimmer_content_message h3').html(LocalizedStrings.getUI('text_message_error_upload_file'));
|
|
$('.dimmer_content_message h3').html(LocalizedStrings.getUI('text_message_error_upload_file'));
|
|
$('.dimmer_content_message button').text(LocalizedStrings.getUI('text_message_error_upload_close'));
|
|
$('.dimmer_content_message button').text(LocalizedStrings.getUI('text_message_error_upload_close'));
|
|
$('.dimmer_content_message').css('display', 'block');
|
|
$('.dimmer_content_message').css('display', 'block');
|
|
@@ -855,4 +815,4 @@ function showInvalidFile () {
|
|
$('.dimmer_content_message button').on('click', function(e) {
|
|
$('.dimmer_content_message button').on('click', function(e) {
|
|
$('.ui.height_100.add_accordion').dimmer('hide');
|
|
$('.ui.height_100.add_accordion').dimmer('hide');
|
|
})
|
|
})
|
|
-}
|
|
|
|
|
|
+ }
|