[LON-CAPA-cvs] cvs: loncom /xml run.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 01 Oct 2003 21:27:35 -0000


albertel		Wed Oct  1 17:27:35 2003 EDT

  Modified files:              
    /loncom/xml	run.pm 
  Log:
  - BUG#2239, the bad line is highlighted in red and bolded, may I should add blink?
  
  
Index: loncom/xml/run.pm
diff -u loncom/xml/run.pm:1.39 loncom/xml/run.pm:1.40
--- loncom/xml/run.pm:1.39	Wed Jun 18 17:04:42 2003
+++ loncom/xml/run.pm	Wed Oct  1 17:27:35 2003
@@ -1,6 +1,6 @@
 package Apache::run;
 #
-# $Id: run.pm,v 1.39 2003/06/18 21:04:42 albertel Exp $
+# $Id: run.pm,v 1.40 2003/10/01 21:27:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -98,10 +98,20 @@
 	    $error = 'Code ran too long. It ran for more than '.
 		Apache->request->server->timeout.' seconds';
 	}
-	&Apache::lonxml::error('<pre>'.&HTML::Entities::encode($error).' '.
-			       &HTML::Entities::encode($innererror).
-			       '</pre> occured while running <pre>'.
-			       &HTML::Entities::encode($code).'</pre>');
+	my $errormsg='<pre>'.&HTML::Entities::encode($error).' '.
+	    &HTML::Entities::encode($innererror).
+	    '</pre> occured while running <pre>';
+	$code=&HTML::Entities::encode($code);
+	&Apache::lonxml::debug("");
+	if ($innererror=~/line (\d+)/) {
+	    &Apache::lonxml::debug("Line is $1");
+	    my $linenumber=$1;
+	    my @code=split("\n",$code);
+	    $code[$linenumber-1]='<b><font color="red">'.
+		$code[$linenumber-1].'</font></b>';
+	    $code=join("\n",@code);
+	}
+	&Apache::lonxml::error($errormsg.$code.'</pre>');
     }
     if ( $#result < '1') {
 	return $result[0];