--- loncom/homework/grades.pm 2014/02/27 01:39:48 1.722
+++ 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.722 2014/02/27 01:39:48 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 }) {
@@ -293,7 +297,7 @@ sub reset_caches {
}
sub scantron_partids_tograde {
- my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row) = @_;
+ my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row,$scancode) = @_;
my (%analysis,@parts);
if (ref($resource)) {
my $symb = $resource->symb();
@@ -301,6 +305,13 @@ sub reset_caches {
if ($check_for_randomlist) {
$add_to_form = { 'check_parts_withrandomlist' => 1,};
}
+ if ($scancode) {
+ if (ref($add_to_form) eq 'HASH') {
+ $add_to_form->{'code_for_randomlist'} = $scancode;
+ } else {
+ $add_to_form = { 'code_for_randomlist' => $scancode,};
+ }
+ }
my $analyze =
&get_analyze($symb,$uname,$udom,undef,$add_to_form,
undef,undef,undef,$bubbles_per_row);
@@ -406,8 +417,7 @@ sub cleanRecord {
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
$env{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob.
}
- $answer =~ s-\n-
-g;
- return '
'.&keywords_highlight(&HTML::Entities::encode($answer, '"<>&')).''; + return '
'.&keywords_highlight($answer).''; } elsif ( $response eq 'organic') { my $result=&mt('Smile representation: [_1]', @@ -846,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'}; @@ -858,10 +869,11 @@ sub listStudents { my $res_error; my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error); - my %lt = &Apache::lonlocal::texthash ( + my %js_lt = &Apache::lonlocal::texthash ( 'multiple' => 'Please select a student or group of students before clicking on the Next button.', 'single' => 'Please select the student before clicking on the Next button.', ); + &js_escape(\%js_lt); $request->print(&Apache::lonhtmlcommon::scripttag(<
' - .&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" .'' .'
'; @@ -1178,7 +1229,8 @@ sub processGroup { #--- Javascript to handle the submission page functionality --- sub sub_page_js { my $request = shift; - my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); + my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); + &js_escape(\$alertmsg); $request->print(&Apache::lonhtmlcommon::scripttag(<$lt{'incl'}<\\/b><\\/td> | $lt{'type'}<\\/b><\\/td> | $lt{'mesa'}<\\/td><\\/tr>"); + pDoc.write(" | $html_js_lt{'incl'}<\\/b><\\/td> | $html_js_lt{'type'}<\\/b><\\/td> | $html_js_lt{'mesa'}<\\/td><\\/tr>");
}
function displaySubject(msg,shwsel) {
pDoc = pWin.document;
pDoc.write("<\\/td>");
- pDoc.write(" | $lt{'subj'}<\\/td>");
+ pDoc.write(" | $html_js_lt{'subj'}<\\/td>");
pDoc.write(" | <\\/td><\\/tr>");
}
@@ -1590,7 +1645,7 @@ INNERJS
pDoc = pWin.document;
pDoc.write(" | <\\/td>");
- pDoc.write(" | $lt{'new'}<\\/td>");
+ pDoc.write(" | $html_js_lt{'new'}<\\/td>");
pDoc.write(" | |