--- loncom/homework/grades.pm 2011/11/14 03:08:01 1.663 +++ loncom/homework/grades.pm 2011/12/21 21:25:36 1.667 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.663 2011/11/14 03:08:01 raeburn Exp $ +# $Id: grades.pm,v 1.667 2011/12/21 21:25:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -6909,7 +6909,7 @@ sub scantron_get_correction { .&mt('The ID on the form is [_1]', "$$scan_record{'scantron.ID'}") .'
' - .&mt('The name on the paper is [_2], [_3]', + .&mt('The name on the paper is [_1], [_2]', $$scan_record{'scantron.LastName'}, $$scan_record{'scantron.FirstName'}) .'

'; @@ -7750,11 +7750,8 @@ SCANTRONFORM my $lock=&Apache::lonnet::set_lock(&mt('Grading bubblesheet exam')); my $count=&get_todo_count($scanlines,$scan_data); - my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Bubblesheet Status', - 'Bubblesheet Progress',$count, - 'inline',undef,'scantronupload'); - &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, - 'Processing first student'); + my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count); + &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,'Processing first student'); $r->print('
'); my $start=&Time::HiRes::time(); my $i=-1; @@ -7786,8 +7783,7 @@ SCANTRONFORM my $line=&scantron_get_line($scanlines,$scan_data,$i); if ($line=~/^[\s\cz]*$/) { next; } if ($started) { - &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, - 'last student'); + &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student'); } $started=1; my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, @@ -8278,9 +8274,7 @@ sub checkscantron_results { my %completedstudents; my $count=&Apache::grades::get_todo_count($scanlines,$scan_data); - my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Bubblesheet/Submissions Comparison Status', - 'Progress of Bubblesheet Data/Submission Records Comparison',$count, - 'inline',undef,'checkscantron'); + my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count); my ($username,$domain,$started); my $nav_error; &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse. @@ -8289,8 +8283,7 @@ sub checkscantron_results { return ''; } - &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, - 'Processing first student'); + &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,'Processing first student'); my $start=&Time::HiRes::time(); my $i=-1; @@ -8300,8 +8293,7 @@ sub checkscantron_results { my $line=&Apache::grades::scantron_get_line($scanlines,$scan_data,$i); if ($line=~/^[\s\cz]*$/) { next; } if ($started) { - &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, - 'last student'); + &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student'); } $started=1; my $scan_record= @@ -8913,7 +8905,8 @@ sub process_clicker { my $pincorrect=&mt("Percentage points for incorrect solution"); my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype', {'iclicker' => 'i>clicker', - 'interwrite' => 'interwrite PRS'}); + 'interwrite' => 'interwrite PRS', + 'turning' => 'Turning Technologies'}); $symb = &Apache::lonenc::check_encrypt($symb); $result.= &Apache::lonhtmlcommon::scripttag(<'. ''. &mt('Awarding [_1] percent for correct and [_2] percent for incorrect responses', @@ -9223,6 +9219,32 @@ sub interwrite_eval { return ($errormsg,$number); } +sub turning_eval { + my ($questiontitles,$responses)=@_; + my $number=0; + my $errormsg=''; + foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { + my %components=&Apache::loncommon::record_sep($line); + my @entries=map {$components{$_}} (sort(keys(%components))); + if ($#entries>$number) { $number=$#entries; } + my $id=$entries[0]; + my @idresponses; + $id=~s/^[\#0]+//; + unless ($id) { next; } + for (my $idx=1;$idx<=$#entries;$idx++) { + $entries[$idx]=~s/\,/\;/g; + $entries[$idx]=~s/[^a-zA-Z0-9\.\*\-\+\;]+//g; + push(@idresponses,$entries[$idx]); + } + $$responses{$id}=join(',',@idresponses); + } + for (my $i=1; $i<=$number; $i++) { + $$questiontitles[$i]=&mt('Question [_1]',$i); + } + return ($errormsg,$number); +} + + sub assign_clicker_grades { my ($r,$symb)=@_; if (!$symb) {return '';} @@ -9388,23 +9410,25 @@ sub handler { } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); +# see what command we need to execute + + my @commands=&Apache::loncommon::get_env_multiple('form.command'); + my $command=$commands[0]; + &init_perm(); if (!$env{'request.course.id'}) { - # Not in a course. - $env{'user.error.msg'}="/adm/grades::vgr:0:0:Cannot display grades page outside course context"; - return HTTP_NOT_ACCEPTABLE; + unless ((&Apache::lonnet::allowed('usc',$env{'request.role.domain'})) && + ($command =~ /^scantronupload/)) { + # Not in a course. + $env{'user.error.msg'}="/adm/grades::vgr:0:0:Cannot display grades page outside course context"; + return HTTP_NOT_ACCEPTABLE; + } } elsif (!%perm) { $request->internal_redirect('/adm/quickgrades'); } &Apache::loncommon::content_type($request,'text/html'); $request->send_http_header; - -# see what command we need to execute - - my @commands=&Apache::loncommon::get_env_multiple('form.command'); - my $command=$commands[0]; - if ($#commands > 0) { &Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); }