--- loncom/xml/scripttag.pm 2003/01/13 22:18:34 1.84 +++ loncom/xml/scripttag.pm 2003/06/09 21:37:54 1.97 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # '; + } + return ('','no'); +} + +sub end_LONCAPA_INTERNAL_LONHTTPD_PORT { return ('','no'); } @@ -73,7 +95,9 @@ sub start_script { &Apache::lonxml::default_homework_load($safeeval); } &Apache::run::run($bodytext,$safeeval); - if (($target eq 'answer') && ($Apache::lonhomework::viewgrades == 'F')) { + if (($target eq 'answer') && + ($ENV{'form.answer_output_mode'} ne 'tex') && + ($Apache::lonhomework::viewgrades == 'F')) { $Apache::lonxml::evaluate--; $result.="[4]; - my $bodytext=&Apache::lonxml::get_all_text("/script",$$parser[$#$parser]); + my $bodytext=&Apache::lonxml::get_all_text("/script",$parser); $result.=$bodytext; } } @@ -258,8 +282,16 @@ sub end_window { my $result; if ($target eq 'web') { my $output=&Apache::lonxml::endredirection; - $output =~ s/\"/\"\;/g; - $result = "newwindow $output \');newWindow.document.close();void(0);\">*"; + $output =~ s/[\n\r]/ /g; + $output = &HTML::Entities::encode($output,'<>&"\''); + $output =~ s/&/\\&/g; + my $linktext= &Apache::lonxml::get_param('linktext',$parstack,$safeeval); + if (!$linktext) { $linktext='*'; } + my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval); + if (!$width) { $width='500'; } + my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval); + if (!$height) { $height='200'; } + $result = "newwindow $output \');newWindow.document.close();void(0);\">$linktext"; } elsif ($target eq 'tex') { $result = '}'; } else { @@ -292,7 +324,10 @@ sub start_import { my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); if (!$id) { $id=$Apache::lonxml::curdepth; } push(@Apache::inputtags::import,$id); - &Apache::lonxml::newparser($parser,\$file,$dir); + push(@Apache::inputtags::importlist,$id); + + &Apache::lonxml::newparser($parser,\$file,$dir); + } elsif ($target eq "edit" ) { $result.=&Apache::edit::tag_start($target,$token); $result.=&Apache::edit::editline($token->[1],$bodytext,'',40); @@ -365,7 +400,7 @@ sub start_standalone { my $result=''; if ($target eq 'web' ) { if ( $ENV{'request.course.id'} ) { - my $inside = &Apache::lonxml::get_all_text("/standalone",$$parser[-1]); + my $inside = &Apache::lonxml::get_all_text("/standalone",$parser); } else { $result='
'; } @@ -390,14 +425,14 @@ sub start_comment { my $result=''; if ($target eq 'edit') { $result=&Apache::edit::tag_start($target,$token); - my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]); + my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser); $result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4) } elsif ( $target eq 'modified') { $result=$token->[4].&Apache::edit::modifiedfield($token); } elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' || $target eq 'answer' || $target eq 'meta' || $target eq 'analyze') { #normally throw away comments - my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]); + my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser); } return $result; } @@ -411,7 +446,7 @@ sub end_comment { sub xmlparse { my ($string) = @_; - &Apache::lonxml::debug("Got $string"); +# &Apache::lonxml::debug("Got $string"); my ($target,$token,$tagstack,$parstack,$oldparser,$safeeval,$style)= @Apache::scripttag::parser_env; my @parser;