--- loncom/imspackages/imsprocessor.pm 2005/10/12 22:54:20 1.28 +++ loncom/imspackages/imsprocessor.pm 2005/10/14 22:28:56 1.29 @@ -1832,11 +1832,13 @@ sub parse_bb6_assessment { my @state = (); my $id; # the current question ID my $list; # the current list ID for multiple choice questions + my $response; # the current response ID my $currtexttype; - my $curr_outer_block; - my $curr_inner_block; + my @curr_block = (); my $curr_shuffle; my $curr_class; + my $curr_matchitem; + my $curr_block_type; my $curr_feedback_type; my $p = HTML::Parser->new ( @@ -1848,37 +1850,73 @@ sub parse_bb6_assessment { if ("@state" eq "questestinterop assessment") { $$settings{title} = $attr->{title}; } + if ("@state" eq "questestinterop assessment rubric flow_mat material mat_extension mat_formattedtext") { + $currtexttype = $attr->{type}; + } + if ("@state" eq "questestinterop section item presentation flow") { + $curr_block[0] = $attr->{class}; + if ($curr_block[0] eq 'RESPONSE_BLOCK') { + $curr_block_type = 'response'; + } elsif ($curr_block[0] eq 'RIGHT_MATCH_BLOCK') { + $curr_block_type = 'rightmatch'; + } + } if ("@state" eq "questestinterop section item presentation flow flow") { - $curr_outer_block = $attr->{class}; + $curr_block[1] = $attr->{class}; + if ($curr_block[1] eq 'QUESTION_BLOCK') { + $curr_block_type = 'question'; + } } if ("@state" eq "questestinterop section item presentation flow flow flow") { - $curr_inner_block = $attr->{class}; + $curr_block[2] = $attr->{class}; } if ("@state" eq "questestinterop section item presentation flow flow flow material mat_extension mat_formatted_text") { - $$settings{$id}{texttype} = $attr->{texttype}; + $$settings{$id}{$curr_block_type}{texttype} = $attr->{texttype}; $currtexttype = $attr->{texttype}; - $curr_inner_block = $attr->{class}; } if ("@state" eq "questestinterop section item presentation flow flow flow material matapplication") { - $$settings{$id}{image} = $attr->{uri}; - $$settings{$id}{style} = $attr->{embedded}; - $$settings{$id}{label} = $attr->{label}; + $$settings{$id}{$curr_block_type}{image} = $attr->{uri}; + $$settings{$id}{$curr_block_type}{style} = $attr->{embedded}; + $$settings{$id}{$curr_block_type}{label} = $attr->{label}; } if ("@state" eq "questestinterop section item presentation flow flow flow material mattext") { - $$settings{$id}{link} = $attr->{uri}; + $$settings{$id}{$curr_block_type}{link} = $attr->{uri}; } if ("@state" eq "questestinterop section item presentation flow response_lid render_choice") { $curr_shuffle = $attr->{shuffle}; } - if ("@state" eq "questestinterop section item presentation flow flow flow response_lid render_choice flow response_label") { - if ($$settings{$id}{class} eq 'Multiple Choice') { - $curr_class = 'Multiple Choice'; + if ("@state" eq "questestinterop section item presentation flow response_lid") { $response = $attr->{ident}; + if ($curr_class eq 'Matching') { + %{$$settings{$id}{$response}} = (); + foreach my $key (keys(%{$$settings{$id}{$curr_block_type}})) { + $$settings{$id}{$response}{$key} = $$settings{$id}{$curr_block_type}{$key}; + } + %{$$settings{$id}{$curr_block_type}} = (); + } + } + if ("@state" eq "questestinterop section item presentation flow response_lid render_choice flow response_label") { + if (($curr_class eq 'Multiple Choice') || ($curr_class eq 'Multiple Answer') || ($curr_class eq 'Order')) { $list = $attr->{ident}; push(@{$$settings{$id}{lists}},$list); $$settings{$id}{$list}{randomize} = $curr_shuffle; %{$$settings{$id}{$list}} = (); @{$$allanswers{$id}{$list}} = (); @{$$settings{$id}{$list}{correctanswer}} = (); + } elsif ($curr_class eq 'Matching') { + push(@{$$settings{$id}{$response}{items}},$list); + } + } + if ("@state" eq "questestinterop section item presentation flow response_lid render_choice flow response_label flow_mat material matapplication") { + $$settings{$id}{$list}{filetype} = $attr->{embedded}; + $$settings{$id}{$list}{label} = $attr->{label}; + $$settings{$id}{$list}{uri} = $attr->{uri}; + } + if ("@state" eq "questestinterop section item presentation flow response_lid render_choice flow response_label flow_mat material mattext") { + $$settings{$id}{$list}{link} = $attr->{uri}; + } + if ("@state" eq "questestinterop section item resprocessing respcondition conditionvar varequal") { + if ($curr_class eq 'Matching') { + $curr_matchitem = $attr->{respident}; } } if ("@state" eq "questestinterop section item itemfeedback") { @@ -1908,26 +1946,43 @@ sub parse_bb6_assessment { push @{$allids}, $id; %{$$settings{$id}} = (); @{$$settings{$id}{lists}} = (); + %{$$settings{$id}{question}} = (); %{$$settings{$id}{correctfeedback}} = (); %{$$settings{$id}{incorrectfeedback}} = (); + %{$$settings{$id}{solutionfeedback}} = (); + %{$$settings{$id}{question}} = (); + %{$$settings{$id}{response}} = (); } if ("@state" eq "questestinterop assessment section item itemmetadata bbmd_questiontype") { $$settings{$id}{class} = $text; + $curr_class = $text; } if ("@state" eq "questestinterop assessment section item presentation flow flow flow material mat_extension mat_formatted_text") { - $$settings{$id}{text} = $text; + $$settings{$id}{$curr_block_type}{text} = $text; } if ("@state" eq "questestinterop section item presentation flow flow flow material mattext") { - $$settings{$id}{linktext} = $text; + $$settings{$id}{$curr_block_type}{linktext} = $text; } - if ("@state" eq "questestinterop section item presentation flow flow flow response_lid render_choice flow response_label flow_mat material mat_extension mat_formatted_text") { + if ("@state" eq "questestinterop section item presentation flow response_lid render_choice flow response_label flow_mat material mat_extension mat_formatted_text") { $$settings{$id}{$list}{text} = $text; } + if ("@state" eq "questestinterop section item presentation flow response_lid render_choice flow response_label flow_mat material mattext") { + $$settings{$id}{$list}{linktext} = $text; + } if ("@state" eq "questestinterop section item resprocessing respcondition conditionvar varequal") { if ($curr_class eq 'Multiple Choice') { - $$settings{$id}{$list}{correctanswer} = $text; + $$settings{$id}{$list}{correctanswer}[0] = $text; + } elsif ($curr_class eq 'True/False') { + $$settings{$id}{correctanswer} = $text; + } elsif ($curr_class eq 'Matching') { + $$settings{$id}{$curr_matchitem}{correctanswer} = $text; + } elsif ($curr_class eq 'Fill in the Blank') { + push(@{$$settings{$id}{$list}{correctanswer}},$text); } } + if ("@state" eq "questestinterop section item resprocessing respcondition conditionvar and varequal") { + push(@{$$settings{$id}{$list}{correctanswer}},$text); + } if ("@state" eq "questestinterop section item itemfeedback flow_mat flow_mat material mat_extension mat_formattedtext") { $$settings{$id}{$curr_feedback_type.'feedback'}{text} = $text; }