diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php index 51cd758af7..9cca7c4953 100644 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -7,7 +7,7 @@ Copyright (c) Denes Nagy (darkden@freemail.hu) For a full list of contributors, see "credits.txt". - The full license can be read in "license.txt". + The full license can be read in "license.txt". This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -616,7 +616,7 @@ function LMSSetValue(param, val) { return_value='true'; break; case "student_response": - interactions[elem_id][5] = val; + interactions[elem_id][5] = ''+val; logit_scorm("Interaction "+elem_id+"'s student_response updated",2); return_value='true'; break; @@ -1454,21 +1454,32 @@ function xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, is_interactions='false'; } } - + + if (is_interactions=='true') { - interact_string = ''; + interact_string = ''; + temp = ''; for (i in interactions){ + interact_string += '&interact['+i+']='; interact_temp = '['; - for (j in interactions[i]) { - interact_temp += interactions[i][j]+','; + for (j in interactions[i]) { + temp = interactions[i][j]; + temp = ''+temp; // if temp == 1 there are problems with indexOf and an integer number + //this fix when an interaction have ',' i.e: + while(temp.indexOf(',') >= 0){ + temp = temp.replace(',','@@'); + }; + interact_temp +=temp+','; } interact_temp = interact_temp.substr(0,(interact_temp.length-2)) + ']'; - interact_string += encodeURIComponent(interact_temp); + // interact_string += encodeURIComponent(interact_temp); + + + interact_string += interact_temp; } - //interact_string = encodeURIComponent(interact_string.substr(0,(interact_string.length-1))); - - params += interact_string; + //interact_string = encodeURIComponent(interact_string.substr(0,(interact_string.length-1))); + params += interact_string; is_interactions='false'; }