[svn r13224] Added ID to textarea of free answer

Added small placetaker for Hotspot (not yet integrated)
skala
Yannick Warnier 17 years ago
parent 9a23beed0b
commit 14bc2a63ec
  1. 161
      main/newscorm/js/api_wrapper.js

@ -136,13 +136,13 @@ function doLMSFinish()
} }
else else
{ {
var result = API.LMSFinish(""); var result = API.LMSFinish('');
if(result.toString() != "true") //if(result.toString() != "true")
{ //{
var err = ErrorHandler(); // var err = ErrorHandler();
} //}
} }
return result.toString(); //return result.toString();
} }
/** /**
* Calls the LMSGetValue method * Calls the LMSGetValue method
@ -415,100 +415,97 @@ function checkAnswers(interrupted)
{ {
var tmpScore = 0; var tmpScore = 0;
var status = 'not attempted'; var status = 'not attempted';
for(var i=0; i<questions_types.length;i++) for(var i=0; i<questions.length;i++)
{ {
var idQuestion = questions[i]; if(questions[i]){
var type = questions_types[idQuestion]; var idQuestion = questions[i];
var interactionScore = 0; var type = questions_types[idQuestion];
var interactionAnswers = ''; var interactionScore = 0;
var interactionCorrectResponses = ''; var interactionAnswers = '';
if (type == 'mcma') var interactionCorrectResponses = '';
{ if (type == 'mcma')
var myScore = 0;
for(var j=0; j<questions_answers[idQuestion].length;j++)
{ {
var idAnswer = questions_answers[idQuestion][j]; var myScore = 0;
var answer = document.getElementById('question_'+(idQuestion)+'_multiple_'+(idAnswer)); for(var j=0; j<questions_answers[idQuestion].length;j++)
if(answer.checked.value == 'checked')
{ {
myScore += questions_answers_correct[idQuestion][idAnswer]; var idAnswer = questions_answers[idQuestion][j];
var answer = document.getElementById('question_'+(idQuestion)+'_multiple_'+(idAnswer));
if(answer.checked.value == true)
{
myScore += questions_answers_correct[idQuestion][idAnswer];
}
} }
interactionScore = myScore;
tmpScore = myScore;
} }
interactionScore = myScore; else if(type == 'mcua')
tmpScore = myScore;
}
else if(type == 'mcua')
{
var myScore = 0;
for(var j=0; j<questions_answers[idQuestion].length;j++)
{ {
var idAnswer = questions_answers[idQuestion][j]; var myScore = 0;
var answer = document.getElementById('question_'+(idQuestion)+'_unique_'+(idAnswer)); for(var j=0; j<questions_answers[idQuestion].length;j++)
if(answer.selected.value == 'selected')
{ {
myScore += questions_answers_correct[idQuestion][idAnswer]; var idAnswer = questions_answers[idQuestion][j];
var answer = document.getElementById('question_'+(idQuestion)+'_unique_'+(idAnswer));
if(answer.checked.value == true)
{
myScore += questions_answers_correct[idQuestion][idAnswer];
}
} }
interactionScore = myScore;
tmpScore = myScore;
} }
interactionScore = myScore; else if(type == 'tf')
tmpScore = myScore;
}
else if(type == 'tf')
{
var myScore = 0;
for(var j=0; j<questions_answers[idQuestion].length;j++)
{ {
var idAnswer = questions_answers[idQuestion][j]; var myScore = 0;
var answer = document.getElementById('question_'+(idQuestion)+'_tf_'+(idAnswer)); for(var j=0; j<questions_answers[idQuestion].length;j++)
if(answer.selected == 'selected')
{ {
myScore += questions_answers_correct[idQuestion][idAnswer]; var idAnswer = questions_answers[idQuestion][j];
var answer = document.getElementById('question_'+(idQuestion)+'_tf_'+(idAnswer));
if(answer.checked.value == true)
{
myScore += questions_answers_correct[idQuestion][idAnswer];
}
} }
interactionScore = myScore;
tmpScore = myScore;
} }
interactionScore = myScore; else if(type == 'fib')
tmpScore = myScore;
}
else if(type == 'fib')
{
var myScore = 0;
for(var j=0; j<questions_answers[idQuestion].length;j++)
{ {
var idAnswer = questions_answers[idQuestion][j]; var myScore = 0;
var answer = document.getElementById('question_'+(idQuestion)+'_fib_'+(idAnswer)); for(var j=0; j<questions_answers[idQuestion].length;j++)
if(answer.value == questions_answers_correct[idQuestion][idAnswer])
{ {
myScore += 1; var idAnswer = questions_answers[idQuestion][j];
var answer = document.getElementById('question_'+(idQuestion)+'_fib_'+(idAnswer));
if(answer.value == questions_answers_correct[idQuestion][idAnswer])
{
myScore += 1;
}
interactionAnswers += answer.value+',';
} }
interactionAnswers += answer.value+','; interactionScore = myScore;
tmpScore = myScore;
} }
interactionScore = myScore; else if(type == 'matching')
tmpScore = myScore; {
} //
else if(type == 'matching') }
{ else if(type == 'free')
// {
} interactionAnswers += document.getElementById('question_'+(idQuestion)+'_free').innerHTML;
else if(type == 'free') }
{ else if(type == 'hotspot')
interactionAnswers += document.getElementById('question_'+idQuestion+'_free').value; {
} //
else if(type == 'hotspot') }
{ else
// {
} //
else }
{ doLMSSetValue('cmi.interactions.'+idQuestion+'.id','Q'+idQuestion);
// doLMSSetValue('cmi.interactions.'+idQuestion+'.result',interactionScore);
} doLMSSetValue('cmi.interactions.'+idQuestion+'.type',type);
var interactionCorrectResponses = ''; doLMSSetValue('cmi.interactions.'+idQuestion+'.student_response',interactionAnswers);
for(var i=0; i<questions_answers_correct.length;i++) doLMSSetValue('cmi.interactions.'+idQuestion+'.correct_responses',questions_answers_correct[idQuestion]);
{
interactionCorrectResponses += questions_answers_correct[i];
} }
doLMSSetValue('cmi.core.interactions.'+idQuestion+'.id','Q'+idQuestion);
doLMSSetValue('cmi.core.interactions.'+idQuestion+'.result',interactionScore);
doLMSSetValue('cmi.core.interactions.'+idQuestion+'.type',type);
doLMSSetValue('cmi.core.interactions.'+idQuestion+'.student_response',interactionAnswers);
doLMSSetValue('cmi.core.interactions.'+idQuestion+'.correct_responses',interactionCorrectResponses);
} }
doLMSSetValue('cmi.core.score.raw',tmpScore); doLMSSetValue('cmi.core.score.raw',tmpScore);
//get status //get status

Loading…
Cancel
Save