version 1.78, 2003/05/27 13:56:21
|
version 1.87, 2003/09/24 18:18:38
|
Line 152 sub end_foilgroup {
|
Line 152 sub end_foilgroup {
|
|
|
my $result; |
my $result; |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { |
|
my $tex_option_switch=&Apache::lonxml::get_param('texoptions',$parstack,$safeeval); |
my $name; |
my $name; |
my @opt; |
my @opt; |
eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval); |
eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval); |
|
if ($target eq 'tex' && $tex_option_switch eq 'nochoice') {@opt=();} |
&Apache::lonxml::debug("Options are $#opt"); |
&Apache::lonxml::debug("Options are $#opt"); |
my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2'); |
my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2'); |
my $randomize = &Apache::lonxml::get_param('randomize',$parstack, |
my $randomize = &Apache::lonxml::get_param('randomize',$parstack, |
Line 291 sub displayfoils {
|
Line 293 sub displayfoils {
|
my @names = @{ $Apache::response::foilgroup{'names'} }; |
my @names = @{ $Apache::response::foilgroup{'names'} }; |
my @truelist; |
my @truelist; |
my @falselist; |
my @falselist; |
my $result; |
my $result; |
my $name; |
my $name; |
my $displayoptionintex=0; |
my $displayoptionintex=0; |
my @alphabet = ('A'..'Z'); |
my @alphabet = ('A'..'Z'); |
Line 301 sub displayfoils {
|
Line 303 sub displayfoils {
|
my $break; |
my $break; |
my $solved=$Apache::lonhomework::history{"resource.$part.solved"}; |
my $solved=$Apache::lonhomework::history{"resource.$part.solved"}; |
my $status=$Apache::inputtags::status[-1]; |
my $status=$Apache::inputtags::status[-1]; |
if ( |
if ( ($target ne 'tex') && |
($target ne 'tex') && |
&Apache::response::show_answer() ) { |
(($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) ) { |
|
foreach $name (@whichopt) { |
foreach $name (@whichopt) { |
my $text=$Apache::response::foilgroup{$name.'.text'}; |
my $text=$Apache::response::foilgroup{$name.'.text'}; |
if ($text!~/^\s*$/) { |
if ($text!~/^\s*$/) { |
Line 326 sub displayfoils {
|
Line 327 sub displayfoils {
|
$result.=$text."\n"; |
$result.=$text."\n"; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$Apache::response::foilgroup{$name.'.text'}=~s/\\item//; |
$Apache::response::foilgroup{$name.'.text'}=~s/\\item//; |
$result .='\item \textit{'.$Apache::response::foilgroup{$name.'.value'}.'}'. |
if ($max>1) {$result .='\item ';} |
|
$result .=' \textit{'.$Apache::response::foilgroup{$name.'.value'}.'}'. |
":".$Apache::response::foilgroup{$name.'.text'}."\n"; |
":".$Apache::response::foilgroup{$name.'.text'}."\n"; |
} |
} |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
Line 340 sub displayfoils {
|
Line 342 sub displayfoils {
|
} else { |
} else { |
my $temp=1; |
my $temp=1; |
my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"}); |
my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"}); |
|
my $internal_counter=$Apache::lonxml::counter; |
foreach $name (@whichopt) { |
foreach $name (@whichopt) { |
my $text=$Apache::response::foilgroup{$name.'.text'}; |
my $text=$Apache::response::foilgroup{$name.'.text'}; |
if ($text!~/^\s*$/) { |
if ($text!~/^\s*$/) { |
Line 394 sub displayfoils {
|
Line 397 sub displayfoils {
|
} |
} |
} |
} |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
$result.='\vskip -2 mm\parbox{\textwidth}{\begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]\parbox{\textwidth - 5 mm}{'.&bubbles(\@alphabet,\@opt).'}\end{enumerate}} \vskip -9 mm \strut '; |
$result.='\vskip -2 mm\parbox{\textwidth}{\begin{enumerate}\item[\textbf{'.$internal_counter.'}.]\parbox{\textwidth - 5 mm}{'.&bubbles(\@alphabet,\@opt).'}\end{enumerate}} \vskip -9 mm \strut '; |
# $Apache::lonxml::counter++; |
$internal_counter++; |
} |
} |
$displayoptionintex=1; |
$displayoptionintex=1; |
} else { |
} else { |
Line 415 sub displayfoils {
|
Line 418 sub displayfoils {
|
} |
} |
} |
} |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
$result.='\vskip -2 mm \parbox{\textwidth}{\begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]\parbox{\textwidth - 5 mm}{'.&bubbles(\@alphabet,\@opt).'}\end{enumerate}} \vskip -9 mm \strut '; |
$result.='\vskip -2 mm \parbox{\textwidth}{\begin{enumerate}\item[\textbf{'.$internal_counter.'}.]\parbox{\textwidth - 5 mm}{'.&bubbles(\@alphabet,\@opt).'}\end{enumerate}} \vskip -9 mm \strut '; |
# $Apache::lonxml::counter++; |
$internal_counter++; |
} |
} |
} |
} |
} |
} |
Line 433 sub displayfoils {
|
Line 436 sub displayfoils {
|
sub optionlist_correction { |
sub optionlist_correction { |
|
|
my $texoptionlist = shift; |
my $texoptionlist = shift; |
$texoptionlist =~ s/<option><\/option>/\\item \[\] Possible answers are:/; |
if ($texoptionlist=~/<option selected/ or $texoptionlist=~/<option>[^<]+<\/option>/) { |
$texoptionlist =~ s/<option>/\{\\bf /g; |
$texoptionlist =~ s/<option><\/option>/\\item \[\] Choices: /; |
$texoptionlist =~ s/<option selected="on">/\{\\bf /g; |
$texoptionlist =~ s/<option>/\{\\bf /g; |
$texoptionlist =~ s/<\/option>/\},/g; |
$texoptionlist =~ s/<option selected="on">/\{\\bf /g; |
$texoptionlist =~ s/,$/\./g; |
$texoptionlist =~ s/<\/option>/\},/g; |
$texoptionlist =~ s/>/\$>\$/g; |
$texoptionlist =~ s/,$/\./g; |
$texoptionlist =~ s/</\$<\$/g; |
$texoptionlist =~ s/>/\$>\$/g; |
$texoptionlist =~ s/=/\$=\$/g; |
$texoptionlist =~ s/</\$<\$/g; |
$texoptionlist =~ s/\^(\d+)/<m>\$$1\$<\/m>/g; |
$texoptionlist =~ s/=/\$=\$/g; |
|
$texoptionlist =~ s/\^(\d+)/<m>\$$1\$<\/m>/g; |
|
} else { |
|
$texoptionlist =~ s/<option><\/option>/\\item \[\] \\vskip -5 mm/; |
|
} |
return $texoptionlist; |
return $texoptionlist; |
} |
} |
|
|
Line 615 sub end_foil {
|
Line 622 sub end_foil {
|
if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { |
if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { |
$Apache::response::conceptgroup{"$name.text"} = '\vskip 4 mm $\triangleright$ '.$text; |
$Apache::response::conceptgroup{"$name.text"} = '\vskip 4 mm $\triangleright$ '.$text; |
} else { |
} else { |
if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { |
$Apache::response::conceptgroup{"$name.text"} = $text; |
$Apache::response::conceptgroup{"$name.text"} = ' $\triangleright$ '.$text; |
|
} else { |
|
$Apache::response::conceptgroup{"$name.text"} = $text; |
|
} |
|
} |
} |
$Apache::response::conceptgroup{"$name.location"} = $location; |
$Apache::response::conceptgroup{"$name.location"} = $location; |
} else { |
} else { |
Line 628 sub end_foil {
|
Line 631 sub end_foil {
|
if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { |
if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { |
$Apache::response::foilgroup{"$name.text"} = '\vskip 5 mm $\triangleright$ '.$text; |
$Apache::response::foilgroup{"$name.text"} = '\vskip 5 mm $\triangleright$ '.$text; |
} else { |
} else { |
if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { |
$Apache::response::foilgroup{"$name.text"} = $text; |
$Apache::response::foilgroup{"$name.text"} = ' $\triangleright$ '.$text; |
|
} else { |
|
$Apache::response::foilgroup{"$name.text"} = $text; |
|
} |
|
} |
} |
$Apache::response::foilgroup{"$name.location"} = $location; |
$Apache::response::foilgroup{"$name.location"} = $location; |
} |
} |