--- loncom/xml/lonxml.pm 2005/06/24 21:09:31 1.378 +++ loncom/xml/lonxml.pm 2005/09/14 19:20:23 1.382 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.378 2005/06/24 21:09:31 albertel Exp $ +# $Id: lonxml.pm,v 1.382 2005/09/14 19:20:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -180,8 +180,8 @@ sub xmlend { $status=$Apache::inputtags::status[-1]; } my $discussion; - &Apache::loncommon::get_unprocessed_cgi - ($env{'query_string'},['LONCAPA_INTERNAL_no_discussion']); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['LONCAPA_INTERNAL_no_discussion']); if (! exists($env{'form.LONCAPA_INTERNAL_no_discussion'}) || $env{'form.LONCAPA_INTERNAL_no_discussion'} ne 'true') { $discussion=&Apache::lonfeedback::list_discussion($mode,$status); @@ -818,7 +818,7 @@ sub startredirection { sub endredirection { if (!$Apache::lonxml::redirection) { - &Apache::lonxml::error("Endredirection was called, before a startredirection, perhaps you have unbalanced tags. Some debuging information:".join ":",caller); + &Apache::lonxml::error("Endredirection was called before a startredirection, perhaps you have unbalanced tags. Some debugging information:".join ":",caller); return ''; } $Apache::lonxml::redirection--; @@ -893,7 +893,11 @@ sub get_all_text_unbalanced { $tag='<'.$tag.'>'; while ($token = $$pars[-1]->get_token) { if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) { - $result.=$token->[1]; + if ($token->[2]) { + $result.='[1].']]>'; + } else { + $result.=$token->[1]; + } } elsif ($token->[0] eq 'PI') { $result.=$token->[2]; } elsif ($token->[0] eq 'S') { @@ -959,7 +963,11 @@ sub get_all_text { while (($depth >=0) && ($token = $$pars[-1]->get_token)) { #&Apache::lonxml::debug("e token:$token->[0]:$depth:$token->[1]:".$#$pars.":".$#Apache::lonxml::pwd); if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) { - $result.=$token->[1]; + if ($token->[2]) { + $result.='[1].']]>'; + } else { + $result.=$token->[1]; + } } elsif ($token->[0] eq 'PI') { $result.=$token->[2]; } elsif ($token->[0] eq 'S') { @@ -1011,7 +1019,11 @@ sub get_all_text { #&Apache::lonxml::debug("s token:$token->[0]:$depth:$token->[1]"); if (($token->[0] eq 'T')||($token->[0] eq 'C')|| ($token->[0] eq 'D')) { - $result.=$token->[1]; + if ($token->[2]) { + $result.='[1].']]>'; + } else { + $result.=$token->[1]; + } } elsif ($token->[0] eq 'PI') { $result.=$token->[2]; } elsif ($token->[0] eq 'S') { @@ -1148,7 +1160,6 @@ sub createnewhtml { my $title=&mt('Title of document goes here'); my $body=&mt('Body of document goes here'); my $filecontents=(< $title @@ -1337,7 +1348,7 @@ ENDNOTFOUND } else { unless ($env{'request.state'} eq 'published') { if ($filecontents=~/BEGIN LON-CAPA Internal/) { - &Apache::lonxml::error(&mt('This file appears to be a rendering of a Lon-CAPA resource. If this is correct, this resource will act very oddly and incorrectly.')); + &Apache::lonxml::error(&mt('This file appears to be a rendering of a LON-CAPA resource. If this is correct, this resource will act very oddly and incorrectly.')); } # # we are in construction space, see if edit mode forced @@ -1432,14 +1443,26 @@ sub error { &Apache::lonmsg::author_res_msg($env{'request.filename'},join('
',@_)); #notify course if ( $symb && $env{'request.course.id'} ) { + my $cnum=$env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my (undef,%users)=&Apache::lonfeedback::decide_receiver(undef,0,1,1,1); my $declutter=&Apache::lonnet::declutter($env{'request.filename'}); my @userlist; foreach (keys %users) { my ($user,$domain) = split(/:/, $_); push(@userlist,"$user\@$domain"); - &Apache::lonmsg::user_normal_msg($user,$domain, + my $key=$declutter.'_'.$user.'_'.$domain; + my %lastnotified=&Apache::lonnet::get('nohist_xmlerrornotifications', + [$key], + $cdom,$cnum); + my $now=time; + if ($now-$lastnotified{$key}>86400) { + &Apache::lonmsg::user_normal_msg($user,$domain, "Error [$declutter]",join('
',@_)); + &Apache::lonnet::put('nohist_xmlerrornotifications', + {$key => $now}, + $cdom,$cnum); + } } if ($env{'request.role.adv'}) { $errormsg=&mt("An error occured while processing this resource. The course personnel ([_1]) and the author have been notified.",join(', ',@userlist));