--- loncom/xml/lonxml.pm 2001/02/13 00:15:49 1.51
+++ loncom/xml/lonxml.pm 2001/02/19 20:40:55 1.54
@@ -236,13 +236,13 @@ sub callsub {
my $sub1;
no strict 'refs';
if (my $space=$Apache::lonxml::alltags{$token->[1]}) {
- #&Apache::lonxml::debug("Calling sub $sub in $space
\n");
+ #&Apache::lonxml::debug("Calling sub $sub in $space
\n");
$sub1="$space\:\:$sub";
$Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter);
$currentstring = &$sub1($target,$token,$parstack,$parser,
$safeeval,$style);
} else {
- #&Apache::lonxml::debug("NOT Calling sub $sub in $space
\n");
+ #&Apache::lonxml::debug("NOT Calling sub $sub in $space
\n");
if (defined($token->[4])) {
$currentstring = $token->[4];
} else {
@@ -269,7 +269,7 @@ sub increasedepth {
}
my $curdepth=join('_',@Apache::lonxml::depthcounter);
&Apache::lonxml::debug("s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n");
-#print "
s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n";
+#print "
s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n";
}
sub decreasedepth {
@@ -285,7 +285,7 @@ sub decreasedepth {
}
my $curdepth=join('_',@Apache::lonxml::depthcounter);
&Apache::lonxml::debug("e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n");
-#print "
e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n";
+#print "
e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n";
}
sub get_all_text {
@@ -333,7 +333,7 @@ sub parstring {
map {
unless ($_=~/\W/) {
my $val=$token->[2]->{$_};
- $val =~ s/([\%\@\\])/\$1/;
+ $val =~ s/([\%\@\\])/\\$1/g;
#if ($val =~ m/^[\%\@]/) { $val="\\".$val; }
$temp .= "my \$$_=\"$val\";"
}
@@ -401,17 +401,35 @@ sub handler {
$Apache::lonxml::debug=0;
sub debug {
if ($Apache::lonxml::debug eq 1) {
- print "DEBUG:".$_[0]."
\n";
+ print "DEBUG:".$_[0]."
\n";
}
}
sub error {
- print "ERROR:".$_[0]."
\n";
+ if ($Apache::lonxml::debug eq 1) {
+ print "ERROR:".$_[0]."
\n";
+ } else {
+ print "An Error occured while processing this resource. The instructor has been notified.
";
+ #notify author
+ &Apache::lonmsg::author_res_msg($ENV{'request.filename'},$_[0]);
+ #notify course
+ if ( $ENV{'request.course.id'} ) {
+ my $users=$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'};
+ foreach my $user (split /\,/, $users) {
+ ($user,my $domain) = split /:/, $user;
+ &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]);
+ }
}
sub warning {
if ($Apache::lonxml::debug eq 1) {
- print "WARNING:".$_[0]."
\n";
+ print "WARNING:".$_[0]."
\n";
}
}