--- loncom/homework/grades.pm 2022/02/09 23:50:00 1.596.2.12.2.60 +++ loncom/homework/grades.pm 2024/08/23 20:52:28 1.596.2.12.2.60.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.596.2.12.2.60 2022/02/09 23:50:00 raeburn Exp $ +# $Id: grades.pm,v 1.596.2.12.2.60.2.6 2024/08/23 20:52:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,9 +46,9 @@ use Apache::lonenc; use Apache::lonstathelpers; use Apache::bridgetask(); use Apache::lontexconvert(); +use String::Similarity; use HTML::Parser(); use File::MMagic; -use String::Similarity; use LONCAPA; use POSIX qw(floor); @@ -118,7 +118,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 }) { @@ -299,7 +303,7 @@ sub showResourceInfo { } else { return '
'; } - } + } return $result; } @@ -586,7 +590,7 @@ sub cleanRecord { return $result; } } elsif ( $response =~ m/(?:numerical|formula|custom)/) { - # Respect multiple input fields, see Bug #5409 + # Respect multiple input fields, see Bug #5409 $answer = &Apache::loncommon::format_previous_attempt_value('submission', $answer); @@ -1037,6 +1041,7 @@ sub verifyreceipt { sub listStudents { my ($request,$symb,$submitonly,$divforres) = @_; + 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'}; @@ -1103,26 +1108,38 @@ LISTJAVASCRIPT "\n".$table; $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 $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status; $env{'form.Status'} = $saveStatus; - my %optiontext = &Apache::lonlocal::texthash ( + 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', ); + } my $submission_options = ''. '