--- loncom/xml/scripttag.pm 2000/09/14 20:57:49 1.14
+++ loncom/xml/scripttag.pm 2000/10/02 22:22:25 1.17
@@ -14,25 +14,38 @@ sub BEGIN {
sub start_script {
my ($target,$token,$parstack,$parser,$safeeval)=@_;
+ my $args ='';
+ if ( $#$parstack > -1 ) {
+ $args=$$parstack[$#$parstack];
+ }
+ my $type = &Apache::run::run("{$args;".'return $type}',$safeeval);
+ &Apache::lonxml::debug("found type of $type");
my $result="";
-# my $bodytext=$$parser[$#$parser]->get_text("/script");
- my $bodytext=&Apache::lonxml::get_all_text("script",$$parser[$#$parser]);
-
- if ( $target eq "modified" ) {
+ if ($type eq "loncapa/perl") {
+ $safeeval->share('$Apache::scripttag::start_script::result');
+ # my $bodytext=$$parser[$#$parser]->get_text("/script");
+ my $bodytext=&Apache::lonxml::get_all_text("script",$$parser[$#$parser]);
- }
-
-# print "
script runs $bodytext";
- $result = &Apache::run::run($bodytext,$safeeval);
+ if ( $target eq "modified" ) {
+
+ }
- if ($target eq "edit" ) {
- $result= "
<$token->[1]> output:
$bodytext
Source:
";
- $result.=&editfield($token->[1],$bodytext);
+ # print "
script runs $bodytext";
+ &Apache::run::run($bodytext,$safeeval);
+
+ if ($target eq "edit" ) {
+ $result= "
<$token->[1]> output:
$bodytext
Source:
";
+ $result.=&editfield($token->[1],$bodytext);
+ }
+ } else {
+ $result = $token->[4];
}
- return $result;
}
-sub end_script {}
+sub end_script {
+ my ($target,$token,$parstack,$parser,$safeeval)=@_;
+ return $token->[2];
+}
sub start_scriptlib {
my ($target,$token,$parstack,$parser,$safeeval)=@_;