--- loncom/xml/scripttag.pm 2001/01/04 19:15:02 1.29 +++ loncom/xml/scripttag.pm 2001/02/19 20:43:00 1.33 @@ -10,7 +10,7 @@ use Apache::lonnet; sub BEGIN { &Apache::lonxml::register('Apache::scripttag',('script','scriptlib', 'parserlib','import', - 'footnote','display')); + 'window','display')); } sub start_script { @@ -24,12 +24,11 @@ sub start_script { my $bodytext=&Apache::lonxml::get_all_text("/script",$$parser[$#$parser]); if ( $target eq "modified" ) { - } elsif ( $target eq "web" || $target eq "grade" ) { &Apache::run::run($bodytext,$safeeval); } elsif ($target eq "edit" ) { &Apache::run::run($bodytext,$safeeval); - $result="
<$token->[1]> output:
$bodytext
Source:
"; + $result="
<$token->[1]> output:
$bodytext
Source:
"; $result.=&editfield($token->[1],$bodytext); } } else { @@ -67,7 +66,7 @@ sub start_display { } if ($target eq "edit" ) { $result = - "
<$token->[1]> output:
$bodytext
Source:
"; + "
<$token->[1]> output:
$bodytext
Source:
"; $result.=&editfield($token->[1],$bodytext); } return $result; @@ -91,7 +90,7 @@ sub start_scriptlib { return ""; } &Apache::run::run($script,$safeeval); - #&Apache::lonxml::debug("ran $bodytext:
".&Apache::lonnet::getfile($bodytext)."
"); + #&Apache::lonxml::debug("ran $bodytext:
".&Apache::lonnet::getfile($bodytext)."
"); if ($target eq "edit" ) { $result.=&editfield($token->[1],$bodytext); @@ -127,19 +126,26 @@ sub start_parserlib { sub end_parserlib { } -sub start_footnote { +sub start_window { my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; my $result = ''; - $Apache::lonxml::redirection = 0; + if ($target eq 'web') { + $Apache::lonxml::redirection = 0; + } return $result; } -sub end_footnote { +sub end_window { my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; - $Apache::lonxml::outputstack =~ s/\"/\"\;/g; - my $result = "newwindow $Apache::lonxml::outputstack \');newWindow.document.close();void(0);\">*"; - $Apache::lonxml::outputstack = ""; - $Apache::lonxml::redirection = 1; + my $result; + if ($target eq 'web') { + $Apache::lonxml::outputstack =~ s/\"/\"\;/g; + $result = "newwindow $Apache::lonxml::outputstack \');newWindow.document.close();void(0);\">*"; + $Apache::lonxml::outputstack = ""; + $Apache::lonxml::redirection = 1; + } else { + $result = ''; + } return $result; } @@ -157,12 +163,13 @@ sub start_import { } my $dir=$location; - $dir=~s:/[^/]*$::; + $dir=~s:/[^/]*$::; +# &Apache::lonxml::debug("directory $dir $location file $file \nEND\n"); &Apache::lonxml::newparser($parser,\$file,$dir); if ($target eq "edit" ) { $result.=&editfield($token->[1],$bodytext); - $result.="Clickhere to edit

" + $result.="Clickhere to edit
" } return ''; } @@ -170,6 +177,21 @@ sub start_import { sub end_import { } +sub start_meta { + my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; + my $result = ''; + if ($target ne 'meta') { + $result = &Apache::lonxml::get_all_text("/meta",$$parser[$#$parser]); + $result = ''; + return $result; + } else { + return $result; + } +} + +sub end_meta { +} + sub editfield { my ($tag,$data)=@_; @@ -179,7 +201,7 @@ sub editfield { if (length($_) > $maxlength) { $maxlength = length ($_); } } split ("\n", $data); - return "

\n<$tag>

\n   

\n</$tag>

\n"; + return "
\n<$tag>
\n   
\n</$tag>
\n"; } sub getfilenothere {