--- loncom/xml/scripttag.pm 2001/06/02 03:59:59 1.40 +++ loncom/xml/scripttag.pm 2001/07/11 14:44:37 1.45 @@ -6,11 +6,13 @@ package Apache::scripttag; use strict; use Apache::lonnet; +use Apache::style; sub BEGIN { &Apache::lonxml::register('Apache::scripttag',('script','scriptlib', 'parserlib','import', - 'window','display')); + 'window','display', + 'storetc','physnet')); } sub start_script { @@ -20,15 +22,15 @@ sub start_script { &Apache::lonxml::debug("found type of $type"); if ($type eq "loncapa/perl") { my $bodytext=&Apache::lonxml::get_all_text("/script",$$parser[$#$parser]); - if ( $target eq "modified" ) { - $result=$token->[4].$bodytext; + $result=$token->[4].&Apache::edit::modifiedfield(); } 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.=&Apache::edit::editfield($token->[1],$bodytext,'',50,5); + #&Apache::run::run($bodytext,$safeeval); + #$result="
<$token->[1]> output:
$bodytext
Source:
"; + $result=&Apache::edit::tag_start($target,$token,'Script'); + $result.=&Apache::edit::editfield($token->[1],$bodytext,'',50,4); } } else { if ($target ne "meta") { $result = $token->[4]; } @@ -43,6 +45,7 @@ sub end_script { my $result=''; #other script blocks need to survive if ($type ne "loncapa/perl") { return $token->[2]; } + if ($target eq 'edit' ) { return &Apache::edit::end_table(); } return ''; } @@ -120,7 +123,6 @@ sub start_parserlib { my $bodytext; my $result =""; my $error=''; - if ($target eq 'web' || $target eq 'grade' || $target eq 'meta' || $target eq 'edit') { $bodytext=$$parser[$#$parser]->get_text("/parserlib"); $bodytext=&Apache::run::evaluate($bodytext,$safeeval, @@ -168,7 +170,7 @@ sub start_window { if ($target eq 'web') { &Apache::lonxml::startredirection; } elsif ($target eq 'tex') { - $result = '\footnote{'; + $result = '\unskip\footnote{'; } return $result; } @@ -214,6 +216,7 @@ sub start_import { } sub end_import { + return ''; } sub start_meta { @@ -231,5 +234,39 @@ sub start_meta { sub end_meta { } +sub start_storetc { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + my $result = ''; + &Apache::lonxml::startredirection; + return $result; +} + +sub end_storetc { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + my $result; + my $output=&Apache::lonxml::endredirection; + $output =~ s/\"/\"\;/g; + $result = "{\bf $output.}}\write\tcfile{\protect\tcpc{ $output.}{\the\value{relpage}}}"; + return $result; +} + + +sub start_physnet { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + my $bodytext = '/msu/physnet/cbi.sty'; + my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); + my $cbistyletext=&Apache::lonnet::getfile($location); + + %$style = (%$style,&Apache::style::styleparser($target,$cbistyletext)); + if ( defined($$style{'physnet'}) ) { + &Apache::lonxml::newparser($parser,\$$style{'physnet'}); + } + return ""; +} + +sub end_physnet { +} + + 1; __END__