--- loncom/homework/structuretags.pm 2002/09/23 17:25:24 1.116 +++ loncom/homework/structuretags.pm 2002/10/17 17:34:10 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.116 2002/09/23 17:25:24 albertel Exp $ +# $Id: structuretags.pm,v 1.128 2002/10/17 17:34:10 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,6 +163,13 @@ sub problem_web_to_edit_header { if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } $result.= ' /> Show All Foils
]*)>//g;
- $string =~ s/<\/td>//g;
- $string =~ s//\\textbf{/g;
- $string =~ s/<\/b>/}/g;
- $string =~ s/ /\\vskip 0 mm /g; - $string =~ s/]*)>//g; - return $string; -} sub start_library { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; @@ -491,7 +483,7 @@ sub end_library { sub start_block { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { my $code = @$parstack[$#$parstack]; $code =~ s/\"//g; $code .=';return $condition;'; @@ -548,7 +540,7 @@ sub start_randomlist { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result; if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' || - $target eq 'tex') { + $target eq 'tex' || $target eq 'analyze') { my $body= &Apache::lonxml::get_all_text("/randomlist",$$parser[$#$parser]); my $b_parser= HTML::TokeParser->new(\$body); my $b_tok; @@ -601,7 +593,7 @@ sub shuffle { if (defined(@$a)) { &Apache::response::setrandomnumber(); for($i=@$a;--$i;) { - my $j=int rand($i+1); + my $j=int(&Math::Random::random_uniform() * ($i+1)); next if $i == $j; @$a[$i,$j] = @$a[$j,$i]; } @@ -638,11 +630,11 @@ sub start_part { if ( $target eq "web" ) { $result=" Part is not open to be viewed. It $accessmsg "; } elsif ( $target eq 'tex' ) { - $result="\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\"; + $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}"; } } else { if ($target eq 'tex') { - $result='\vskip 0 mm'; + $result='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; } } } @@ -659,9 +651,8 @@ sub end_part { return &Apache::inputtags::grade; } if ($target eq 'web' || $target eq 'tex' ) { - my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part); - #FIXME this is ugly we should just generate tex in inputtags - if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); } + my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,$target); + if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';} return $gradestatus; } return ''; |