version 1.72, 2001/05/04 21:17:24
|
version 1.75, 2001/05/13 21:40:32
|
Line 6
|
Line 6
|
# 6/1/1 Gerd Kortemeyer |
# 6/1/1 Gerd Kortemeyer |
# 2/21,3/13 Guy |
# 2/21,3/13 Guy |
# 3/29,5/4 Gerd Kortemeyer |
# 3/29,5/4 Gerd Kortemeyer |
|
# 5/10 Scott Harrison |
|
|
package Apache::lonxml; |
package Apache::lonxml; |
use vars |
use vars |
qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate); |
qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist); |
use strict; |
use strict; |
use HTML::TokeParser; |
use HTML::TokeParser; |
use Safe; |
use Safe; |
Line 56 $metamode = 0;
|
Line 57 $metamode = 0;
|
# turns on and of run::evaluate actually derefencing var refs |
# turns on and of run::evaluate actually derefencing var refs |
$evaluate = 1; |
$evaluate = 1; |
|
|
|
# data structure for eidt mode, determines what tags can go into what other tags |
|
%insertlist=(); |
|
|
sub xmlbegin { |
sub xmlbegin { |
my $output=''; |
my $output=''; |
Line 364 sub callsub {
|
Line 367 sub callsub {
|
&Apache::lonxml::debug("nodefalt:$nodefault:"); |
&Apache::lonxml::debug("nodefalt:$nodefault:"); |
if ($currentstring eq '' && $nodefault eq '') { |
if ($currentstring eq '' && $nodefault eq '') { |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
|
&Apache::lonxml::debug("doing default edit for $token->[1]"); |
if ($token->[0] eq 'S') { |
if ($token->[0] eq 'S') { |
$currentstring = &Apache::edit::tag_start($token,$target); |
$currentstring = &Apache::edit::tag_start($target,$token); |
} elsif ($token->[0] eq 'E') { |
} elsif ($token->[0] eq 'E') { |
$currentstring = &Apache::edit::tag_end($token,$target); |
$currentstring = &Apache::edit::tag_end($target,$token); |
} |
} |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
if ($token->[0] eq 'S') { |
if ($token->[0] eq 'S') { |
Line 611 sub debug {
|
Line 615 sub debug {
|
} |
} |
|
|
sub error { |
sub error { |
if ($Apache::lonxml::debug eq 1) { |
if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) { |
print "<b>ERROR:</b>".$_[0]."<br />\n"; |
print "<b>ERROR:</b>".$_[0]."<br />\n"; |
} else { |
} else { |
print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />"; |
print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />"; |
Line 625 sub error {
|
Line 629 sub error {
|
&Apache::lonmsg::user_normal_msg($user,$domain,"Error in $ENV{'request.filename'}",$_[0]); |
&Apache::lonmsg::user_normal_msg($user,$domain,"Error in $ENV{'request.filename'}",$_[0]); |
} |
} |
} |
} |
|
|
#FIXME probably shouldn't have me get everything forever. |
#FIXME probably shouldn't have me get everything forever. |
&Apache::lonmsg::user_normal_msg('albertel','msu',"Error in $ENV{'request.filename'}",$_[0]); |
&Apache::lonmsg::user_normal_msg('albertel','msu',"Error in $ENV{'request.filename'}",$_[0]); |
#&Apache::lonmsg::user_normal_msg('albertel','103',"Error in $ENV{'request.filename'}",$_[0]); |
#&Apache::lonmsg::user_normal_msg('albertel','103',"Error in $ENV{'request.filename'}",$_[0]); |
} |
} |
} |
} |
|
|
sub warning { |
sub warning { |
#if ($Apache::lonxml::debug eq 1) { |
if ($ENV{'request.state'} eq 'construct') { |
print "<b>W</b>ARNING<b>:</b>".$_[0]."<br />\n"; |
print "<b>W</b>ARNING<b>:</b>".$_[0]."<br />\n"; |
# } |
} |
|
} |
|
|
|
#Should allow multiple definitions of the same tag name |
|
sub register_insert2 { |
|
my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/lonTabs/insertlist.tab'); |
|
my $i; |
|
my @order; |
|
for ($i=0;$i < $#data; $i++) { |
|
my $line = $data[$i]; |
|
if ( $line =~ /^\#/ || $line =~ /^\s*\n/) { next; } |
|
if ( $line =~ /TABLE/ ) { last; } |
|
my ($tag,$descrip,$function,$show) = split(/,/, $line); |
|
if ($show eq 'no') { next; } |
|
$insertlist{"$i.tag"} = $tag; |
|
$insertlist{"$i.description"} = $descrip; |
|
$insertlist{"$i.function"} = $function; |
|
} |
|
for (;$i < $#data;$i++) { |
|
my $line = $data[$i]; |
|
my ($tag,@which) = split(/ +/,$line); |
|
for (my $j=0;$j <$#which;$j++) { |
|
if ( $which[$j] eq 'Y' ) { |
|
push(@{ $insertlist{"$tag.which"} },$j); |
|
} |
|
} |
|
} |
} |
} |
|
|
|
sub register_insert { |
|
my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/lonTabs/insertlist.tab'); |
|
my $i; |
|
my @order; |
|
for ($i=0;$i < $#data; $i++) { |
|
my $line = $data[$i]; |
|
if ( $line =~ /^\#/ || $line =~ /^\s*\n/) { next; } |
|
if ( $line =~ /TABLE/ ) { last; } |
|
my ($tag,$descrip,$function,$show) = split(/,/, $line); |
|
if ($show eq 'no') { next; } |
|
$insertlist{"$tag.description"} = $descrip; |
|
$insertlist{"$tag.function"} = $function; |
|
push (@order,$tag); |
|
} |
|
for (;$i < $#data;$i++) { |
|
my $line = $data[$i]; |
|
my ($tag,@which) = split(/ +/,$line); |
|
for (my $j=0;$j <$#which;$j++) { |
|
if ( $which[$j] eq 'Y' ) { |
|
push(@{ $insertlist{"$tag.which"} },$order[$j]); |
|
} |
|
} |
|
} |
|
} |
1; |
1; |
__END__ |
__END__ |
|
|