--- loncom/imspackages/imsprocessor.pm 2005/05/03 18:38:37 1.20 +++ loncom/imspackages/imsprocessor.pm 2005/07/13 19:56:37 1.24 @@ -24,6 +24,7 @@ package Apache::imsprocessor; use Apache::lonnet; +use Apache::loncleanup; use LWP::UserAgent; use HTTP::Request::Common; use LONCAPA::Configuration; @@ -2864,7 +2865,7 @@ sub write_webct4_questions { } if ($$settings{$id}{texttype} eq 'text/html') { $$settings{$id}{text} = &HTML::Entities::decode($$settings{$id}{text}); - $$settings{$id}{text} = &Apache::lonxml::htmlclean($$settings{$id}{text}); + $$settings{$id}{text} = &Apache::loncleanup::htmlclean($$settings{$id}{text}); $$settings{$id}{text} =~ s#(]+)(/?>)#$1../../resfiles/$2 />#gi; $$settings{$id}{text} =~ s#<([bh])r>#<$1r />#g; # $$settings{$id}{text} =~ s#

#

#g; @@ -2892,8 +2893,10 @@ sub write_webct4_questions { $resourcedata{$symb.'randomize'} = 'yes'; $resourcedata{$symb.'maxfoils'} = 10; if ($context eq 'CSTR') { - $output = qq| + unless ($$settings{$id}{class} eq 'numerical') { + $output = qq| |; + } } $$total{prob} ++; if (exists($$settings{$id}{uri})) { @@ -2954,7 +2957,7 @@ sub write_webct4_questions { } if ($$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{texttype} eq 'text/html') { $$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text} = &HTML::Entities::decode($$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text}); - $$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text} = &Apache::lonxml::htmlclean($$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text}); + $$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text} = &Apache::loncleanup::htmlclean($$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text}); $$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text} =~ s#(]+)>#$1../../resfiles/$2 />#gi; $$settings{$id}{$list}{$$allanswers{$id}{$list}[$k]}{text} =~ s###g; @@ -3028,7 +3031,7 @@ sub write_webct4_questions { $$settings{$id}{$grp}{$answer_id}{text} = &HTML::Entities::decode($$settings{$id}{$grp}{$answer_id}{text}); $test_for_html = &test_for_html($$settings{$id}{$grp}{$answer_id}{text}); - $$settings{$id}{$grp}{$answer_id}{text} = &Apache::lonxml::chtmlclean($$settings{$id}{$grp}{$answer_id}{text}); + $$settings{$id}{$grp}{$answer_id}{text} = &Apache::loncleanup::htmlclean($$settings{$id}{$grp}{$answer_id}{text}); $$settings{$id}{$grp}{$answer_id}{text} =~ s#(]+)>#$1../../resfiles/$2 />#gi; $$settings{$id}{$$allchoices{$id}[$k]}{text} =~ s###g; } @@ -3248,11 +3251,34 @@ sub write_webct4_questions { } } } elsif ($$settings{$id}{class} eq 'numerical') { + my %mathfns = ( + 'abs' => 'abs', + 'acos' => 'acos', + 'asin' => 'asin', + 'atan' => 'atan', + 'ceil' => 'ceil', + 'cos' => 'cos', + 'exp' => 'exp', + 'fact' => 'factorial', + 'floor' => 'floor', + 'int' => 'int', + 'ln' => 'log', + 'log' => 'log', + 'max' => 'max', + 'min' => 'min', + 'round' => 'roundto', + 'sin' => 'sin', + 'sqrt' => 'sqrt', + 'tan' => 'tan', + ); + my $scriptblock = qq| |; if ($context eq 'CSTR') { - $output = $scriptblock.$output; + $output = "\n".$scriptblock.$output; my $ansformat = ''; my $sigfig = '0,15'; if ($$settings{$id}{$numid}{format} eq 'sig') {