[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
ng
lon-capa-cvs@mail.lon-capa.org
Wed, 03 Jul 2002 21:12:38 -0000
ng Wed Jul 3 17:12:38 2002 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
change get_previous_attempts to render highlights for submissions
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.42 loncom/interface/loncommon.pm:1.43
--- loncom/interface/loncommon.pm:1.42 Mon Jul 1 11:24:44 2002
+++ loncom/interface/loncommon.pm Wed Jul 3 17:12:38 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.42 2002/07/01 15:24:44 matthew Exp $
+# $Id: loncommon.pm,v 1.43 2002/07/03 21:12:38 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,7 @@
# 12/25,12/28 Gerd Kortemeyer
# YEAR=2002
# 1/4 Gerd Kortemeyer
+# 6/24,7/2 H. K. Ng
# Makes a table out of the previous attempts
# Inputs result_from_symbread, user, domain, course_id
@@ -864,13 +865,16 @@
# $username,$domain - that of the student
# $course - course name
# $getattempt - leave blank if want all attempts, else put something.
+# $regexp - regular expression. If string matches regexp send to
+# $gradesub - routine that process the string if it matches regexp
#
# output
# formatted as a table all the attempts, if any.
#
sub get_previous_attempt {
- my ($symb,$username,$domain,$course,$getattempt)=@_;
+ my ($symb,$username,$domain,$course,$getattempt,$regexp,$gradesub)=@_;
my $prevattempts='';
+ no strict 'refs';
if ($symb) {
my (%returnhash)=
&Apache::lonnet::restore($symb,$course,$domain,$username);
@@ -882,7 +886,7 @@
$lasthash{$_}=$returnhash{$version.':'.$_};
}
}
- $prevattempts='<table border="0" width="100%"><tr><td bgcolor="#000000">';
+ $prevattempts='<table border="0" width="100%"><tr><td bgcolor="#777777">';
$prevattempts.='<table border="0" width="100%"><tr bgcolor="#e6ffff"><td>History</td>';
foreach (sort(keys %lasthash)) {
my ($ign,@parts) = split(/\./,$_);
@@ -920,6 +924,7 @@
} else {
$value=$lasthash{$_};
}
+ if ($_ =~/$regexp$/) {$value = &$gradesub($value)}
$prevattempts.='<td>'.$value.' </td>';
}
$prevattempts.='</tr></table></td></tr></table>';