version 1.36, 2006/04/04 17:42:28
|
version 1.37, 2006/04/05 17:33:51
|
Line 2267 sub parse_webctvista4_question {
|
Line 2267 sub parse_webctvista4_question {
|
my $currindex; |
my $currindex; |
my %varinfo = (); |
my %varinfo = (); |
my $formula; |
my $formula; |
|
my $jumbnum = 0; |
my $p = HTML::Parser->new |
my $p = HTML::Parser->new |
( |
( |
xml_mode => 1, |
xml_mode => 1, |
Line 2332 sub parse_webctvista4_question {
|
Line 2333 sub parse_webctvista4_question {
|
%{$$settings{$id}{$list}} = (); |
%{$$settings{$id}{$list}} = (); |
@{$$allanswers{$id}{$list}} = (); |
@{$$allanswers{$id}{$list}} = (); |
@{$$settings{$id}{$list}{correctanswer}} = (); |
@{$$settings{$id}{$list}{correctanswer}} = (); |
|
@{$$settings{$id}{$list}{jumbledtext}} = (); |
|
@{$$settings{$id}{$list}{jumbledtype}} = (); |
@{$$settings{$id}{$list}{jumbled}} = (); |
@{$$settings{$id}{$list}{jumbled}} = (); |
$$settings{$id}{$list}{rcardinality} = $attr->{rcardinality}; |
$$settings{$id}{$list}{rcardinality} = $attr->{rcardinality}; |
} |
} |
Line 2350 sub parse_webctvista4_question {
|
Line 2353 sub parse_webctvista4_question {
|
$currtexttype = lc($attr->{texttype}); |
$currtexttype = lc($attr->{texttype}); |
$$settings{$id}{$list}{$jumble_item}{texttype} = $currtexttype; |
$$settings{$id}{$list}{$jumble_item}{texttype} = $currtexttype; |
} |
} |
|
if ("@state" eq "questestinterop item resprocessing respcondition") { # Jumbled |
|
if ($$settings{$id}{class} eq 'jumbled') { |
|
$jumbnum ++; |
|
@{$$settings{$id}{$list}{jumbled}[$jumbnum]} = (); |
|
} |
|
} |
|
|
if ("@state" eq "questestinterop item resprocessing respcondition conditionvar and varequal") { # Jumbled |
if ("@state" eq "questestinterop item resprocessing respcondition conditionvar and varequal") { # Jumbled |
$currindex = $attr->{index}; |
$currindex = $attr->{index}; |
} |
} |
Line 2542 sub parse_webctvista4_question {
|
Line 2552 sub parse_webctvista4_question {
|
$$settings{$id}{$list}{$answer_id}{text} = $text; |
$$settings{$id}{$list}{$answer_id}{text} = $text; |
} |
} |
if ("@state" eq "questestinterop item presentation flow response_lid render_extension ims_render_object material mattext") { |
if ("@state" eq "questestinterop item presentation flow response_lid render_extension ims_render_object material mattext") { |
$$settings{$id}{$list}{text} .= $text; |
push(@{$$settings{$id}{$list}{jumbledtext}},$text); |
|
push(@{$$settings{$id}{$list}{jumbledtype}},'No'); |
} |
} |
if ("@state" eq "questestinterop item presentation flow response_lid render_extension ims_render_object response_label material mattext") { |
if ("@state" eq "questestinterop item presentation flow response_lid render_extension ims_render_object response_label material mattext") { |
$$settings{$id}{$list}{$jumble_item}{text} = $text; |
$$settings{$id}{$list}{$jumble_item}{text} = $text; |
$$settings{$id}{$list}{text} .= $text; |
push(@{$$settings{$id}{$list}{jumbledtext}},$text); |
|
push(@{$$settings{$id}{$list}{jumbledtype}},'Yes'); |
} |
} |
if ("@state" eq "questestinterop item presentation flow material mattext") { |
if ("@state" eq "questestinterop item presentation flow material mattext") { |
$$settings{$id}{text} .= $text; |
$$settings{$id}{text} .= $text; |
Line 2582 sub parse_webctvista4_question {
|
Line 2594 sub parse_webctvista4_question {
|
} |
} |
} |
} |
} |
} |
|
|
if ("@state" eq "questestinterop item resprocessing respcondition conditionvar and varequal") { # Jumbled |
if ("@state" eq "questestinterop item resprocessing respcondition conditionvar and varequal") { # Jumbled |
$$settings{$id}{$list}{jumbled}[$currindex] = $text; |
$$settings{$id}{$list}{jumbled}[$jumbnum][$currindex] = $text; |
} |
} |
if ("@state" eq "questestinterop item resprocessing respcondition setvar") { |
if ("@state" eq "questestinterop item resprocessing respcondition setvar") { |
if ($setvar{varname} eq "SCORE") { # Multiple Choice, String or Match |
if ($setvar{varname} eq "SCORE") { # Multiple Choice, String or Match |
Line 3749 sub write_webct4_questions {
|
Line 3762 sub write_webct4_questions {
|
$resourcedata{$symb.'hiddenparts'} = '!essay'; |
$resourcedata{$symb.'hiddenparts'} = '!essay'; |
$resourcedata{$symb.'questiontype'} = 'essay'; |
$resourcedata{$symb.'questiontype'} = 'essay'; |
} |
} |
|
} elsif ($$settings{$id}{class} eq 'jumbled') { |
|
if ($context eq 'CSTR') { |
|
my %foiloptions = (); |
|
foreach my $list (@{$$settings{$id}{lists}}) { |
|
@{$foiloptions{$list}} = (); |
|
my $numalternates = @{$$settings{$id}{$list}{jumbled}} - 1; |
|
my $loopstop = 2; #Hard coded for now, so only one permutation of answers is correct; <or> functionality is needed to support the case where multiple permutations are correct. |
|
for (my $i=1; $i<$loopstop; $i++) { |
|
$foiloptions{$list}[$i] = '('; |
|
for (my $j=@{$$settings{$id}{$list}{jumbled}[$i]}-1; $j>0; $j--) { |
|
my $jumble_item = $$settings{$id}{$list}{jumbled}[$i][$j]; |
|
$foiloptions{$list}[$i] .= "'".$$settings{$id}{$list}{$jumble_item}{text}."',"; |
|
} |
|
$foiloptions{$list}[$i] =~ s/,$//; |
|
$foiloptions{$list}[$i] .= ')'; |
|
my $jnum = 0; |
|
for (my $k=0; $k<@{$$settings{$id}{$list}{jumbledtype}}; $k++) { |
|
if ($$settings{$id}{$list}{jumbledtype}[$k] eq 'No') { |
|
$output .= qq| |
|
<startouttext /> |
|
$$settings{$id}{$list}{jumbledtext}[$k] |
|
<endouttext />|; |
|
} elsif ($$settings{$id}{$list}{jumbledtype}[$k] eq 'Yes') { |
|
$jnum ++; |
|
my $jumble_item = $$settings{$id}{$list}{jumbled}[$i][$jnum]; |
|
$output .= qq| |
|
<optionresponse max="1" randomize="yes" TeXlayout="horizontal"> |
|
<foilgroup options="$foiloptions{$list}[$i]"> |
|
<foil location="random" value="$$settings{$id}{$list}{$jumble_item}{text}" name="$jumble_item"></foil> |
|
</foilgroup> |
|
</optionresponse> |
|
|; |
|
} |
|
} |
|
} |
|
if ($numalternates > 0) { # for now alternates are stored in an instructorcomment. In the future these alternates could be moved into the main response area once <or> functionality is available. |
|
$output .= '<instructorcomment>(Not shown to students) '."\n".'The following alternates were imported from the corresponding WebCT Vista 4 jumbled sentence question, but are not included in the LON-CAPA version, because this style of question does not currently support multiple correct solutions.'."\n"; |
|
for (my $i=2; $i<@{$$settings{$id}{$list}{jumbled}}; $i++) { |
|
my $altid = $i-1; |
|
my $jnum = 0; |
|
$output .= $altid.'. '; |
|
for (my $k=0; $k<@{$$settings{$id}{$list}{jumbledtype}}; $k++) { |
|
if ($$settings{$id}{$list}{jumbledtype}[$k] eq 'No') { |
|
$output .= "$$settings{$id}{$list}{jumbledtext}[$k]" ; |
|
} elsif ($$settings{$id}{$list}{jumbledtype}[$k] eq 'Yes') { |
|
$jnum ++; |
|
my $jumble_item = $$settings{$id}{$list}{jumbled}[$i][$jnum]; |
|
$output .= '['.$$settings{$id}{$list}{$jumble_item}{text}.']'; |
|
} |
|
} |
|
$output .= " \n"; |
|
} |
|
$output .= '</instructorcomment>'; |
|
} |
|
} |
|
} |
} else { |
} else { |
if ($context eq 'CSTR') { |
if ($context eq 'CSTR') { |
$output .= qq|<startouttext /><p>$$settings{$id}{text}</p>$questionimage<endouttext />\n|; |
$output .= qq|<startouttext /><p>$$settings{$id}{text}</p>$questionimage<endouttext />\n|; |