'."\n";
- if ($numresp > $numessay) {
+ if (($numresp > $numessay) && !$is_tool) {
$result.='
'
.&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon)
."
\n";
@@ -2523,163 +2557,12 @@ sub submission {
# (3) All transactions (by date)
# (4) The whole record (with detailed information for all transactions)
- my ($string,$timestamp)= &get_last_submission(\%record);
-
- my $lastsubonly;
-
- if ($$timestamp eq '') {
- $lastsubonly.='
'."\n"; # End: LC_grade_submissions_body
- }
+ my ($lastsubonly,$partinfo) =
+ &show_last_submission($uname,$udom,$symb,$essayurl,$responseType,$env{'form.lastSub'},
+ $is_tool,$fullname,\%record,\%coursedesc_by_cid);
+ $request->print($partinfo);
$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));
@@ -2732,7 +2615,12 @@ sub submission {
my %seen = ();
my @partlist;
my @gradePartRespid;
- my @part_response_id = &flatten_responseType($responseType);
+ my @part_response_id;
+ if ($is_tool) {
+ @part_response_id = ([0,'']);
+ } else {
+ @part_response_id = &flatten_responseType($responseType);
+ }
$request->print(
'
'
.'
'.&mt('Assign Grades').'
'
@@ -2798,6 +2686,186 @@ sub submission {
return '';
}
+sub show_last_submission {
+ my ($uname,$udom,$symb,$essayurl,$responseType,$viewtype,$is_tool,$fullname,
+ $record,$coursedesc_by_cid) = @_;
+ my ($string,$timestamp,$lastgradetime,$lastsubmittime) =
+ &get_last_submission($record,$is_tool);
+
+ my ($lastsubonly,$partinfo);
+ if ($timestamp eq '') {
+ $lastsubonly.='
'.$string->[0].'
';
+ } elsif ($is_tool) {
+ $lastsubonly =
+ '
'
+ .''.&mt('Date Grade Passed Back:').' '.$timestamp."
\n";
+ } else {
+ my ($shownsubmdate,$showngradedate);
+ if ($lastsubmittime && $lastgradetime) {
+ $shownsubmdate = &Apache::lonlocal::locallocaltime($lastsubmittime);
+ if ($lastgradetime > $lastsubmittime) {
+ $showngradedate = &Apache::lonlocal::locallocaltime($lastgradetime);
+ }
+ } else {
+ $shownsubmdate = $timestamp;
+ }
+ $lastsubonly =
+ '
'
+ .'
'.&mt('Date Submitted:').' '.$shownsubmdate."\n";
+ if ($showngradedate) {
+ $lastsubonly .= '
'.&mt('Date Graded:').' '.$showngradedate."\n";
+ }
+
+ my %seenparts;
+ my @part_response_id = &flatten_responseType($responseType);
+ foreach my $part (@part_response_id) {
+ 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;
+ $partinfo .=
+ '
'.&mt('Part: [_1]',$display_part).''.
+ '
'.&mt('Collaborative submission by: [_1]',
+ ''.
+ $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'').
+ '
';
+ next;
+ }
+ my $responsetype = $responseType->{$partid}->{$respid};
+ if (!exists($record->{"resource.$partid.$respid.submission"})) {
+ $lastsubonly.="\n".''.
+ ''.&mt('Part: [_1]',$display_part).''.
+ ' '.
+ '('.&mt('Response ID: [_1]',$respid).')'.
+ ' '.
+ ''.&mt('Nothing submitted - no attempts.').'
';
+ next;
+ }
+ foreach my $submission (@$string) {
+ my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
+ if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
+ my ($ressub,$hide,$draft,$subval) = split(/:/,$submission,4);
+ # 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);
+ if ($hide eq 'anon') {
+ $similar='
'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'
'.
+ &mt('As the current submission is for an anonymous survey, no other details are available.').'
';
+ } else {
+ $similar='
';
+ if ($essayurl eq 'lib/templates/simpleproblem.problem') {
+ $similar .= ''.
+ &mt('Essay is [_1]% similar to an essay by [_2]',
+ $osim,
+ &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')').
+ '
';
+ } else {
+ my %old_course_desc;
+ if ($ocrsid ne '') {
+ if (ref($coursedesc_by_cid->{$ocrsid}) eq 'HASH') {
+ %old_course_desc = %{$coursedesc_by_cid->{$ocrsid}};
+ } else {
+ my $args;
+ if ($ocrsid ne $env{'request.course.id'}) {
+ $args = {'one_time' => 1};
+ }
+ %old_course_desc =
+ &Apache::lonnet::coursedescription($ocrsid,$args);
+ $coursedesc_by_cid->{$ocrsid} = \%old_course_desc;
+ }
+ $similar .=
+ ''.
+ &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'}).
+ '
';
+ } else {
+ $similar .=
+ ''.
+ &mt('Essay is [_1]% similar to an essay by [_2] in an unknown course',
+ $osim,
+ &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')').
+ '
';
+ }
+ }
+ $similar .= ''.
+ &keywords_highlight($oessay).
+ '
';
+ }
+ }
+ }
+ my $order=&get_order($partid,$respid,$symb,$uname,$udom,
+ undef,$type,$trial,$rndseed);
+ if (($viewtype eq 'lastonly') ||
+ ($viewtype eq 'datesub') ||
+ ($viewtype =~ /^(last|all)$/)) {
+ my $display_part=&get_display_part($partid,$symb);
+ $lastsubonly.=''.
+ '
'.&mt('Part: [_1]',$display_part).''.
+ '
'.
+ '('.&mt('Response ID: [_1]',$respid).')'.
+ ' ';
+ my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
+ if (@$files) {
+ if ($hide eq 'anon') {
+ $lastsubonly.='
'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
+ } else {
+ $lastsubonly.='
'.'
'.&mt('Submitted Files:').''
+ .'
';
+ 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 .= '';
+ foreach my $file (@$files) {
+ &Apache::lonnet::allowuploaded('/adm/grades',$file);
+ $lastsubonly.='
'.$file.'';
+ }
+ }
+ $lastsubonly.='
';
+ }
+ if ($hide eq 'anon') {
+ $lastsubonly.='
'.&mt('Anonymous Survey').'';
+ } else {
+ $lastsubonly.='
'.&mt('Submitted Answer:').' ';
+ if ($draft) {
+ $lastsubonly.= '
'.&mt('Draft Copy').'';
+ }
+ $subval =
+ &cleanRecord($subval,$responsetype,$symb,$partid,
+ $respid,$record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+ if ($responsetype eq 'essay') {
+ $subval =~ s{\n}{
}g;
+ }
+ $lastsubonly.=$subval."\n";
+ }
+ if ($similar) {$lastsubonly.="
$similar\n";}
+ $lastsubonly.='
';
+ }
+ }
+ }
+ $lastsubonly.=''."\n"; # End: LC_grade_submissions_body
+ }
+ return ($lastsubonly,$partinfo);
+}
+
sub check_collaborators {
my ($symb,$uname,$udom,$record,$handgrade,$counter) = @_;
my ($result,@col_fullnames);
@@ -2856,19 +2924,52 @@ sub check_collaborators {
#--- Retrieve the last submission for all the parts
sub get_last_submission {
- my ($returnhash)=@_;
- my (@string,$timestamp,%lasthidden);
+ my ($returnhash,$is_tool)=@_;
+ my (@string,$timestamp,$lastgradetime,$lastsubmittime);
if ($$returnhash{'version'}) {
my %lasthash=();
- my ($version);
+ my %prevsolved=();
+ my %solved=();
+ my $version;
for ($version=1;$version<=$$returnhash{'version'};$version++) {
+ my %handgraded = ();
foreach my $key (sort(split(/\:/,
$$returnhash{$version.':keys'}))) {
$lasthash{$key}=$$returnhash{$version.':'.$key};
- $timestamp =
- &Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'});
- }
+ if ($key =~ /\.([^.]+)\.regrader$/) {
+ $handgraded{$1} = 1;
+ } elsif ($key =~ /\.portfiles$/) {
+ if (($$returnhash{$version.':'.$key} ne '') &&
+ ($$returnhash{$version.':'.$key} !~ /\.\d+\.\w+$/)) {
+ $lastsubmittime = $$returnhash{$version.':timestamp'};
+ }
+ } elsif ($key =~ /\.submission$/) {
+ if ($$returnhash{$version.':'.$key} ne '') {
+ $lastsubmittime = $$returnhash{$version.':timestamp'};
+ }
+ } elsif ($key =~ /\.([^.]+)\.solved$/) {
+ $prevsolved{$1} = $solved{$1};
+ $solved{$1} = $lasthash{$key};
+ }
+ }
+ foreach my $partid (keys(%handgraded)) {
+ if (($prevsolved{$partid} eq 'ungraded_attempted') &&
+ (($solved{$partid} eq 'incorrect_by_override') ||
+ ($solved{$partid} eq 'correct_by_override'))) {
+ $lastgradetime = $$returnhash{$version.':timestamp'};
+ }
+ if ($solved{$partid} ne '') {
+ $prevsolved{$partid} = $solved{$partid};
+ }
+ }
}
+#
+# Timestamp is for last transaction for this resource, which does not
+# necessarily correspond to the time of last submission for problem (or part).
+#
+ if ($lasthash{'timestamp'} ne '') {
+ $timestamp = &Apache::lonlocal::locallocaltime($lasthash{'timestamp'});
+ }
my (%typeparts,%randombytry);
my $showsurv =
&Apache::lonnet::allowed('vas',$env{'request.course.id'});
@@ -2922,10 +3023,16 @@ sub get_last_submission {
}
}
if (!@string) {
+ my $msg;
+ if ($is_tool) {
+ $msg = &mt('No grade passed back.');
+ } else {
+ $msg = &mt('Nothing submitted - no attempts.');
+ }
$string[0] =
- '
'.&mt('Nothing submitted - no attempts.').'';
+ '
'.$msg.'';
}
- return (\@string,\$timestamp);
+ return (\@string,$timestamp,$lastgradetime,$lastsubmittime);
}
#--- High light keywords, with style choosen by user.
@@ -3760,8 +3867,8 @@ sub version_portfiles {
$$record{$key} = join(',',@versioned_portfiles);
push(@returned_keys,$key);
}
- }
- return (@returned_keys);
+ }
+ return (@returned_keys);
}
sub get_next_version {
@@ -3999,6 +4106,11 @@ VIEWJAVASCRIPT
#--- show scores for a section or whole class w/ option to change/update a score
sub viewgrades {
my ($request,$symb) = @_;
+ my ($is_tool,$toolsymb);
+ if ($symb =~ /ext\.tool$/) {
+ $is_tool = 1;
+ $toolsymb = $symb;
+ }
&viewgrades_js($request);
#need to make sure we have the correct data for later EXT calls,
@@ -4098,7 +4210,13 @@ sub viewgrades {
if ($env{'form.submitonly'} eq 'all') {
$result.= '
'.$common_header.'
';
} else {
- $result.= '
'.$common_header.' '.&mt('(submission status: "[_1]")',$submission_status).'
';
+ my $text;
+ if ($is_tool) {
+ $text = &mt('(transaction status: "[_1]")',$submission_status);
+ } else {
+ $text = &mt('(submission status: "[_1]")',$submission_status);
+ }
+ $result.= '
'.$common_header.' '.$text.'
';
}
$result .= &Apache::loncommon::start_data_table();
#radio buttons/text box for assigning points for a section or class.
@@ -4111,7 +4229,12 @@ sub viewgrades {
my %weight = ();
my $ctsparts = 0;
my %seen = ();
- my @part_response_id = &flatten_responseType($responseType);
+ my @part_response_id;
+ if ($is_tool) {
+ @part_response_id = ([0,'']);
+ } else {
+ @part_response_id = &flatten_responseType($responseType);
+ }
foreach my $part_response_id (@part_response_id) {
my ($partid,$respid) = @{ $part_response_id };
my $part_resp = join('_',@{ $part_response_id });
@@ -4162,10 +4285,16 @@ sub viewgrades {
#table listing all the students in a section/class
#header of table
- if ($env{'form.submitonly'} eq 'all') {
+ if ($env{'form.submitonly'} eq 'all') {
$result.= '
'.$specific_header.'
';
} else {
- $result.= '
'.$specific_header.' '.&mt('(submission status: "[_1]")',$submission_status).'
';
+ my $text;
+ if ($is_tool) {
+ $text = &mt('(transaction status: "[_1]")',$submission_status);
+ } else {
+ $text = &mt('(submission status: "[_1]")',$submission_status);
+ }
+ $result.= '
'.$specific_header.' '.$text.'
';
}
$result.= &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
@@ -4179,10 +4308,10 @@ sub viewgrades {
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
my @partids = ();
foreach my $part (@parts) {
- my $display=&Apache::lonnet::metadata($url,$part.'.display');
+ my $display=&Apache::lonnet::metadata($url,$part.'.display',$toolsymb);
my $narrowtext = &mt('Tries');
$display =~ s|^Number of Attempts|$narrowtext
|; # makes the column narrower
- if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
+ if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name',$toolsymb); }
my ($partid) = &split_part_type($part);
push(@partids,$partid);
#
@@ -4223,7 +4352,7 @@ sub viewgrades {
return $a cmp $b;
} (keys(%$fullname))) {
$result.=&viewstudentgrade($symb,$env{'request.course.id'},
- $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets);
+ $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets,$is_tool);
}
$result.=&Apache::loncommon::end_data_table();
$result.='
'."\n";
@@ -4311,7 +4440,7 @@ sub viewgrades {
#--- call by previous routine to display each student who satisfies submission filter.
sub viewstudentgrade {
- my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_;
+ my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets,$is_tool) = @_;
my ($uname,$udom) = split(/:/,$student);
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my $submitonly = $env{'form.submitonly'};
@@ -4369,7 +4498,6 @@ sub viewstudentgrade {
my ($aggtries,$totaltries);
unless (exists($aggregates{$part})) {
$totaltries = $record{'resource.'.$part.'.tries'};
-
$aggtries = $totaltries;
if ($$last_resets{$part}) {
$aggtries = &get_num_tries(\%record,$$last_resets{$part},
@@ -4418,6 +4546,10 @@ sub viewstudentgrade {
# record does not get update if unchanged
sub editgrades {
my ($request,$symb) = @_;
+ my $toolsymb;
+ if ($symb =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
my $title='
'.&mt('Current Grade Status').'
';
@@ -4464,7 +4596,7 @@ sub editgrades {
my ($part,$type) = &split_part_type($stores);
if ($part !~ m/^\Q$partid\E/) { next;}
if ($type eq 'awarded' || $type eq 'solved') { next; }
- my $display=&Apache::lonnet::metadata($url,$stores.'.display');
+ my $display=&Apache::lonnet::metadata($url,$stores.'.display',$toolsymb);
$display =~ s/\[Part: \Q$part\E\]//;
my $narrowtext = &mt('Tries');
$display =~ s/Number of Attempts/$narrowtext/;
@@ -4796,6 +4928,10 @@ ENDPICK
sub csvupload_fields {
my ($symb,$errorref) = @_;
+ my $toolsymb;
+ if ($symb =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
my (@parts) = &getpartlist($symb,$errorref);
if (ref($errorref)) {
if ($$errorref) {
@@ -4809,7 +4945,7 @@ sub csvupload_fields {
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
foreach my $part (sort(@parts)) {
my @datum;
- my $display=&Apache::lonnet::metadata($url,$part.'.display');
+ my $display=&Apache::lonnet::metadata($url,$part.'.display',$toolsymb);
my $name=$part;
if (!$display) { $display = $name; }
@datum=($name,$display);
@@ -5275,7 +5411,7 @@ sub getSymbMap {
my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); },
1,0,1);
for my $sequence ($navmap->getById('0.0'), @sequences) {
- if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
+ if ($navmap->hasResource($sequence, sub { shift->is_gradable(); }, 0) ) {
my $title = $minder.'.'.
&HTML::Entities::encode($sequence->compTitle(),'"\'&');
push(@titles, $title); # minder in case two titles are identical
@@ -5372,10 +5508,11 @@ sub displayPage {
if($curRes == $iterator->BEGIN_MAP) { $depth++; }
if($curRes == $iterator->END_MAP) { $depth--; }
- if (ref($curRes) && $curRes->is_problem()) {
+ if (ref($curRes) && $curRes->is_gradable()) {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
+ my $is_tool = ($symbx =~ /ext\.tool$/);
$studentTable.=
&Apache::loncommon::start_data_table_row().
'
'.$prob.
@@ -5386,26 +5523,34 @@ sub displayPage {
' | ';
$studentTable.='
';
my %form = ('CODE' => $env{'form.CODE'},);
- if ($env{'form.vProb'} eq 'yes' ) {
- $studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
- undef,'both',\%form);
- } else {
- my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
- $companswer =~ s|||g;
-# while ($companswer =~ /()/s) { #\n");
-# }
-# $companswer =~ s|||g;
- $studentTable.=' '.$title.' '.&mt('Correct answer').': '.$companswer;
+ if ($is_tool) {
+ $studentTable.=' '.$title.' ';
+ } else {
+ if ($env{'form.vProb'} eq 'yes' ) {
+ $studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
+ undef,'both',\%form);
+ } else {
+ my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
+ $companswer =~ s|||g;
+# while ($companswer =~ /()/s) { #\n");
+# }
+# $companswer =~ s|||g;
+ $studentTable.=' '.$title.' '.&mt('Correct answer').': '.$companswer;
+ }
}
my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},$udom,$uname);
if ($env{'form.lastSub'} eq 'datesub') {
if ($record{'version'} eq '') {
- $studentTable.=' '.&mt('No recorded submission for this problem.').' ';
+ my $msg = &mt('No recorded submission for this problem.');
+ if ($is_tool) {
+ $msg = &mt('No recorded transactions for this external tool');
+ }
+ $studentTable.=' '.$msg.' ';
} else {
my %responseType = ();
foreach my $partid (@{$parts}) {
@@ -5463,13 +5608,14 @@ sub displaySubByDates {
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_;
my $isCODE=0;
my $isTask = ($symb =~/\.task$/);
+ my $is_tool = ($symb =~/\.tool$/);
if (exists($record->{'resource.CODE'})) { $isCODE=1; }
my $studentTable=&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
''.&mt('Date/Time').' | '.
($isCODE?''.&mt('CODE').' | ':'').
($isTask?''.&mt('Version').' | ':'').
- ''.&mt('Submission').' | '.
+ ''.($is_tool?&mt('Grade'):&mt('Submission')).' | '.
''.&mt('Status').' | '.
&Apache::loncommon::end_data_table_header_row();
my ($version);
@@ -5477,7 +5623,11 @@ sub displaySubByDates {
my %orders;
$mark{'correct_by_student'} = $checkIcon;
if (!exists($$record{'1:timestamp'})) {
- return ' '.&mt('Nothing submitted - no attempts.').' ';
+ if ($is_tool) {
+ return ' '.&mt('No grade passed back.').' ';
+ } else {
+ return ' '.&mt('Nothing submitted - no attempts.').' ';
+ }
}
my $interaction;
@@ -5513,6 +5663,8 @@ sub displaySubByDates {
my @matchKey;
if ($isTask) {
@matchKey = sort(grep(/^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys));
+ } elsif ($is_tool) {
+ @matchKey = sort(grep(/^resource\.\Q$partid\E\.awarded$/,@versionKeys));
} else {
@matchKey = sort(grep(/^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys));
}
@@ -5521,48 +5673,51 @@ sub displaySubByDates {
foreach my $matchKey (@matchKey) {
if (exists($$record{$version.':'.$matchKey}) &&
$$record{$version.':'.$matchKey} ne '') {
-
- my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
- : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
- $displaySub[0].='';
- $displaySub[0].=''.&mt('Part: [_1]',$display_part).''
- .' '
- .'('.&mt('Response ID: [_1]',$responseId).')'
- .''
- .' ';
- if ($hidden) {
- $displaySub[0].= &mt('Anonymous Survey').'';
+ if ($is_tool) {
+ $displaySub[0].=$$record{"$version:resource.$partid.awarded"};
} else {
- my ($trial,$rndseed,$newvariation);
- if ($type eq 'randomizetry') {
- $trial = $$record{"$where.$partid.tries"};
- $rndseed = $$record{"$where.$partid.rndseed"};
- }
- if ($$record{"$where.$partid.tries"} eq '') {
- $displaySub[0].=&mt('Trial not counted');
- } else {
- $displaySub[0].=&mt('Trial: [_1]',
- $$record{"$where.$partid.tries"});
- if (($rndseed ne '') && ($lastrndseed{$partid} ne '')) {
- if (($rndseed ne $lastrndseed{$partid}) &&
- (($type eq 'randomizetry') || ($lasttype{$partid} eq 'randomizetry'))) {
- $newvariation = ' ('.&mt('New variation this try').')';
- }
+ my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
+ : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
+ $displaySub[0].='';
+ $displaySub[0].=''.&mt('Part: [_1]',$display_part).''
+ .' '
+ .'('.&mt('Response ID: [_1]',$responseId).')'
+ .''
+ .' ';
+ if ($hidden) {
+ $displaySub[0].= &mt('Anonymous Survey').'';
+ } else {
+ my ($trial,$rndseed,$newvariation);
+ if ($type eq 'randomizetry') {
+ $trial = $$record{"$where.$partid.tries"};
+ $rndseed = $$record{"$where.$partid.rndseed"};
}
- $lastrndseed{$partid} = $rndseed;
- $lasttype{$partid} = $type;
- }
- my $responseType=($isTask ? 'Task'
- : $responseType->{$partid}->{$responseId});
- if (!exists($orders{$partid})) { $orders{$partid}={}; }
- if ((!exists($orders{$partid}->{$responseId})) || ($trial)) {
- $orders{$partid}->{$responseId}=
- &get_order($partid,$responseId,$symb,$uname,$udom,
- $no_increment,$type,$trial,$rndseed);
- }
- $displaySub[0].=''.$newvariation.''; # /nobreak
- $displaySub[0].=' '.
- &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).' ';
+ if ($$record{"$where.$partid.tries"} eq '') {
+ $displaySub[0].=&mt('Trial not counted');
+ } else {
+ $displaySub[0].=&mt('Trial: [_1]',
+ $$record{"$where.$partid.tries"});
+ if (($rndseed ne '') && ($lastrndseed{$partid} ne '')) {
+ if (($rndseed ne $lastrndseed{$partid}) &&
+ (($type eq 'randomizetry') || ($lasttype{$partid} eq 'randomizetry'))) {
+ $newvariation = ' ('.&mt('New variation this try').')';
+ }
+ }
+ $lastrndseed{$partid} = $rndseed;
+ $lasttype{$partid} = $type;
+ }
+ my $responseType=($isTask ? 'Task'
+ : $responseType->{$partid}->{$responseId});
+ if (!exists($orders{$partid})) { $orders{$partid}={}; }
+ if ((!exists($orders{$partid}->{$responseId})) || ($trial)) {
+ $orders{$partid}->{$responseId}=
+ &get_order($partid,$responseId,$symb,$uname,$udom,
+ $no_increment,$type,$trial,$rndseed);
+ }
+ $displaySub[0].=''.$newvariation.''; # /nobreak
+ $displaySub[0].=' '.
+ &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).' ';
+ }
}
}
}
@@ -5577,14 +5732,22 @@ sub displaySubByDates {
lc($$record{"$where.$partid.award"}).' '.
$mark{$$record{"$where.$partid.solved"}}.
' ';
+ } elsif (($is_tool) && (exists($$record{"$version:resource.$partid.solved"}))) {
+ if ($$record{"$version:resource.$partid.solved"} =~ /^(in|)correct_by_passback$/) {
+ $displaySub[1].=&mt('Grade passed back by external tool');
+ }
}
if (exists $$record{"$where.$partid.regrader"}) {
- $displaySub[2].=$$record{"$where.$partid.regrader"}.
- ' ('.&mt('Part').': '.$display_part.')';
+ $displaySub[2].=$$record{"$where.$partid.regrader"};
+ unless ($is_tool) {
+ $displaySub[2].=' ('.&mt('Part').': '.$display_part.')';
+ }
} elsif ($$record{"$version:resource.$partid.regrader"} =~ /\S/) {
$displaySub[2].=
- $$record{"$version:resource.$partid.regrader"}.
- ' ('.&mt('Part').': '.$display_part.')';
+ $$record{"$version:resource.$partid.regrader"};
+ unless ($is_tool) {
+ $displaySub[2].=' ('.&mt('Part').': '.$display_part.')';
+ }
}
}
# needed because old essay regrader has not parts info
@@ -9343,7 +9506,7 @@ END
my @lines = &Apache::lonnet::get_scantronformat_file();
my $count = 0;
foreach my $line (@lines) {
- next if ($line =~ /^#/);
+ next if (($line =~ /^\#/) || ($line eq ''));
$singleline = $line;
$count ++;
}
@@ -9505,7 +9668,7 @@ sub validate_uploaded_scantron_file {
my %unique_formats;
my @formatlines = &Apache::lonnet::get_scantronformat_file();
foreach my $line (@formatlines) {
- chomp($line);
+ next if (($line =~ /^\#/) || ($line eq ''));
my @config = split(/:/,$line);
my $idstart = $config[5];
my $idlength = $config[6];
@@ -10143,12 +10306,13 @@ sub submit_options_table {
my ($request,$symb) = @_;
if (!$symb) {return '';}
&commonJSfunctions($request);
+ my $is_tool = ($symb =~ /ext\.tool$/);
my $result;
$result.='');
}
+#----- display problem, answer, and submissions for a single student (no grading)
+
+sub view_as_user {
+ my ($symb,$vuname,$vudom,$hasperm) = @_;
+ my $plainname = &Apache::loncommon::plainname($vuname,$vudom,'lastname');
+ my $displayname = &nameUserString('',$plainname,$vuname,$vudom);
+ my $output = &Apache::loncommon::get_student_view($symb,$vuname,$vudom,
+ $env{'request.course.id'},
+ undef,{'disable_submit' => 1}).
+ "\n\n".
+ ''.
+ ' '.$displayname.''.
+ "\n".
+ &Apache::loncommon::track_student_link('View recent activity',
+ $vuname,$vudom,'check').' '.
+ "\n";
+ if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) ||
+ (($env{'request.course.sec'} ne '') &&
+ &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.$env{'request.course.sec'}))) {
+ $output .= &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),
+ $vuname,$vudom,$symb,'check');
+ }
+ $output .= "\n";
+ my $companswer = &Apache::loncommon::get_student_answers($symb,$vuname,$vudom,
+ $env{'request.course.id'});
+ $companswer=~s| ||g;
+ $companswer=~s|name="submit"|name="would_have_been_submit"|g;
+ $output .= ' '.
+ ' '.&mt('Correct answer for[_1]',$displayname).''.
+ $companswer.
+ ''."\n";
+ my $is_tool = ($symb =~ /ext\.tool$/);
+ my ($essayurl,%coursedesc_by_cid);
+ (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb);
+ my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$vudom,$vuname);
+ my $res_error;
+ my ($partlist,$handgrade,$responseType,$numresp,$numessay) =
+ &response_type($symb,\$res_error);
+ my $fullname;
+ my $collabinfo;
+ if ($numessay) {
+ unless ($hasperm) {
+ &init_perm();
+ }
+ ($collabinfo,$fullname)=
+ &check_collaborators($symb,$vuname,$vudom,\%record,$handgrade,0);
+ unless ($hasperm) {
+ &reset_perm();
+ }
+ }
+ my $checkIcon = ' ';
+ my ($lastsubonly,$partinfo) =
+ &show_last_submission($vuname,$vudom,$symb,$essayurl,$responseType,'datesub',
+ '',$fullname,\%record,\%coursedesc_by_cid);
+ $output .= ' '.
+ ' '.&mt('Submissions').''."\n".$collabinfo."\n";
+ if (($numresp > $numessay) & !$is_tool) {
+ $output .=' '.
+ &mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon).
+ " \n";
+ }
+ $output .= $partinfo;
+ $output .= $lastsubonly;
+ $output .= &displaySubByDates($symb,\%record,$partlist,$responseType,$checkIcon,$vuname,$vudom);
+ $output .= ' '."\n";
+ return $output;
+}
+
sub handler {
my $request=$_[0];
&reset_caches();
|