--- loncom/imspackages/imsprocessor.pm 2005/05/03 18:38:37 1.20
+++ loncom/imspackages/imsprocessor.pm 2005/07/13 17:42:53 1.23
@@ -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#?p>##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#?p>##g;
}
@@ -3253,6 +3256,11 @@ sub write_webct4_questions {
|;
foreach my $numid (@{$$settings{$id}{numids}}) {
my $formula = $$settings{$id}{$numid}{formula};
+ $formula =~ s/ln/\&log/g;
+ $formula =~ s/sqrt/\&sqrt/g;
+ $formula =~ s/sin/\&sin/g;
+ $formula =~ s/cos/\&cos/g;
+ $formula =~ s/exp/\&exp/g;
foreach my $var (keys %{$$settings{$id}{$numid}{vars}}) {
my $decnum = $$settings{$id}{$numid}{vars}{$var}{dec};
my $increment = '0.';
@@ -3266,9 +3274,7 @@ sub write_webct4_questions {
}
$increment .= '1';
}
- $formula =~ s/{($var)}/\$$1/g;
- $formula =~ s/ln\(?([^\)])\)?/ &log($1) /g;
- $formula =~ s/sqrt/\&sqrt/g;
+ $formula =~ s/{($var)}/(\$$1)/g;
$scriptblock .= qq|
\$$var=&random($$settings{$id}{$numid}{vars}{$var}{min},$$settings{$id}{$numid}{vars}{$var}{max},$increment);
|;
@@ -3278,7 +3284,7 @@ sub write_webct4_questions {
|;
if ($context eq 'CSTR') {
- $output = $scriptblock.$output;
+ $output = "\n".$scriptblock.$output;
my $ansformat = '';
my $sigfig = '0,15';
if ($$settings{$id}{$numid}{format} eq 'sig') {