|
@@ -30,8 +30,22 @@ function getAnswer () {
|
|
// Montar o retorno da resposta do aluno
|
|
// Montar o retorno da resposta do aluno
|
|
|
|
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+ // Montar o retorno com a criação da atividade do professor
|
|
|
|
+ return prepareTestCases();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function prepareTestCases () {
|
|
|
|
+ var ret = '{ \n "testcases" : [ '
|
|
|
|
+ var test_cases_array = $('form[name="test_cases"]').serializeArray();
|
|
|
|
+ for (var i = 0; i < test_cases_array.length; i = i + 2) {
|
|
|
|
+ ret += '\n{ ';
|
|
|
|
+ ret += '\n "input": "' + test_cases_array[i].value + '",'
|
|
|
|
+ ret += '\n "output": "' + test_cases_array[i+1].value + '" '
|
|
|
|
+ ret += '\n},'
|
|
}
|
|
}
|
|
|
|
+ ret += '\n] }';
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
// Função chamada pelo iTarefa para receber a nota do aluno na atividade
|
|
// Função chamada pelo iTarefa para receber a nota do aluno na atividade
|
|
@@ -47,13 +61,15 @@ function getEvaluation () {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+var testCases = null;
|
|
|
|
+
|
|
// Função para que o iMA leia os dados da atividade fornecidos pelo iTarefa
|
|
// Função 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 parâmetro "iLM_PARAM_Assignment" fornece o URL do endereço 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) {
|
|
-
|
|
|
|
|
|
+ // testCases é preenchida
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -66,6 +82,9 @@ function prepareEnvironment () {
|
|
|
|
|
|
// Função para preparar a interface para o professor criar atividade:
|
|
// Função para preparar a interface para o professor criar atividade:
|
|
function prepareActivityCreation () {
|
|
function prepareActivityCreation () {
|
|
|
|
+
|
|
|
|
+ $('.add_accordion').addClass('accordion');
|
|
|
|
+
|
|
$('.default_visual_title').toggle();
|
|
$('.default_visual_title').toggle();
|
|
$('.default_visual_title').append('<span>'+LocalizedStrings.getUI('text_teacher_algorithm')+'</span>');
|
|
$('.default_visual_title').append('<span>'+LocalizedStrings.getUI('text_teacher_algorithm')+'</span>');
|
|
$('.height_100').removeClass('height_100');
|
|
$('.height_100').removeClass('height_100');
|
|
@@ -92,19 +111,48 @@ function prepareActivityCreation () {
|
|
}
|
|
}
|
|
|
|
|
|
function prepareTableTestCases (div_el) {
|
|
function prepareTableTestCases (div_el) {
|
|
- var table_el = '<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>';
|
|
|
|
|
|
+
|
|
|
|
+ //return JSON.stringify($('form[name="elaborar"]').serializeArray());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ 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>';
|
|
|
|
|
|
div_el.append(table_el);
|
|
div_el.append(table_el);
|
|
|
|
|
|
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>');
|
|
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>');
|
|
|
|
|
|
$('.button_add_case').on('click', function(e) {
|
|
$('.button_add_case').on('click', function(e) {
|
|
- $('.content_cases').append('<tr><td>88</td><td>more data</td><td>my data</td><td>more data</td></tr>');
|
|
|
|
|
|
+ addTestCase();
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function addTestCase () {
|
|
|
|
+ var new_row = $('<tr><td class="counter"></td><td class="expandingArea"><textarea rows="1" name="input"></textarea></td><td class="expandingArea"><textarea rows="1" name="output"></textarea></td><td class="btn_actions"><button class="ui icon button"><i class="red icon times"></i></button></td></tr>');
|
|
|
|
+ $('.content_cases').append(new_row);
|
|
|
|
+
|
|
|
|
+ new_row.find('button').click(function(e) {
|
|
|
|
+ new_row.remove();
|
|
|
|
+ updateTestCaseCounter();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('textarea').on('input', function(e) {
|
|
|
|
+ var lines = $(this).val().split('\n').length;
|
|
|
|
+ $(this).attr('rows', lines);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ updateTestCaseCounter();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function updateTestCaseCounter () {
|
|
|
|
+ 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('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_data_types')+'</h4>');
|
|
div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_data_types')+'</h4>');
|
|
div_el.append('<div class="ui stackable five column grid">'
|
|
div_el.append('<div class="ui stackable five column grid">'
|