Diff for /loncom/interface/loncommon.pm between versions 1.42 and 1.43

version 1.42, 2002/07/01 15:24:44 version 1.43, 2002/07/03 21:12:38
Line 33 Line 33
 # 12/25,12/28 Gerd Kortemeyer  # 12/25,12/28 Gerd Kortemeyer
 # YEAR=2002  # YEAR=2002
 # 1/4 Gerd Kortemeyer  # 1/4 Gerd Kortemeyer
   # 6/24,7/2 H. K. Ng
   
 # Makes a table out of the previous attempts  # Makes a table out of the previous attempts
 # Inputs result_from_symbread, user, domain, course_id  # Inputs result_from_symbread, user, domain, course_id
Line 864  sub filedescriptionex { Line 865  sub filedescriptionex {
 # $username,$domain - that of the student  # $username,$domain - that of the student
 # $course           - course name  # $course           - course name
 # $getattempt       - leave blank if want all attempts, else put something.  # $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  # output
 # formatted as a table all the attempts, if any.  # formatted as a table all the attempts, if any.
 #  #
 sub get_previous_attempt {  sub get_previous_attempt {
   my ($symb,$username,$domain,$course,$getattempt)=@_;    my ($symb,$username,$domain,$course,$getattempt,$regexp,$gradesub)=@_;
   my $prevattempts='';    my $prevattempts='';
     no strict 'refs';
   if ($symb) {    if ($symb) {
     my (%returnhash)=      my (%returnhash)=
       &Apache::lonnet::restore($symb,$course,$domain,$username);        &Apache::lonnet::restore($symb,$course,$domain,$username);
Line 882  sub get_previous_attempt { Line 886  sub get_previous_attempt {
   $lasthash{$_}=$returnhash{$version.':'.$_};    $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>';        $prevattempts.='<table border="0" width="100%"><tr bgcolor="#e6ffff"><td>History</td>';
       foreach (sort(keys %lasthash)) {        foreach (sort(keys %lasthash)) {
  my ($ign,@parts) = split(/\./,$_);   my ($ign,@parts) = split(/\./,$_);
Line 920  sub get_previous_attempt { Line 924  sub get_previous_attempt {
  } else {   } else {
   $value=$lasthash{$_};    $value=$lasthash{$_};
  }   }
    if ($_ =~/$regexp$/) {$value = &$gradesub($value)}
  $prevattempts.='<td>'.$value.'&nbsp;</td>';   $prevattempts.='<td>'.$value.'&nbsp;</td>';
       }        }
       $prevattempts.='</tr></table></td></tr></table>';        $prevattempts.='</tr></table></td></tr></table>';

Removed from v.1.42  
changed lines
  Added in v.1.43


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>