version 1.396, 2007/04/25 00:16:51
|
version 1.397, 2007/04/26 22:29:50
|
Line 1626 sub show_problem {
|
Line 1626 sub show_problem {
|
$result.='</td></tr></table><br />'; |
$result.='</td></tr></table><br />'; |
return $result; |
return $result; |
} |
} |
|
|
sub files_exist { |
sub files_exist { |
my ($r, $symb) = @_; |
my ($r, $symb) = @_; |
my $files_exist = 0; |
|
my @students = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
my @students = &Apache::loncommon::get_env_multiple('form.stuinfo'); |
|
|
foreach my $student (@students) { |
foreach my $student (@students) { |
my ($uname,$udom,$fullname) = split(/:/,$student); |
my ($uname,$udom,$fullname) = split(/:/,$student); |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname); |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'}, |
|
$udom,$uname); |
my ($string,$timestamp)= &get_last_submission(\%record); |
my ($string,$timestamp)= &get_last_submission(\%record); |
foreach (@$string) { |
foreach my $submission (@$string) { |
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; |
my ($partid,$respid) = |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); |
($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); |
if (@$files) { |
my $files=&get_submitted_files($udom,$uname,$partid,$respid, |
$files_exist = 1; |
\%record); |
return $files_exist; |
return 1 if (@$files); |
} |
|
} |
} |
} |
} |
return $files_exist; |
return 0; |
} |
} |
|
|
sub download_all_link { |
sub download_all_link { |
my ($r,$symb) = @_; |
my ($r,$symb) = @_; |
my $all_students = |
my $all_students = |
Line 1696 sub submission {
|
Line 1698 sub submission {
|
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes'); |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; |
if (&files_exist($request, $symb)) { |
if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) { |
&download_all_link($request, $symb); |
&download_all_link($request, $symb); |
} |
} |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
Line 2105 sub get_last_submission {
|
Line 2107 sub get_last_submission {
|
my %lasthash=(); |
my %lasthash=(); |
my ($version); |
my ($version); |
for ($version=1;$version<=$$returnhash{'version'};$version++) { |
for ($version=1;$version<=$$returnhash{'version'};$version++) { |
foreach (sort(split(/\:/,$$returnhash{$version.':keys'}))) { |
foreach my $key (sort(split(/\:/, |
$lasthash{$_}=$$returnhash{$version.':'.$_}; |
$$returnhash{$version.':keys'}))) { |
$timestamp = scalar(localtime($$returnhash{$version.':timestamp'})); |
$lasthash{$key}=$$returnhash{$version.':'.$key}; |
|
$timestamp = |
|
scalar(localtime($$returnhash{$version.':timestamp'})); |
} |
} |
} |
} |
foreach ((keys %lasthash)) { |
foreach my $key (keys(%lasthash)) { |
if ($_ =~ /\.submission$/) { |
next if ($key !~ /\.submission$/); |
my ($partid,$foo) = split(/submission$/,$_); |
|
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
my ($partid,$foo) = split(/submission$/,$key); |
'<font color="red">Draft Copy</font> ' : ''; |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
push @string, (join(':',$_,$draft.$lasthash{$_})); |
'<font color="red">Draft Copy</font> ' : ''; |
} |
push(@string, join(':', $key, $draft.$lasthash{$key})); |
} |
} |
} |
} |
@string = $string[0] eq '' ? '<font color="red">Nothing submitted - no attempts.</font>' : @string; |
if (!@string) { |
return \@string,\$timestamp; |
$string[0] = |
|
'<font color="red">Nothing submitted - no attempts.</font>'; |
|
} |
|
return (\@string,\$timestamp); |
} |
} |
|
|
#--- High light keywords, with style choosen by user. |
#--- High light keywords, with style choosen by user. |