version 1.87, 2003/05/13 20:41:08
|
version 1.102, 2003/10/30 20:20:00
|
Line 45 BEGIN {
|
Line 45 BEGIN {
|
'window','display','storetc','physnet', |
'window','display','storetc','physnet', |
'standalone','comment', |
'standalone','comment', |
'LONCAPA_INTERNAL_TURN_STYLE_ON', |
'LONCAPA_INTERNAL_TURN_STYLE_ON', |
|
'LONCAPA_INTERNAL_TURN_STYLE_OFF', |
'LONCAPA_INTERNAL_LONHTTPD_PORT')); |
'LONCAPA_INTERNAL_LONHTTPD_PORT')); |
} |
} |
|
|
sub start_LONCAPA_INTERNAL_TURN_STYLE_ON { |
sub start_LONCAPA_INTERNAL_TURN_STYLE_ON { |
$Apache::lonxml::usestyle=1; |
$Apache::lonxml::usestyle=1; |
|
$Apache::lonxml::style_values=''; |
return ('','no'); |
return ('','no'); |
} |
} |
|
|
sub end_LONCAPA_INTERNAL_TURN_STYLE_ON { |
sub end_LONCAPA_INTERNAL_TURN_STYLE_ON { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
my $end=&Apache::lonxml::get_param('end',$parstack,$safeeval); |
|
if (defined($end)) { |
|
&Apache::lonxml::end_tag($tagstack,$parstack,$token); |
|
} |
|
return ('','no'); |
|
} |
|
|
|
sub start_LONCAPA_INTERNAL_TURN_STYLE_OFF { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
$Apache::lonxml::usestyle=0; |
|
my $end=&Apache::lonxml::get_param('end',$parstack,$safeeval); |
|
if (!$end) { |
|
$Apache::lonxml::style_values=$$parstack[-1]; |
|
$Apache::lonxml::style_end_values=$$parstack[-1]; |
|
} else { |
|
$Apache::lonxml::style_values=$Apache::lonxml::style_end_values; |
|
$Apache::lonxml::style_end_values=''; |
|
} |
|
return ('','no'); |
|
} |
|
|
|
sub end_LONCAPA_INTERNAL_TURN_STYLE_OFF { |
return ('','no'); |
return ('','no'); |
} |
} |
|
|
Line 81 sub start_script {
|
Line 106 sub start_script {
|
if ($type eq "loncapa/perl") { |
if ($type eq "loncapa/perl") { |
my $bodytext=&Apache::lonxml::get_all_text("/script",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/script",$parser); |
if ( $target eq "modified" ) { |
if ( $target eq "modified" ) { |
$result=$token->[4].&Apache::edit::modifiedfield(); |
$result=$token->[4].&Apache::edit::modifiedfield(); |
} elsif ( $target eq 'web' || $target eq 'tex' || |
} elsif ( $target eq 'web' || $target eq 'tex' || |
$target eq 'grade' || $target eq 'answer' || |
$target eq 'grade' || $target eq 'answer' || |
$target eq 'analyze' ) { |
$target eq 'analyze' ) { |
Line 89 sub start_script {
|
Line 114 sub start_script {
|
&Apache::lonxml::default_homework_load($safeeval); |
&Apache::lonxml::default_homework_load($safeeval); |
} |
} |
&Apache::run::run($bodytext,$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--; |
$Apache::lonxml::evaluate--; |
$result.="<a href=\"javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'<html><head><title>newwindow</title></head><body bgcolor="#FFFFFF"><pre>"; |
$result.="<script type=\"text/javascript\"> function LONCAPA_scriptvars_$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=500,height=200,scrollbars=1');newWindow.document.open('text/html','replace');newWindow.document.writeln('<html><head><title>Script Vars</title></head><body bgcolor=\"#FFFFFF\"><pre>"; |
my $listing= &HTML::Entities::encode(&Apache::run::dump($target,$safeeval)); |
my $listing=&Apache::run::dump($target,$safeeval); |
|
$listing=~s/\'/\\\'/g; |
|
$listing=~s/\n/\\n/g; |
|
$listing=~s/\r/\\r/g; |
$result.=$listing; |
$result.=$listing; |
$result.= "</pre></body></html>\');newWindow.document.close();void(0);\">Script Vars</a><br />"; |
$result.= "</pre></body></html>');newWindow.document.close();}</script><a href=\"javascript:LONCAPA_scriptvars_$Apache::lonxml::curdepth();void(0);\">Script Vars</a><br />"; |
if ($ENV{'form.print_answer'} eq 'yes') {$result='';} |
|
} |
} |
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
#&Apache::run::run($bodytext,$safeeval); |
#&Apache::run::run($bodytext,$safeeval); |
Line 149 sub start_display {
|
Line 177 sub start_display {
|
$target eq 'analyze') { |
$target eq 'analyze') { |
$result=''; # grade should produce no output |
$result=''; # grade should produce no output |
} |
} |
|
$Apache::lonxml::post_evaluate=0; |
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
#$result = |
#$result = |
# "<br /> <$token->[1]> output: <br />$bodytext<br />Source:<br />"; |
# "<br /> <$token->[1]> output: <br />$bodytext<br />Source:<br />"; |
Line 275 sub end_window {
|
Line 304 sub end_window {
|
my $result; |
my $result; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my $output=&Apache::lonxml::endredirection; |
my $output=&Apache::lonxml::endredirection; |
$output =~ s/\"/\"\;/g; |
$output =~ s/[\n\r]/ /g; |
$result = "<a href=\"javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'<html><head><title>newwindow</title></head><body bgcolor="#FFFFFF"> $output </body></html>\');newWindow.document.close();void(0);\"><sup>*</sup></a>"; |
# $output = &HTML::Entities::encode($output,'<>&"\''); |
|
$output =~ s/\'/\\\'/g; |
|
my $linktext= &Apache::lonxml::get_param('linktext',$parstack,$safeeval); |
|
if (!$linktext) { $linktext='<sup>*</sup>'; } |
|
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 = "<script type=\"text/javascript\"> function LONCAPA_newwindow_$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=$width,height=$height,scrollbars=1');newWindow.document.open('text/html','replace');newWindow.document.writeln('<html><head><title>newwindow</title></head><body bgcolor=\"#FFFFFF\"> $output </body></html>');newWindow.document.close();}</script><a href=\"javascript:LONCAPA_newwindow_$Apache::lonxml::curdepth();void(0);\">$linktext</a>"; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$result = '}'; |
$result = '}'; |
} else { |
} else { |
Line 309 sub start_import {
|
Line 346 sub start_import {
|
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
if (!$id) { $id=$Apache::lonxml::curdepth; } |
if (!$id) { $id=$Apache::lonxml::curdepth; } |
push(@Apache::inputtags::import,$id); |
push(@Apache::inputtags::import,$id); |
|
push(@Apache::inputtags::importlist,$id); |
|
|
&Apache::lonxml::newparser($parser,\$file,$dir); |
&Apache::lonxml::newparser($parser,\$file,$dir); |
|
|
Line 412 sub start_comment {
|
Line 450 sub start_comment {
|
my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser); |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4) |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4) |
} elsif ( $target eq 'modified') { |
} elsif ( $target eq 'modified') { |
|
my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser); |
$result=$token->[4].&Apache::edit::modifiedfield($token); |
$result=$token->[4].&Apache::edit::modifiedfield($token); |
} elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' || |
} elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' || |
$target eq 'answer' || $target eq 'meta' || $target eq 'analyze') { |
$target eq 'answer' || $target eq 'meta' || $target eq 'analyze') { |
Line 430 sub end_comment {
|
Line 469 sub end_comment {
|
|
|
sub xmlparse { |
sub xmlparse { |
my ($string) = @_; |
my ($string) = @_; |
&Apache::lonxml::debug("Got $string"); |
# &Apache::lonxml::debug("Got $string"); |
my ($target,$token,$tagstack,$parstack,$oldparser,$safeeval,$style)= |
my ($target,$token,$tagstack,$parstack,$oldparser,$safeeval,$style)= |
@Apache::scripttag::parser_env; |
@Apache::scripttag::parser_env; |
my @parser; |
my @parser; |