version 1.37, 2002/05/09 15:56:02
|
version 1.40, 2002/06/25 16:31:51
|
Line 768 sub filedescriptionex {
|
Line 768 sub filedescriptionex {
|
return '.'.$ex.' '.$fd{lc($ex)}; |
return '.'.$ex.' '.$fd{lc($ex)}; |
} |
} |
|
|
|
# ---- Retrieve attempts by students |
|
# input |
|
# $symb - problem including path |
|
# $username,$domain - that of the student |
|
# $course - course name |
|
# $getattempt - leave blank if want all attempts, else put something. |
|
# |
|
# output |
|
# formatted as a table all the attempts, if any. |
|
# |
sub get_previous_attempt { |
sub get_previous_attempt { |
my ($symb,$username,$domain,$course)=@_; |
my ($symb,$username,$domain,$course,$getattempt)=@_; |
my $prevattempts=''; |
my $prevattempts=''; |
if ($symb) { |
if ($symb) { |
my (%returnhash)= |
my (%returnhash)= |
Line 782 sub get_previous_attempt {
|
Line 792 sub get_previous_attempt {
|
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
} |
} |
} |
} |
$prevattempts='<table border=2></tr><th>History</th>'; |
$prevattempts='<table border="0" width="100%"><tr><td bgcolor="#000000">'; |
|
$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(/\./,$_); |
if (@parts) { |
if (@parts) { |
my $data=$parts[-1]; |
my $data=$parts[-1]; |
pop(@parts); |
pop(@parts); |
$prevattempts.='<th>Part '.join('.',@parts).'<br />'.$data.'</th>'; |
$prevattempts.='<td>Part '.join('.',@parts).'<br />'.$data.' </td>'; |
} else { |
} else { |
$prevattempts.='<th>'.$ign.'</th>'; |
$prevattempts.='<td>'.$ign.' </td>'; |
} |
} |
} |
} |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
if ($getattempt eq '') { |
$prevattempts.='</tr><tr><th>Attempt '.$version.'</th>'; |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
foreach (sort(keys %lasthash)) { |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Transaction '.$version.'</td>'; |
my $value; |
foreach (sort(keys %lasthash)) { |
if ($_ =~ /timestamp/) { |
my $value; |
$value=scalar(localtime($returnhash{$version.':'.$_})); |
if ($_ =~ /timestamp/) { |
} else { |
$value=scalar(localtime($returnhash{$version.':'.$_})); |
$value=$returnhash{$version.':'.$_}; |
} else { |
} |
$value=$returnhash{$version.':'.$_}; |
$prevattempts.='<td>'.$value.'</td>'; |
} |
} |
$prevattempts.='<td>'.$value.' </td>'; |
|
} |
|
} |
} |
} |
$prevattempts.='</tr><tr><th>Current</th>'; |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Current</td>'; |
foreach (sort(keys %lasthash)) { |
foreach (sort(keys %lasthash)) { |
my $value; |
my $value; |
if ($_ =~ /timestamp/) { |
if ($_ =~ /timestamp/) { |
Line 813 sub get_previous_attempt {
|
Line 826 sub get_previous_attempt {
|
} else { |
} else { |
$value=$lasthash{$_}; |
$value=$lasthash{$_}; |
} |
} |
$prevattempts.='<td>'.$value.'</td>'; |
$prevattempts.='<td>'.$value.' </td>'; |
} |
} |
$prevattempts.='</tr></table>'; |
$prevattempts.='</tr></table></td></tr></table>'; |
} else { |
} else { |
$prevattempts='Nothing submitted - no attempts.'; |
$prevattempts='Nothing submitted - no attempts.'; |
} |
} |