--- loncom/homework/grades.pm 2017/12/18 14:46:10 1.744
+++ loncom/homework/grades.pm 2017/12/18 23:51:24 1.745
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.744 2017/12/18 14:46:10 raeburn Exp $
+# $Id: grades.pm,v 1.745 2017/12/18 23:51:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -116,7 +116,11 @@ sub getpartlist {
my $res = $navmap->getBySymb($symb);
my $partlist = $res->parts();
my $url = $res->src();
- my @metakeys = split(/,/,&Apache::lonnet::metadata($url,'keys'));
+ my $toolsymb;
+ if ($url =~ /ext\.tool$/) {
+ $toolsymb = $symb;
+ }
+ my @metakeys = split(/,/,&Apache::lonnet::metadata($url,'keys',$toolsymb));
my @stores;
foreach my $part (@{ $partlist }) {
@@ -852,6 +856,7 @@ sub verifyreceipt {
sub listStudents {
my ($request,$symb,$submitonly) = @_;
+ my ($is_tool) = ($symb =~ /ext\.tool$/);
my $cdom = $env{"course.$env{'request.course.id'}.domain"};
my $cnum = $env{"course.$env{'request.course.id'}.num"};
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
@@ -907,38 +912,66 @@ LISTJAVASCRIPT
"\n";
$gradeTable .= &Apache::lonhtmlcommon::start_pick_box();
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text'))
- .''."\n"
- .''."\n"
- .'
'."\n"
- .&Apache::lonhtmlcommon::row_closure();
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Answer'))
- .''."\n"
- .''."\n"
- .'
'."\n"
- .&Apache::lonhtmlcommon::row_closure();
+ unless ($is_tool) {
+ $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text'))
+ .''."\n"
+ .''."\n"
+ .'
'."\n"
+ .&Apache::lonhtmlcommon::row_closure();
+ $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Answer'))
+ .''."\n"
+ .''."\n"
+ .'
'."\n"
+ .&Apache::lonhtmlcommon::row_closure();
+ }
my $submission_options;
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status;
$env{'form.Status'} = $saveStatus;
+ my %optiontext;
+ if ($is_tool) {
+ %optiontext = &Apache::lonlocal::texthash (
+ lastonly => 'last transaction',
+ last => 'last transaction with details',
+ datesub => 'all transactions',
+ all => 'all transactions with details',
+ );
+ } else {
+ %optiontext = &Apache::lonlocal::texthash (
+ lastonly => 'last submission',
+ last => 'last submission with details',
+ datesub => 'all submissions',
+ all => 'all submissions with details',
+ );
+ }
$submission_options.=
''.
''."\n".
+ $optiontext{'lastonly'}.' '."\n".
''.
''."\n".
+ $optiontext{'last'}.' '."\n".
''.
''."\n".
+ $optiontext{'datesub'}.''."\n".
''.
'';
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Submissions'))
+ $optiontext{'all'}.'';
+ my $viewtitle;
+ if ($is_tool) {
+ $viewtitle = &mt('View Transactions');
+ } else {
+ $viewtitle = &mt('View Submissions');
+ }
+ $gradeTable .= &Apache::lonhtmlcommon::row_title($viewtitle)
.$submission_options
.&Apache::lonhtmlcommon::row_closure();
+ my $closure;
+ if (($is_tool) && (exists($env{'form.Status'}))) {
+ $closure = 1;
+ }
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Grading Increments'))
.''
- .&Apache::lonhtmlcommon::row_closure();
+ .&Apache::lonhtmlcommon::row_closure($closure);
$gradeTable .=
&build_section_inputs().
@@ -957,19 +990,30 @@ LISTJAVASCRIPT
if (exists($env{'form.Status'})) {
$gradeTable .= ''."\n";
} else {
+ if ($is_tool) {
+ $closure = 1;
+ }
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status'))
.&Apache::lonhtmlcommon::StatusOptions(
$saveStatus,undef,1,'javascript:reLoadList(this.form);')
- .&Apache::lonhtmlcommon::row_closure();
+ .&Apache::lonhtmlcommon::row_closure($closure);
}
- $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Check For Plagiarism'))
- .''
- .&Apache::lonhtmlcommon::row_closure(1)
- .&Apache::lonhtmlcommon::end_pick_box();
-
+ unless ($is_tool) {
+ $closure = 1;
+ $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Check For Plagiarism'))
+ .''
+ .&Apache::lonhtmlcommon::row_closure($closure);
+ }
+ $gradeTable .= &Apache::lonhtmlcommon::end_pick_box();
+ my $regrademsg;
+ if ($is_tool) {
+ $regrademsg =&mt("To view/grade/regrade, click on the check box(es) next to the student's name(s). Then click on the Next button.");
+ } else {
+ $regrademsg = &mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.");
+ }
$gradeTable .= '
' - .&mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n" + .$regrademsg."\n" .'' .'
'; @@ -1977,6 +2021,7 @@ sub submission { my $probtitle=&Apache::lonnet::gettitle($symb); if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } + my ($is_tool) = ($symb =~ /ext\.tool$/); if (!&canview($usec)) { $request->print( @@ -1989,8 +2034,10 @@ sub submission { } if (!$env{'form.lastSub'}) { $env{'form.lastSub'} = 'datesub'; } - if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; } - if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; } + unless ($is_tool) { + if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; } + if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; } + } my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : ''); my $checkIcon = '' - .'' .&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon) ."
\n"; @@ -2178,7 +2229,7 @@ sub submission { my $fullname; my $col_fullnames = []; # if ($env{'form.handgrade'} eq 'yes') { - if (1) { + unless ($is_tool) { (my $sub_result,$fullname,$col_fullnames)= &check_collaborators($symb,$uname,$udom,\%record,$handgrade, $counter); @@ -2193,12 +2244,16 @@ sub submission { # (3) Last submission plus the parts info # (4) The whole record for this student - my ($string,$timestamp)= &get_last_submission(\%record); + my ($string,$timestamp)= &get_last_submission(\%record,$is_tool); my $lastsubonly; if ($$timestamp eq '') { $lastsubonly.='