version 1.80, 2002/10/30 23:37:57
|
version 1.85, 2003/02/07 22:03:21
|
Line 43 BEGIN {
|
Line 43 BEGIN {
|
&Apache::lonxml::register('Apache::scripttag', |
&Apache::lonxml::register('Apache::scripttag', |
('script','scriptlib','parserlib','import', |
('script','scriptlib','parserlib','import', |
'window','display','storetc','physnet', |
'window','display','storetc','physnet', |
'standalone','comment')); |
'standalone','comment', |
|
'LONCAPA_INTERNAL_TURN_STYLE_ON')); |
|
} |
|
|
|
sub start_LONCAPA_INTERNAL_TURN_STYLE_ON { |
|
$Apache::lonxml::usestyle=1; |
|
return ('','no'); |
|
} |
|
|
|
sub end_LONCAPA_INTERNAL_TURN_STYLE_ON { |
|
return ('','no'); |
} |
} |
|
|
sub start_script { |
sub start_script { |
Line 53 sub start_script {
|
Line 63 sub start_script {
|
my $type= &Apache::lonxml::get_param('type',$parstack,$safeeval); |
my $type= &Apache::lonxml::get_param('type',$parstack,$safeeval); |
&Apache::lonxml::debug("found type of $type"); |
&Apache::lonxml::debug("found type of $type"); |
if ($type eq "loncapa/perl") { |
if ($type eq "loncapa/perl") { |
my $bodytext=&Apache::lonxml::get_all_text("/script",$$parser[$#$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' || |
Line 65 sub start_script {
|
Line 75 sub start_script {
|
&Apache::run::run($bodytext,$safeeval); |
&Apache::run::run($bodytext,$safeeval); |
if (($target eq 'answer') && ($Apache::lonhomework::viewgrades == 'F')) { |
if (($target eq 'answer') && ($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.="<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>"; |
my $listing= &HTML::Entities::encode(&Apache::run::dump($target,$safeeval)); |
my $listing= &HTML::Entities::encode(&Apache::run::dump($target,$safeeval)); |
|
|
$result.=$listing; |
$result.=$listing; |
$result.= "</pre></body></html>\');newWindow.document.close();void(0);\">Script Vars</a><br />"; |
$result.= "</pre></body></html>\');newWindow.document.close();void(0);\">Script Vars</a><br />"; |
} |
} |
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
#&Apache::run::run($bodytext,$safeeval); |
#&Apache::run::run($bodytext,$safeeval); |
Line 80 sub start_script {
|
Line 90 sub start_script {
|
} else { |
} else { |
if ($target ne "meta") { |
if ($target ne "meta") { |
$result = $token->[4]; |
$result = $token->[4]; |
my $bodytext=&Apache::lonxml::get_all_text("/script",$$parser[$#$parser]); |
my $bodytext=&Apache::lonxml::get_all_text("/script",$parser); |
$result.=$bodytext; |
$result.=$bodytext; |
} |
} |
} |
} |
Line 107 sub start_display {
|
Line 117 sub start_display {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
|
my $result; |
my $result; |
my $bodytext=&Apache::lonxml::get_all_text("/display",$$parser[$#$parser]); |
my $bodytext=&Apache::lonxml::get_all_text("/display",$parser); |
|
|
if ( $target eq "modified" ) { |
if ( $target eq "modified" ) { |
$result=$token->[4].&Apache::edit::modifiedfield(); |
$result=$token->[4].&Apache::edit::modifiedfield(); |
Line 166 sub start_scriptlib {
|
Line 176 sub start_scriptlib {
|
if ($target eq "edit" ) { |
if ($target eq "edit" ) { |
$result= |
$result= |
&Apache::edit::tag_start($target,$token,'New Script Functions'). |
&Apache::edit::tag_start($target,$token,'New Script Functions'). |
&Apache::edit::editline($token->[1],$bodytext,'',40). |
&Apache::edit::editline($token->[1],$bodytext,'scriptlib',40). |
|
&Apache::edit::browse(undef,'textnode'). |
$error.'</td></tr>'. |
$error.'</td></tr>'. |
&Apache::edit::end_table(); |
&Apache::edit::end_table(); |
} |
} |
Line 285 sub start_import {
|
Line 296 sub start_import {
|
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::editline($token->[1],$bodytext,'',40); |
$result.=&Apache::edit::editline($token->[1],$bodytext,'',40); |
|
$result.=&Apache::edit::browse(undef,'textnode'); |
#FIXME this need to convert $bodytext to be a contruction space reference |
#FIXME this need to convert $bodytext to be a contruction space reference |
#my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); |
#my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); |
#$result.="Click<a href=\"$location\">here</a> to edit<br />" |
#$result.="Click<a href=\"$location\">here</a> to edit<br />" |
Line 353 sub start_standalone {
|
Line 365 sub start_standalone {
|
my $result=''; |
my $result=''; |
if ($target eq 'web' ) { |
if ($target eq 'web' ) { |
if ( $ENV{'request.course.id'} ) { |
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 { |
} else { |
$result='<table bgcolor="#E1E1E1" border="2"><tr><td>'; |
$result='<table bgcolor="#E1E1E1" border="2"><tr><td>'; |
} |
} |
Line 378 sub start_comment {
|
Line 390 sub start_comment {
|
my $result=''; |
my $result=''; |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$result=&Apache::edit::tag_start($target,$token); |
$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) |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4) |
} elsif ( $target eq 'modified') { |
} elsif ( $target eq 'modified') { |
$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') { |
#normally throw away comments |
#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; |
return $result; |
} |
} |