version 1.4, 2000/08/22 16:19:26
|
version 1.5, 2000/08/25 14:40:47
|
Line 1
|
Line 1
|
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# <script> definiton |
# <script> definiton |
|
|
|
|
package Apache::structuretags; |
package Apache::structuretags; |
|
|
use strict; |
use strict; |
Line 37 sub start_while {
|
Line 36 sub start_while {
|
$code =~ s/\"//g; |
$code =~ s/\"//g; |
$code .=';return $condition;'; |
$code .=';return $condition;'; |
|
|
print "<H2>WHILE CONDITION = [$code]</H2>"; |
push( @Apache::structuretags::whileconds, $code); |
my $result = &Apache::run::run($code,$safeeval); |
my $result = &Apache::run::run($code,$safeeval); |
my $bodytext=$$parser[$#$parser]->get_text("/while"); |
my $bodytext=$$parser[$#$parser]->get_text("/while"); |
if ( $result ) { # condition is TRUE, bodytext is evaluated |
push( @Apache::structuretags::whilebody, $bodytext); |
# push the bodytext into parser stack |
if ( $result ) { |
my $tempparser=HTML::TokeParser->new(\$bodytext); |
my $tempparser=HTML::TokeParser->new(\$bodytext); |
push (@$parser,$tempparser); |
push (@$parser,$tempparser); |
} else { # condition is FALSE initially, skip bodytext |
|
} |
} |
|
|
return ""; |
return ""; |
} |
} |
|
|
sub end_while { |
sub end_while { |
# pop parser from parser stack |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
# check if condition is TRUE, |
my $code = pop @Apache::structuretags::whileconds; |
# TRUE then push content into parser stack |
my $bodytext = pop @Apache::structuretags::whilebody; |
# FALSE then continue |
my $result = &Apache::run::run($code,$safeeval); |
|
if ( $result ) { |
|
my $tempparser=HTML::TokeParser->new(\$bodytext); |
|
push (@$parser,$tempparser); |
|
} |
|
return ""; |
} |
} |
|
|
1; |
1; |