--- loncom/homework/grades.pm 2023/03/10 23:36:22 1.596.2.12.2.60.2.3 +++ loncom/homework/grades.pm 2024/07/01 22:29:01 1.795 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.596.2.12.2.60.2.3 2023/03/10 23:36:22 raeburn Exp $ +# $Id: grades.pm,v 1.795 2024/07/01 22:29:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,11 +44,12 @@ use Apache::Constants qw(:common :http); use Apache::lonlocal; use Apache::lonenc; use Apache::lonstathelpers; +use Apache::lonquickgrades; 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 +119,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 }) { @@ -142,7 +147,6 @@ sub nameUserString { } #--- Get the partlist and the response type for a given problem. --- -#--- Indicate if a response type is coded handgraded or not. --- #--- Count responseIDs, essayresponse items, and dropbox items --- #--- Sets response_error pointer to "1" if navmaps object broken --- sub response_type { @@ -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 = ''. '