--- loncom/homework/grades.pm 2006/02/27 20:32:38 1.321
+++ loncom/homework/grades.pm 2006/02/27 21:23:52 1.322
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.321 2006/02/27 20:32:38 banghart Exp $
+# $Id: grades.pm,v 1.322 2006/02/27 21:23:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1413,7 +1413,7 @@ SUBJAVASCRIPT
#--- displays the grading box, used in essay type problem and grading by page/sequence
sub gradeBox {
- my ($request,$symb,$uname,$udom,$counter,$partid,$record,$respid) = @_;
+ my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
my $checkIcon = '';
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
@@ -1423,7 +1423,6 @@ sub gradeBox {
my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ?
'' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt));
my $result=''."\n";
- $result.='
'.$partid.' - '.$respid.'
';
my $display_part=&get_display_part($partid,undef,$symb);
my %last_resets = &get_last_resets($symb,$env{'request.course.id'},
[$partid]);
@@ -1472,23 +1471,26 @@ sub gradeBox {
''."\n";
$result.=''."\n";
- $result.=&handbackBox($uname,$udom,$counter,$partid,$record,$respid);
+ $result.=&handback_box($uname,$udom,$counter,$partid,$record);
return $result;
}
-sub handbackBox {
- my ($uname,$udom,$counter,$partid,$record,$respid) = @_;
- my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
+
+sub handback_box {
+ my ($uname,$udom,$counter,$partid,$record) = @_;
my $result;
- if (@$files) {
- my $file_counter = 1;
+ foreach my $respid (undef) {
+ my $prefix = $counter.'_'.$partid.'_'.$respid.'_';
+ my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
+ next if (!@$files);
+ my $file_counter = 1;
foreach my $file (@$files) {
- $file =~ /.+\/(.+$)/;
- my $file_disp = $1;
- $result.=' Return commented version of '.$file_disp.' to student. '."\n";
- $result.='
';
- $file_counter++;
- }
+ my ($file_disp) = ($file =~ m|.+/(.+)$|);
+ $result.=&mt('Return commented version of [_1] to student.',
+ ''.$file_disp.'');
+ $result.=''."\n";
+ $result.='
';
+ $file_counter++;
+ }
}
return $result;
}
@@ -1916,18 +1918,14 @@ KEYWORDS
my %seen = ();
my @partlist;
my @gradePartRespid;
- for my $part_resp(sort keys(%$handgrade)) {
+ for my $part_resp (sort(keys(%$handgrade))) {
my ($partid,$respid) = split(/_/, $part_resp);
- #next if ($seen{$partid} > 0);
- if ($seen{$partid} > 0) {
- $request->print(&handbackBox($uname,$udom,$counter,$partid,\%record,$respid));
- next;
- }
+ next if ($seen{$partid} > 0);
$seen{$partid}++;
next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/);
push @partlist,$partid;
push @gradePartRespid,$partid.'.'.$respid;
- $request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record,$respid));
+ $request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
}
$result=''."\n";
@@ -2322,7 +2320,7 @@ sub saveHandGrade {
my $portfolio_root = &Apache::loncommon::propath($domain,
$stuname).
'/userfiles/portfolio';
- foreach my $part_resp(sort(keys(%$handgrade))) {
+ foreach my $part_resp (sort(keys(%$handgrade))) {
my ($part_id, $resp_id) = split(/_/,$part_resp);
if ($env{'form.'.$part_resp.'_returndoc1'} && ($new_part eq $part_id)) {
# if multiple files are uploaded names will be 'returndoc2','returndoc3'
@@ -2373,6 +2371,7 @@ sub saveHandGrade {
}
return ('',$pts,$wgt);
}
+
sub get_submitted_files {
my ($udom,$uname,$partid,$respid,$record) = @_;
my @files;
@@ -2387,6 +2386,7 @@ sub get_submitted_files {
}
return (\@files);
}
+
# ----------- Provides number of tries since last reset.
sub get_num_tries {
my ($record,$last_reset,$part) = @_;