Diff for /loncom/xml/lonxml.pm between versions 1.5 and 1.6

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

Removed from v.1.5  
changed lines
  Added in v.1.6


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>