Browse Source

Work in progres

Igor 2 years ago
parent
commit
ef9afa40d8
3 changed files with 16 additions and 5 deletions
  1. 3 0
      js/visualUI/code_generator.js
  2. 10 4
      js/visualUI/functions.js
  3. 3 1
      js/visualUI/ivprog_elements.js

+ 3 - 0
js/visualUI/code_generator.js

@@ -820,6 +820,9 @@ function parametersCode (parameter_obj) {
       ret += " " + LocalizedStrings.getUI("type_char") + " ";
       break;
   }
+  if (parameter_obj.reference)
+    ret += "&";
+
   ret += parameter_obj.name + "";
 
   if (parameter_obj.dimensions == 1) {

+ 10 - 4
js/visualUI/functions.js

@@ -1259,6 +1259,11 @@ function renderParameter (function_obj, parameter_obj, function_container) {
 
   ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
 
+  if (parameter_obj.reference)
+    ret += '<input type="checkbox" checked>';
+  else 
+    ret += '<input type="checkbox">';
+
   ret += '<div class="ui dropdown parameter_type">';
 
   if (parameter_obj.dimensions > 0) {
@@ -1283,7 +1288,6 @@ function renderParameter (function_obj, parameter_obj, function_container) {
       ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() && parameter_obj.dimensions == 0 ? ' selected ' : '') + '" data-type="'+tm+'" >'+LocalizedStrings.getUI(`type_${tm.toLowerCase()}`)+'</div>';
   }
 
-
   ret += '<div class="item ' + (parameter_obj.dimensions == 1 ? ' selected ' : '') + '">'
     + '<i class="dropdown icon"></i>' + LocalizedStrings.getUI('vector')
     +  '<div class="menu">';
@@ -1341,6 +1345,10 @@ function renderParameter (function_obj, parameter_obj, function_container) {
     enableNameParameterUpdate(parameter_obj, ret, function_obj);
   });
 
+  ret.find('input:checkbox').change(function() {
+    parameter_obj.reference = this.checked
+  });
+
   return ret;
 }
 
@@ -1645,10 +1653,8 @@ function uploadFile (evt) {
 
         previousContent = txt;
         prepareActivityToStudent(txt);
-
-        // window.algorithm_in_ilm = txt;
-        // window.program_obj = JSON.parse(txt);
         window.renderAlgorithm();
+        $('.assessment_button').addClass('disabled');
       }
       catch (e) {
         showInvalidFile();

+ 3 - 1
js/visualUI/ivprog_elements.js

@@ -74,7 +74,8 @@ export class Variable {
     dimensions = 0,
     is_constant = false,
     rows = 0,
-    columns = 0
+    columns = 0,
+    reference = false
   ) {
     this.type = type;
     this.name = name;
@@ -83,6 +84,7 @@ export class Variable {
     this.is_constant = is_constant;
     this.rows = rows;
     this.columns = columns;
+    this.reference = reference;
   }
 }