--- loncom/xml/lonxml.pm 2001/05/10 19:10:25 1.73
+++ loncom/xml/lonxml.pm 2001/05/13 20:01:11 1.74
@@ -10,7 +10,7 @@
package Apache::lonxml;
use vars
-qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate);
+qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist);
use strict;
use HTML::TokeParser;
use Safe;
@@ -57,6 +57,8 @@ $metamode = 0;
# turns on and of run::evaluate actually derefencing var refs
$evaluate = 1;
+# data structure for eidt mode, determines what tags can go into what other tags
+%insertlist=();
sub xmlbegin {
my $output='';
@@ -365,10 +367,11 @@ sub callsub {
&Apache::lonxml::debug("nodefalt:$nodefault:");
if ($currentstring eq '' && $nodefault eq '') {
if ($target eq 'edit') {
+ &Apache::lonxml::debug("doing default edit for $token->[1]");
if ($token->[0] eq 'S') {
- $currentstring = &Apache::edit::tag_start($token,$target);
+ $currentstring = &Apache::edit::tag_start($target,$token);
} elsif ($token->[0] eq 'E') {
- $currentstring = &Apache::edit::tag_end($token,$target);
+ $currentstring = &Apache::edit::tag_end($target,$token);
}
} elsif ($target eq 'modified') {
if ($token->[0] eq 'S') {
@@ -612,7 +615,7 @@ sub debug {
}
sub error {
- if ($Apache::lonxml::debug eq 1) {
+ if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
print "ERROR:".$_[0]."
\n";
} else {
print "An Error occured while processing this resource. The instructor has been notified.
";
@@ -626,10 +629,10 @@ sub error {
&Apache::lonmsg::user_normal_msg($user,$domain,"Error in $ENV{'request.filename'}",$_[0]);
}
}
-
+
#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','103',"Error in $ENV{'request.filename'}",$_[0]);
+ #&Apache::lonmsg::user_normal_msg('albertel','103',"Error in $ENV{'request.filename'}",$_[0]);
}
}
@@ -639,6 +642,30 @@ sub warning {
}
}
+sub register_insert {
+ my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/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;
__END__