--- loncom/xml/lonxml.pm 2000/06/27 20:33:54 1.5 +++ loncom/xml/lonxml.pm 2000/06/29 13:58:23 1.6 @@ -11,6 +11,7 @@ use Safe; use Apache::style; use Apache::lontexconvert; use Apache::londefdef; +use Apache::run; #================================================== Main subroutine: xmlparse sub xmlparse { @@ -23,7 +24,7 @@ sub xmlparse { my $tempostring = ''; my $tempocont = ''; my $safeeval = new Safe; - + $safeeval->permit("entereval"); #-------------------- Redefinition of the target in the case of compound target ($target, my @tenta) = split('&&',$target); @@ -49,22 +50,23 @@ sub xmlparse { push (@parstack,$tempostring); $tempostring = ''; - if (exists $style_for_target{$token->[1]}) { - + if (exists $style_for_target{$token->[1]}) { +# print "Style for $token->[1] is " .$style_for_target{$token->[1]}."\n"; #---------------------------------------------------- use style file definition $newarg = $style_for_target{$token->[1]}; if (index($newarg,'script') != -1 ) { my $pat = HTML::TokeParser->new(\$newarg); - my $tokenpat; + my $tokenpat = ''; my $partstring = ''; my $oustring = ''; my $outputstring; while ($tokenpat = $pat->get_token) { if ($tokenpat->[0] eq 'T') { - $oustring .= $tokenpat->[1]; +# print "evaluating $tokenpat->[4]\n"; + $oustring .= &Apache::run::evaluate($tokenpat->[1],$safeeval); } elsif ($tokenpat->[0] eq 'S') { if ($tokenpat->[1] eq 'script') { while ($tokenpat = $pat->get_token and $tokenpat->[1] ne 'script') { @@ -78,17 +80,16 @@ sub xmlparse { } map {$partstring =~ s/\$$_/$token->[2]->{$_}/g; } @{$token->[3]}; - - &run($partstring,$safeeval); +# print "want to use run\n"; + &Apache::run::run($partstring,$safeeval); $partstring = ''; - } elsif ($tokenpat->[1] eq 'evaluate') { - $outputstring = &evaluate($tokenpat->[2]{expression},$safeeval); - $oustring .= $outputstring; } else { - $oustring .= $tokenpat->[4]; +# print "evaluating $tokenpat->[4]\n"; + $oustring .= &Apache::run::evaluate($tokenpat->[4],$safeeval); } } elsif ($tokenpat->[0] eq 'E' and $tokenpat->[1] ne 'evaluate') { +# print "hereish\n"; $oustring .= $tokenpat->[1]; } } @@ -162,12 +163,12 @@ sub xmlparse { map {(my $onete,my $twote) = split('=',$_); push (@te_kl,$onete); $tempor_hash{$onete} = $twote} @tempor_list; map {$partstring =~ s/\$$_/$tempor_hash{$_}/g; } @te_kl; - - &run($partstring,$safeeval); + print "want to use run\n"; + &Apache::run::run($partstring,$safeeval); $partstring = ''; } elsif ($tokenpat->[1] eq 'evaluate') { - $outputstring = &evaluate($tokenpat->[2]{expression},$safeeval); + $outputstring = &Apache::run::evaluate($tokenpat->[2]{expression},$safeeval); $oustring .= $outputstring; } else { $oustring .= $tokenpat->[4];