--- loncom/xml/lonxml.pm 2004/11/29 22:45:51 1.347 +++ loncom/xml/lonxml.pm 2004/11/30 22:57:16 1.348 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.347 2004/11/29 22:45:51 albertel Exp $ +# $Id: lonxml.pm,v 1.348 2004/11/30 22:57:16 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1377,9 +1377,17 @@ sub debug { } } +sub show_error_warn_msg { + return (($Apache::lonxml::debug eq 1) || + ($ENV{'request.state'} eq 'construct') || + ($Apache::lonhomework::browse eq 'F' + && + $ENV{'form.show_errors'} eq 'on')); +} + sub error { $errorcount++; - if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) { + if ( &show_error_warn_msg() ) { # If printing in construction space, put the error inside

 	push(@Apache::lonxml::error_messages,
 	     $Apache::lonxml::warnings_error_header.
@@ -1419,7 +1427,7 @@ sub warning {
     $warningcount++;
   
     if ($ENV{'form.grade_target'} ne 'tex') {
-	if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
+	if ( &show_error_warn_msg() ) {
 	    my $request=$Apache::lonxml::request;
 	    if (!$request) { $request=Apache->request; }
 	    push(@Apache::lonxml::warning_messages,