Forráskód Böngészése

Improved output options

Igor 4 éve
szülő
commit
c2e45b79d8

+ 8 - 3
css/ivprog-visual-1.0.css

@@ -390,9 +390,6 @@ div.buttons_manage_columns {
 	padding: 3px;
 }
 
-.ui.button_add_case {
-	margin-top: 10px;
-}
 .accordion {
 	margin: auto;
 }
@@ -1018,4 +1015,12 @@ div.ui.checkbox.transition.visible {
 .circular.inverted.teal.question.icon {
 	font-size: 12px;
 	margin-left: 10px;
+}
+
+.table_buttons {
+	width: 100%;
+	margin-top: 10px;
+}
+.table_buttons .right_align {
+	text-align: right;
 }

+ 3 - 1
i18n/en/ui.json

@@ -142,5 +142,7 @@
   "text_ivprog_version":"Version",
   "text_teacher_filter": "Filter",
   "text_teacher_filter_active": "Activate",
-  "text_teacher_filter_help": "When filter is activated, all iVProg modifications will be blocked."
+  "text_teacher_filter_help": "When filter is activated, all iVProg modifications will be blocked.",
+  "text_teacher_generate_outputs": "Generate outputs",
+  "text_teacher_generate_outputs_algorithm": "Before generate outputs, create an algorithm!"
 }

+ 3 - 1
i18n/es/ui.json

@@ -141,5 +141,7 @@
   "text_ivprog_version":"Version",
   "text_teacher_filter": "Filter",
   "text_teacher_filter_active": "Activate",
-  "text_teacher_filter_help": "When filter is activated, all iVProg modifications will be blocked."
+  "text_teacher_filter_help": "When filter is activated, all iVProg modifications will be blocked.",
+  "text_teacher_generate_outputs": "Generate outputs",
+  "text_teacher_generate_outputs_algorithm": "Before generate outputs, create an algorithm!"
 }

+ 3 - 1
i18n/pt/ui.json

@@ -116,5 +116,7 @@
   "text_teacher_filter": "Filtro",
   "text_teacher_filter_active": "Ativado",
   "text_teacher_filter_help": "Ao ativar o filtro, as modificações do iVProg estarão bloqueadas.",
-  "text_join_assessment_outputs": " ; "
+  "text_join_assessment_outputs": " ; ",
+  "text_teacher_generate_outputs": "Gerar saídas",
+  "text_teacher_generate_outputs_algorithm": "Antes de gerar as saídas, elabore um algoritmo!"
 }

+ 37 - 1
js/iassign-integration-functions.js

@@ -441,11 +441,47 @@ function prepareTableTestCases (div_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>');
+  var table_buttons = '<table class="table_buttons"><tr><td>'
+    + '<button class="ui teal labeled icon button button_add_case"><i class="plus icon"></i>'+LocalizedStrings.getUI('text_teacher_test_case_add')+'</button>'
+    + '</td><td class="right_align">'
+    + '<button class="ui orange labeled icon button button_generate_outputs"><i class="sign-in icon"></i>'+LocalizedStrings.getUI('text_teacher_generate_outputs')+'</button>'
+    + '</td></tr></table>';
+
+  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>'));
 
   $('.button_add_case').on('click', function(e) {
     addTestCase();
   });
+  $('.button_generate_outputs').on('click', function(e) {
+    generateOutputs();
+  });
+}
+
+function showAlert (msg) {
+  $('.ui.basic.modal .content').html('<h3>'+msg+'</h3>');
+  $('.ui.basic.modal').modal('show');
+}
+
+function generateOutputs () {
+  if (window.program_obj.functions.length == 1 && window.program_obj.functions[0].commands.length == 0) {
+    showAlert(LocalizedStrings.getUI('text_teacher_generate_outputs_algorithm'));
+    return;
+  }
+  // código:
+  var code_teacher = window.generator();
+  // array com as entradas já inseridas:
+
+  var test_cases = JSON.parse(prepareTestCases().replace('"testcases" :', ''));
+  
+}
+
+function outputGenerated (test_cases) {
+  var fields = $('.text_area_output');
+  for (var i = 0; i < test_cases.length; i++) {
+    $(fields[i]).val(test_cases[i].output);
+  }
 }
 
 var hist = false;