[LON-CAPA-cvs] cvs: loncom /homework grades.pm
kruse
kruse at source.lon-capa.org
Thu Aug 15 10:10:09 EDT 2013
kruse Thu Aug 15 14:10:09 2013 EDT
Modified files:
/loncom/homework grades.pm
Log:
Added box with links to by students submitted files for all four options in Hand-Grading-Screen.
Direct file access used to be possible under the option "Last Submission" only.
-------------- next part --------------
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.701 loncom/homework/grades.pm:1.702
--- loncom/homework/grades.pm:1.701 Thu Aug 15 12:38:30 2013
+++ loncom/homework/grades.pm Thu Aug 15 14:10:09 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.701 2013/08/15 12:38:30 bisitz Exp $
+# $Id: grades.pm,v 1.702 2013/08/15 14:10:09 kruse Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2139,146 +2139,146 @@
$result.=$sub_result;
}
$request->print($result."\n");
-
+
# print student answer/submission
# Options are (1) Handgraded submission only
# (2) Last submission, includes submission that is not handgraded
# (for multi-response type part)
# (3) Last submission plus the parts info
# (4) The whole record for this student
- if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) {
- my ($string,$timestamp)= &get_last_submission(\%record);
+
+ my ($string,$timestamp)= &get_last_submission(\%record);
- my $lastsubonly;
+ my $lastsubonly;
- if ($$timestamp eq '') {
- $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>';
- } else {
- $lastsubonly =
- '<div class="LC_grade_submissions_body">'
- .'<b>'.&mt('Date Submitted:').'</b> '.$$timestamp."\n";
-
- my %seenparts;
- my @part_response_id = &flatten_responseType($responseType);
- foreach my $part (@part_response_id) {
- next if ($env{'form.lastSub'} eq 'hdgrade'
+ if ($$timestamp eq '') {
+ $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>';
+ } else {
+ $lastsubonly =
+ '<div class="LC_grade_submissions_body">'
+ .'<b>'.&mt('Date Submitted:').'</b> '.$$timestamp."\n";
+
+ my %seenparts;
+ my @part_response_id = &flatten_responseType($responseType);
+ foreach my $part (@part_response_id) {
+ next if ($env{'form.lastSub'} eq 'hdgrade'
&& $$handgrade{$$part[0].'_'.$$part[1]} ne 'yes');
- my ($partid,$respid) = @{ $part };
- my $display_part=&get_display_part($partid,$symb);
- if ($env{"form.$uname:$udom:$partid:submitted_by"}) {
- if (exists($seenparts{$partid})) { next; }
- $seenparts{$partid}=1;
- $request->print(
- '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
- ' <b>'.&mt('Collaborative submission by: [_1]',
- '<a href="javascript:viewSubmitter(\''.
- $env{"form.$uname:$udom:$partid:submitted_by"}.
- '\');" target="_self">'.
- $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'</a>').
- '<br />');
- next;
- }
- my $responsetype = $responseType->{$partid}->{$respid};
- if (!exists($record{"resource.$partid.$respid.submission"})) {
- $lastsubonly.="\n".'<div class="LC_grade_submission_part">'.
- '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
- ' <span class="LC_internal_info">'.
- '('.&mt('Response ID: [_1]',$respid).')'.
- '</span> '.
- '<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>';
- next;
- }
- foreach my $submission (@$string) {
- my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
- if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
- my ($ressub,$hide,$subval) = split(/:/,$submission,3);
- # Similarity check
- my $similar='';
- my ($type,$trial,$rndseed);
- if ($hide eq 'rand') {
- $type = 'randomizetry';
- $trial = $record{"resource.$partid.tries"};
- $rndseed = $record{"resource.$partid.rndseed"};
- }
- if($env{'form.checkPlag'}){
- my ($oname,$odom,$ocrsid,$oessay,$osim)=
- &most_similar($uname,$udom,$symb,$subval);
- if ($osim) {
- $osim=int($osim*100.0);
- my %old_course_desc =
- &Apache::lonnet::coursedescription($ocrsid,
- {'one_time' => 1});
-
- if ($hide eq 'anon') {
- $similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'.
- &mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />';
- } else {
- $similar="<hr /><h3><span class=\"LC_warning\">".
- &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])',
- $osim,
- &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')',
+ my ($partid,$respid) = @{ $part };
+ my $display_part=&get_display_part($partid,$symb);
+ if ($env{"form.$uname:$udom:$partid:submitted_by"}) {
+ if (exists($seenparts{$partid})) { next; }
+ $seenparts{$partid}=1;
+ $request->print(
+ '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
+ ' <b>'.&mt('Collaborative submission by: [_1]',
+ '<a href="javascript:viewSubmitter(\''.
+ $env{"form.$uname:$udom:$partid:submitted_by"}.
+ '\');" target="_self">'.
+ $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'</a>').
+ '<br />');
+ next;
+ }
+ my $responsetype = $responseType->{$partid}->{$respid};
+ if (!exists($record{"resource.$partid.$respid.submission"})) {
+ $lastsubonly.="\n".'<div class="LC_grade_submission_part">'.
+ '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
+ ' <span class="LC_internal_info">'.
+ '('.&mt('Response ID: [_1]',$respid).')'.
+ '</span> '.
+ '<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>';
+ next;
+ }
+ foreach my $submission (@$string) {
+ my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
+ if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
+ my ($ressub,$hide,$subval) = split(/:/,$submission,3);
+ # Similarity check
+ my $similar='';
+ my ($type,$trial,$rndseed);
+ if ($hide eq 'rand') {
+ $type = 'randomizetry';
+ $trial = $record{"resource.$partid.tries"};
+ $rndseed = $record{"resource.$partid.rndseed"};
+ }
+ if ($env{'form.checkPlag'}) {
+ my ($oname,$odom,$ocrsid,$oessay,$osim)=
+ &most_similar($uname,$udom,$symb,$subval);
+ if ($osim) {
+ $osim=int($osim*100.0);
+ my %old_course_desc =
+ &Apache::lonnet::coursedescription($ocrsid,
+ {'one_time' => 1});
+
+ if ($hide eq 'anon') {
+ $similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'.
+ &mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />';
+ } else {
+ $similar="<hr /><h3><span class=\"LC_warning\">".
+ &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])',
+ $osim,
+ &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')',
$old_course_desc{'description'},
$old_course_desc{'num'},
$old_course_desc{'domain'}).
'</span></h3><blockquote><i>'.
&keywords_highlight($oessay).
'</i></blockquote><hr />';
- }
- }
- }
- my $order=&get_order($partid,$respid,$symb,$uname,$udom,
- undef,$type,$trial,$rndseed);
- if ($env{'form.lastSub'} eq 'lastonly' ||
- ($env{'form.lastSub'} eq 'hdgrade' &&
+ }
+ }
+ }
+ my $order=&get_order($partid,$respid,$symb,$uname,$udom,
+ undef,$type,$trial,$rndseed);
+ if ($env{'form.lastSub'} eq 'lastonly' || $env{'form.lastSub'} eq 'datesub' || $env{'form.lastSub'} =~ /^(last|all)$/ || ($env{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
- my $display_part=&get_display_part($partid,$symb);
- $lastsubonly.='<div class="LC_grade_submission_part">'.
- '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
- ' <span class="LC_internal_info">'.
- '('.&mt('Response ID: [_1]',$respid).')'.
- '</span> ';
- my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
-
- if (@$files) {
- if ($hide eq 'anon') {
- $lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
- } else {
- $lastsubonly.='<br /><br />'.'<b>'.&mt('Submitted Files:').'</b>'
- .'<br /><span class="LC_warning">';
- if(@$files == 1) {
- $lastsubonly .= &mt('Like all files provided by users, this file may contain viruses!');
- } else {
- $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!');
- }
- $lastsubonly .= '</span>';
- foreach my $file (@$files) {
- &Apache::lonnet::allowuploaded('/adm/grades',$file);
- $lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" alt="" /> '.$file.'</a>';
- }
- }
- $lastsubonly.='<br />';
- }
+ my $display_part=&get_display_part($partid,$symb);
+ $lastsubonly.='<div class="LC_grade_submission_part">'.
+ '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
+ ' <span class="LC_internal_info">'.
+ '('.&mt('Response ID: [_1]',$respid).')'.
+ '</span> ';
+ my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
+
+ if (@$files) {
if ($hide eq 'anon') {
- $lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>';
+ $lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
} else {
- $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>'.
- &cleanRecord($subval,$responsetype,$symb,$partid,
- $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+ $lastsubonly.='<br /><br />'.'<b>'.&mt('Submitted Files:').'</b>'
+ .'<br /><span class="LC_warning">';
+ if(@$files == 1) {
+ $lastsubonly .= &mt('Like all files provided by users, this file may contain viruses!');
+ } else {
+ $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!');
+ }
+ $lastsubonly .= '</span>';
+ foreach my $file (@$files) {
+ &Apache::lonnet::allowuploaded('/adm/grades',$file);
+ $lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" alt="" /> '.$file.'</a>';
+ }
}
- if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
- $lastsubonly.='</div>';
- }
+ $lastsubonly.='<br />';
+ }
+ if ($hide eq 'anon') {
+ $lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>';
+ } else {
+ $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>'.
+ &cleanRecord($subval,$responsetype,$symb,$partid,
+ $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+ }
+ if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
+ $lastsubonly.='</div>';
}
- }
- $lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body
+ }
}
- $request->print($lastsubonly);
- } elsif ($env{'form.lastSub'} eq 'datesub') {
+ $lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body
+ }
+ $request->print($lastsubonly);
+ if ($env{'form.lastSub'} eq 'datesub') {
my ($parts,$handgrade,$responseType) = &response_type($symb,\$res_error);
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
- } elsif ($env{'form.lastSub'} =~ /^(last|all)$/) {
- $request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
+ }
+ if ($env{'form.lastSub'} =~ /^(last|all)$/) {
+ $request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
$env{'request.course.id'},
$last,'.submission',
'Apache::grades::keywords_highlight'));
More information about the LON-CAPA-cvs
mailing list