--- loncom/homework/default_homework.lcpm 2010/10/18 19:47:31 1.150 +++ loncom/homework/default_homework.lcpm 2010/12/16 16:01:01 1.151 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run() # -# $Id: default_homework.lcpm,v 1.150 2010/10/18 19:47:31 raeburn Exp $ +# $Id: default_homework.lcpm,v 1.151 2010/12/16 16:01:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -359,11 +359,25 @@ sub caparesponse_check_list { my $allow_control_char = 0; my $control_chars_removed = 0; + my $ansstring; if ($type eq 'cs' || $type eq 'ci') { if (ref($LONCAPA::CAPAresponse_answer->{'answers'}) eq 'ARRAY') { foreach my $strans (@{$LONCAPA::CAPAresponse_answer->{'answers'}}) { - if ($strans =~ /[\000-\037]/) { - $allow_control_char = 1; + if (ref($strans) eq 'ARRAY') { + foreach my $item (@{$strans}) { + if ($item =~ /[\000-\037]/) { + $allow_control_char = 1; + } + } + } + } + } + } + if (($type eq 'cs') || ($type eq 'ci')) { + if (ref($LONCAPA::CAPAresponse_answer->{'answers'}) eq 'ARRAY') { + foreach my $answer (@{ $LONCAPA::CAPAresponse_answer->{'answers'} }) { + if (ref($answer) eq 'ARRAY') { + $ansstring = join("\0",@{$answer}); } } } @@ -476,7 +490,7 @@ sub caparesponse_check_list { &LONCAPA_INTERNAL_DEBUG(" all final_awards ".join(':',@final_awards)); my ($final_award,$final_msg) = &LONCAPA_INTERNAL_FINALIZEAWARDS(\@final_awards,\@final_msg,undef,1); - return ($final_award,$final_msg,$error,$control_chars_removed); + return ($final_award,$final_msg,$error,$control_chars_removed,$ansstring); } sub verify_stringresponse {