version 1.1, 2000/07/25 21:27:30
|
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; |
use Apache::lonnet; |
use Apache::lonnet; |
|
|
sub BEGIN { |
sub BEGIN { |
&Apache::lonxml::register('Apache::structuretags',('block')); |
&Apache::lonxml::register('Apache::structuretags',('block','while')); |
} |
} |
|
|
sub start_block { |
sub start_block { |
Line 17 sub start_block {
|
Line 16 sub start_block {
|
my $code = @$parstack[$#$parstack]; |
my $code = @$parstack[$#$parstack]; |
$code =~ s/\"//g; |
$code =~ s/\"//g; |
$code .=';return $condition;'; |
$code .=';return $condition;'; |
|
# print "<br>$code<br>"; |
my $result = &Apache::run::run($code,$safeeval); |
my $result = &Apache::run::run($code,$safeeval); |
if ( ! $result ) { |
if ( ! $result ) { |
my $skip=$parser->get_text("/block"); |
# my $skip=$$parser[$#$parser]->get_text("/block"); |
|
my $skip=&Apache::lonxml::get_all_text("block",$$parser[$#$parser]); |
|
# print "skipped $skip"; |
} |
} |
return ""; |
return ""; |
} |
} |
Line 27 sub start_block {
|
Line 29 sub start_block {
|
sub end_block { |
sub end_block { |
} |
} |
|
|
|
sub start_while { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
|
|
my $code = @$parstack[$#$parstack]; |
|
$code =~ s/\"//g; |
|
$code .=';return $condition;'; |
|
|
|
push( @Apache::structuretags::whileconds, $code); |
|
my $result = &Apache::run::run($code,$safeeval); |
|
my $bodytext=$$parser[$#$parser]->get_text("/while"); |
|
push( @Apache::structuretags::whilebody, $bodytext); |
|
if ( $result ) { |
|
my $tempparser=HTML::TokeParser->new(\$bodytext); |
|
push (@$parser,$tempparser); |
|
} |
|
|
|
return ""; |
|
} |
|
|
|
sub end_while { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
my $code = pop @Apache::structuretags::whileconds; |
|
my $bodytext = pop @Apache::structuretags::whilebody; |
|
my $result = &Apache::run::run($code,$safeeval); |
|
if ( $result ) { |
|
my $tempparser=HTML::TokeParser->new(\$bodytext); |
|
push (@$parser,$tempparser); |
|
} |
|
return ""; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |