--- loncom/xml/lonxml.pm 2004/08/10 18:25:53 1.335
+++ loncom/xml/lonxml.pm 2004/08/19 20:53:48 1.336
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.335 2004/08/10 18:25:53 sakharuk Exp $
+# $Id: lonxml.pm,v 1.336 2004/08/19 20:53:48 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1340,31 +1340,41 @@ sub debug {
}
sub error {
- $errorcount++;
- my $request=$Apache::lonxml::request;
- if (!$request) { $request=Apache->request; }
- if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
- # If printing in construction space, put the error inside
- push(@Apache::lonxml::error_messages,
- $Apache::lonxml::warnings_error_header.
- "ERROR:".join("
\n",@_)."
\n");
- $Apache::lonxml::warnings_error_header='';
- } else {
- push(@Apache::lonxml::error_messages,
- "An Error occured while processing this resource. The instructor has been notified.
");
- #notify author
- &Apache::lonmsg::author_res_msg($ENV{'request.filename'},join('
',@_));
- #notify course
- if ( $ENV{'request.course.id'} ) {
- my (undef,%users)=&Apache::lonfeedback::decide_receiver(undef,0,1,1,1);
- my $declutter=&Apache::lonnet::declutter($ENV{'request.filename'});
- foreach (keys %users) {
- my ($user,$domain) = split(/:/, $_);
- &Apache::lonmsg::user_normal_msg($user,$domain,
- "Error [$declutter]",join('
',@_));
- }
+ $errorcount++;
+ if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
+ # If printing in construction space, put the error inside
+ push(@Apache::lonxml::error_messages,
+ $Apache::lonxml::warnings_error_header.
+ "ERROR:".join("
\n",@_)."
\n");
+ $Apache::lonxml::warnings_error_header='';
+ } else {
+ my $errormsg;
+ my ($symb)=&Apache::lonnet::symbread();
+ if ( !$symb ) {
+ #public or browsers
+ $errormsg=&mt("An error occured while processing this resource. The author has been notified.");
+ }
+ #notify author
+ &Apache::lonmsg::author_res_msg($ENV{'request.filename'},join('
',@_));
+ #notify course
+ if ( $symb && $ENV{'request.course.id'} ) {
+ 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,
+ "Error [$declutter]",join('
',@_));
+ }
+ 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));
+ } else {
+ $errormsg=&mt("An error occured while processing this resource. The instructor has been notified.");
+ }
+ }
+ push(@Apache::lonxml::error_messages,"$errormsg
");
}
- }
}
sub warning {