Diff for /loncom/xml/lonxml.pm between versions 1.73 and 1.74

version 1.73, 2001/05/10 19:10:25 version 1.74, 2001/05/13 20:01:11
Line 10 Line 10
   
 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 57  $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 365  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 612  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 626  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]);
   }    }
 }  }
   
Line 639  sub warning { Line 642  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;  1;
 __END__  __END__
   

Removed from v.1.73  
changed lines
  Added in v.1.74


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>