--- loncom/homework/grades.pm 2011/09/23 04:53:48 1.652 +++ loncom/homework/grades.pm 2011/11/14 03:08:01 1.663 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.652 2011/09/23 04:53:48 raeburn Exp $ +# $Id: grades.pm,v 1.663 2011/11/14 03:08:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,6 +45,7 @@ use Apache::lonlocal; use Apache::lonenc; use Apache::lonstathelpers; use Apache::lonquickgrades; +use Apache::bridgetask(); use String::Similarity; use LONCAPA; @@ -340,7 +341,7 @@ sub cleanRecord { return '
'. ''.$toprow.''. ''. - $grayFont.$bottomrow.''.'
'.&mt('Answer').'
'.$grayFont.&mt('Option ID').'
'; + $bottomrow.''; } elsif ($response eq 'match') { my %answer=&Apache::lonnet::str2hash($answer); my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); @@ -362,7 +363,7 @@ sub cleanRecord { ''.$grayFont.&mt('Item ID').''. $middlerow.''. ''.$grayFont.&mt('Option ID').''. - $bottomrow.''.''; + $bottomrow.''; } elsif ($response eq 'radiobutton') { my %answer=&Apache::lonnet::str2hash($answer); my ($toprow,$bottomrow); @@ -383,7 +384,7 @@ sub cleanRecord { return '
'. ''.$toprow.''. ''. - $bottomrow.''.'
'.&mt('Answer').'
'.$grayFont.&mt('Option ID').'
'; + $bottomrow.''; } elsif ($response eq 'essay') { if (! exists ($env{'form.'.$symb})) { my (%keyhash) = &Apache::lonnet::dump('nohist_handgrade', @@ -1414,6 +1415,7 @@ INNERJS adds => 'Add selection to keyword list? Edit if desired.', comp => 'Compose Message for: ', incl => 'Include', + type => 'Type', subj => 'Subject', mesa => 'Message', new => 'New', @@ -1422,6 +1424,7 @@ INNERJS kehi => 'Keyword Highlight Options', txtc => 'Text Color', font => 'Font Size', + fnst => 'Font Style', ); $request->print(&Apache::lonhtmlcommon::scripttag(<'); pDoc.write(''); - pDoc.write("
Type<\\/b><\\/td>$lt{'incl'}<\\/b><\\/td>$lt{'mesa'}<\\/td><\\/tr>"); + pDoc.write("$lt{'type'}<\\/b><\\/td>$lt{'incl'}<\\/b><\\/td>$lt{'mesa'}<\\/td><\\/tr>"); } function displaySubject(msg,shwsel) { pDoc = pWin.document; @@ -1628,7 +1631,7 @@ INNERJS hDoc.write(''. &Apache::loncommon::end_data_table_header_row()."\n". &Apache::loncommon::start_data_table_row(). - ''. - ''. + ''. + ''. &Apache::loncommon::end_data_table_row(). &Apache::loncommon::start_data_table_row(). - ''. - ''."\n". + ''. + ''."\n". &Apache::loncommon::end_data_table_row(). &Apache::loncommon::end_data_table().'

'); } else { @@ -7886,6 +7977,9 @@ sub grade_student_bubbles { if ($bubbles_per_row ne '') { $form{'bubbles_per_row'} = $bubbles_per_row; } + if ($env{'form.scantron_lastbubblepoints'} ne '') { + $form{'scantron_lastbubblepoints'} = $env{'form.scantron_lastbubblepoints'}; + } if (ref($parts) eq 'HASH') { if (ref($parts->{$ressymb}) eq 'ARRAY') { foreach my $part (@{$parts->{$ressymb}}) { @@ -9604,7 +9698,7 @@ ssi_with_retries() =item scantron_process_students() : - Routine that does the actual grading of the bubble sheet information. + Routine that does the actual grading of the bubblesheet information. The parsed scanline hash is added to %env @@ -9624,7 +9718,7 @@ ssi_with_retries() =item scantron_upload_scantron_data() : - Creates the screen for adding a new bubble sheet data file to a course. + Creates the screen for adding a new bubblesheet data file to a course. =item scantron_upload_scantron_data_save() : @@ -9638,7 +9732,7 @@ ssi_with_retries() =item scantron_download_scantron_data() : Shows a list of the three internal files (original, corrected, - skipped) for a specific bubble sheet data file that exists in the + skipped) for a specific bubblesheet data file that exists in the course. =item scantron_validate_ID() :
'); hDoc.write(''); - hDoc.write("'; } + my $lastbubblepoints; + if ($env{'form.scantron_lastbubblepoints'} ne '') { + $lastbubblepoints = + ''; + } return ('

@@ -6198,7 +6240,7 @@ sub scantron_warning_screen {

$lt{'txtc'}<\\/b><\\/td>$lt{'font'}<\\/b><\\/td>Font Style<\\/td><\\/tr>"); + hDoc.write("$lt{'txtc'}<\\/b><\\/td>$lt{'font'}<\\/b><\\/td>$lt{'fnst'}<\\/td><\\/tr>"); } function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) { @@ -1775,9 +1778,10 @@ sub handback_box { my $prefix = $counter.'_'.$partid.'_'.$respid.'_'; my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record); next if (!@$files); - my $file_counter = 1; + my $file_counter = 0; foreach my $file (@$files) { if ($file =~ /\/portfolio\//) { + $file_counter++; my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|); my ($name,$version,$ext) = &file_name_version_ext($file_disp); $file_disp = "$name.$ext"; @@ -1785,11 +1789,14 @@ sub handback_box { $result.=&mt('Return commented version of [_1] to student.', ''.$file_disp.''); $result.=''."\n"; - $result.='
'; - $result.='('.&mt('File will be uploaded when you click on Save & Next below.').')
'; - $file_counter++; + $result.='
'."\n"; } } + if ($file_counter) { + $result .= ''."\n". + ''. + '('.&mt('File(s) will be uploaded when you click on Save & Next below.',$file_counter).')

'; + } } return $result; } @@ -2018,15 +2025,16 @@ sub submission { my %lt = &Apache::lonlocal::texthash( keyw => 'Keyword Options', + list => 'List', past => 'Paste Selection to List', - high => 'Hightlight Attribute', + high => 'Highlight Attribute', ); # # Print out the keyword options line # $request->print(<$lt{'keyw'}:  -List    +$lt{'list'}    $lt{'past'}    $lt{'high'}

@@ -2729,7 +2737,7 @@ sub processHandGrade { $ctr++; } if ($total < 0) { - my $the_end.=&mt('Message: No more students for this section or class.').'

'."\n"; + my $the_end.='

'.&mt('[_1]Message:[_2] No more students for this section or class.','','').'

'."\n"; $request->print($the_end); } return ''; @@ -2880,63 +2888,79 @@ sub handback_files { $request->print('
'.&navmap_errormsg().'
'); return; } + my @handedback; + my $file_msg; my @part_response_id = &flatten_responseType($responseType); foreach my $part_response_id (@part_response_id) { my ($part_id,$resp_id) = @{ $part_response_id }; my $part_resp = join('_',@{ $part_response_id }); - if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part eq $part_id)) { - # if multiple files are uploaded names will be 'returndoc2','returndoc3' - my $file_counter = 1; - my $file_msg; - while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { - my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; + if (($env{'form.'.$newflg.'_'.$part_resp.'_countreturndoc'} =~ /^\d+$/) & ($new_part eq $part_id)) { + for (my $counter=1; $counter<=$env{'form.'.$newflg.'_'.$part_resp.'_countreturndoc'}; $counter++) { + # if multiple files are uploaded names will be 'returndoc2','returndoc3' + if ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$counter}) { + my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$counter.'.filename'}; my ($directory,$answer_file) = - ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/); + ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter} =~ /^(.*?)([^\/]*)$/); my ($answer_name,$answer_ver,$answer_ext) = &file_name_version_ext($answer_file); my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/); my $getpropath = 1; - my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,$domain,$stuname,$getpropath); - my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); + my ($dir_list,$listerror) = + &Apache::lonnet::dirlist($portfolio_root.$portfolio_path, + $domain,$stuname,$getpropath); + my $version = &get_next_version($answer_name,$answer_ext,$dir_list); # fix file name my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/); my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain, - $newflg.'_'.$part_resp.'_returndoc'.$file_counter, + $newflg.'_'.$part_resp.'_returndoc'.$counter, $save_file_name); if ($result !~ m|^/uploaded/|) { $request->print('
'. &mt('An error occurred ([_1]) while trying to upload [_2].', - $result,$newflg.'_'.$part_resp.'_returndoc'.$file_counter). + $result,$newflg.'_'.$part_resp.'_returndoc'.$counter). ''); } else { # mark the file as read only - my @files = ($save_file_name); - my @what = ($symb,$env{'request.course.id'},'handback'); - &Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); + push(@handedback,$save_file_name); if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) { $$newrecord{"resource.$new_part.$resp_id.handback"}.=','; } $$newrecord{"resource.$new_part.$resp_id.handback"} .= $save_file_name; - $file_msg.= "\n".'
'.$save_file_name."
"; - + $file_msg.= ''.$save_file_name."
"; } - $request->print('
'.&mt('[_1] will be the uploaded file name [_2]',''.$fname.'',''.$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}.'')); - $file_counter++; + $request->print('
'.&mt('[_1] will be the uploaded file name [_2]',''.$fname.'',''.$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter}.'')); } - my $subject = "File Handed Back by Instructor "; - my $message = "A file has been returned that was originally submitted in reponse to:
"; - $message .= "".&Apache::lonnet::gettitle($symb)."
"; - $message .= ' The returned file(s) are named: '. $file_msg; - $message .= " and can be found in your portfolio space."; - my ($feedurl,$showsymb) = - &get_feedurl_and_symb($symb,$domain,$stuname); - my $restitle = &Apache::lonnet::gettitle($symb); - my $msgstatus = - &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject. - ' (File Returned) ['.$restitle.']',$message,undef, - $feedurl,undef,undef,undef,$showsymb,$restitle); } } + } + if (@handedback > 0) { + $request->print('
'); + my @what = ($symb,$env{'request.course.id'},'handback'); + &Apache::lonnet::mark_as_readonly($domain,$stuname,\@handedback,\@what); + my $user_lh = &Apache::loncommon::user_lang($stuname,$domain,$env{'request.course.id'}); + my ($subject,$message); + if (scalar(@handedback) == 1) { + $subject = &mt_user($user_lh,'File Handed Back by Instructor'); + $message = &mt_user($user_lh,'A file has been returned that was originally submitted in response to: '); + } else { + $subject = &mt_user($user_lh,'Files Handed Back by Instructor'); + $message = &mt_user($user_lh,'Files have been returned that were originally submitted in response to: '); + } + $message .= "

".&Apache::lonnet::gettitle($symb)."

"; + $message .= &mt_user($user_lh,'The returned file(s) are named: [_1]',"
$file_msg
"). + &mt_user($user_lh,'The file(s) can be found in your [_1]portfolio[_2].','',''); + my ($feedurl,$showsymb) = + &get_feedurl_and_symb($symb,$domain,$stuname); + my $restitle = &Apache::lonnet::gettitle($symb); + $subject .= ' '.&mt_user($user_lh,'(File Returned)').' ['.$restitle.']'; + my $msgstatus = + &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject, + $message,undef,$feedurl,undef,undef,undef,$showsymb, + $restitle); + if ($msgstatus) { + $request->print(&mt('Notification message status: [_1]',''.$msgstatus.'').'
'); + } + } return; } @@ -3045,8 +3069,10 @@ sub version_portfiles { my ($answer_name,$answer_ver,$answer_ext) = &file_name_version_ext($answer_file); my $getpropath = 1; - my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,$stu_name,$getpropath); - my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); + my ($dir_list,$listerror) = + &Apache::lonnet::dirlist($portfolio_root.$directory,$domain, + $stu_name,$getpropath); + my $version = &get_next_version($answer_name,$answer_ext,$dir_list); my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version); if ($new_answer ne 'problem getting file') { push(@versioned_portfiles, $directory.$new_answer); @@ -3065,21 +3091,24 @@ sub version_portfiles { sub get_next_version { my ($answer_name, $answer_ext, $dir_list) = @_; my $version; - foreach my $row (@$dir_list) { - my ($file) = split(/\&/,$row,2); - my ($file_name,$file_version,$file_ext) = - &file_name_version_ext($file); - if (($file_name eq $answer_name) && - ($file_ext eq $answer_ext)) { - # gets here if filename and extension match, regardless of version + if (ref($dir_list) eq 'ARRAY') { + foreach my $row (@{$dir_list}) { + my ($file) = split(/\&/,$row,2); + my ($file_name,$file_version,$file_ext) = + &file_name_version_ext($file); + if (($file_name eq $answer_name) && + ($file_ext eq $answer_ext)) { + # gets here if filename and extension match, + # regardless of version if ($file_version ne '') { - # a versioned file is found so save it for later - if ($file_version > $version) { - $version = $file_version; - } + # a versioned file is found so save it for later + if ($file_version > $version) { + $version = $file_version; + } + } } } - } + } $version ++; return($version); } @@ -4068,6 +4097,7 @@ sub csvuploadassign { my ($classlist) = &getclasslist('all',0); my @notallowed; my @skipped; + my @warnings; my $countdone=0; foreach my $grade (@gradedata) { my %entries=&Apache::loncommon::record_sep($grade); @@ -4117,7 +4147,7 @@ sub csvuploadassign { my $award=($pcr == 0) ? 'incorrect_by_override' : 'correct_by_override'; if ($pcr>1) { - push(@skipped,&mt("[_1]: point value larger than weight","$username:$domain")); + push(@warnings,&mt("[_1]: point value larger than weight","$username:$domain")); } $grades{"resource.$part.awarded"}=$pcr; $grades{"resource.$part.solved"}=$award; @@ -4163,6 +4193,10 @@ sub csvuploadassign { } } $request->print('
'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0)); + if (@warnings) { + $request->print('
'.&Apache::lonhtmlcommon::confirm_success(&mt('Warnings generated for the following saved scores:'),1).'
'); + $request->print(join(', ',@warnings)); + } if (@skipped) { $request->print('
'.&Apache::lonhtmlcommon::confirm_success(&mt('No scores stored for the following username(s):'),1).'
'); $request->print(join(', ',@skipped)); @@ -4810,12 +4844,12 @@ sub updateGradeByPage { from the file that we are parsing that represents one entire sheet 'bubble line' refers to the data - representing the line of bubbles that are on the physical bubble sheet + representing the line of bubbles that are on the physical bubblesheet -The overall process is that a scanned in bubble sheet data is uploaded +The overall process is that a scanned in bubblesheet data is uploaded into a course. When a user wants to grade, they select a -sequence/folder of resources, a file of bubble sheet info, and pick +sequence/folder of resources, a file of bubblesheet info, and pick one of the predefined configurations for what each scanline looks like. @@ -4831,14 +4865,14 @@ username:domain. During the validation phase the instructor can choose to skip scanlines. -After the validation phase, there are now 3 bubble sheet files +After the validation phase, there are now 3 bubblesheet files scantron_original_filename (unmodified original file) scantron_corrected_filename (file where the corrected information has replaced the original information) scantron_skipped_filename (contains the exact text of scanlines that where skipped) Also there is a separate hash nohist_scantrondata that contains extra -correction information that isn't representable in the bubble sheet +correction information that isn't representable in the bubblesheet file (see &scantron_getfile() for more information) After all scanlines are either valid, marked as valid or skipped, then @@ -4972,14 +5006,16 @@ sub scantron_filenames { my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; my $getpropath = 1; - my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, - $getpropath); + my ($dirlist,$listerror) = &Apache::lonnet::dirlist('userfiles',$cdom, + $cname,$getpropath); my @possiblenames; - foreach my $filename (sort(@files)) { - ($filename)=split(/&/,$filename); - if ($filename!~/^scantron_orig_/) { next ; } - $filename=~s/^scantron_orig_//; - push(@possiblenames,$filename); + if (ref($dirlist) eq 'ARRAY') { + foreach my $filename (sort(@{$dirlist})) { + ($filename)=split(/&/,$filename); + if ($filename!~/^scantron_orig_/) { next ; } + $filename=~s/^scantron_orig_//; + push(@possiblenames,$filename); + } } return @possiblenames; } @@ -5133,7 +5169,7 @@ sub scantron_CODEunique { =item scantron_selectphase - Generates the initial screen to start the bubble sheet process. + Generates the initial screen to start the bubblesheet process. Allows for - starting a grading run. - downloading existing scan data (original, corrected or skipped info) @@ -6155,7 +6191,7 @@ sub remember_current_skipped { =item check_for_error Checks if there was an error when attempting to remove a specific - scantron_.. bubble sheet data file. Prints out an error if + scantron_.. bubblesheet data file. Prints out an error if something went wrong. =cut @@ -6190,6 +6226,12 @@ sub scantron_warning_screen { '
'.&mt('List of CODES to validate against:').''. $env{'form.scantron_CODElist'}.'
'.&mt('Hand-graded items: points from last bubble in row').''. + $env{'form.scantron_lastbubblepoints'}.'
-'.$CODElist.' +'.$CODElist.$lastbubblepoints.'
'.&mt('Sequence to be Graded:').''.$title.'
'.&mt('Data File that will be used:').''.$env{'form.scantron_selectfile'}.'

'.&mt('If this information is correct, please click on \'[_1]\'.',&mt($button_text)).'
'.&mt('If something is incorrect, please return to [_1]Grade/Manage/Review Bubblesheets[_2] to start over.','','').'

@@ -6236,8 +6278,9 @@ sub scantron_do_warning { } } else { my $warning=&scantron_warning_screen('Grading: Validate Records',$symb); + my $bubbledbyhand=&hand_bubble_option(); $r->print(' -'.$warning.' +'.$warning.$bubbledbyhand.' '); @@ -6289,7 +6332,7 @@ SCANTRONFORM =item scantron_validate_file - Dispatch routine for doing validation of a bubble sheet data file. + Dispatch routine for doing validation of a bubblesheet data file. Also processes any necessary information resets that need to occur before validation begins (ignore previous corrections, @@ -6333,6 +6376,9 @@ sub scantron_validate_file { return ''; } my $result=&scantron_form_start($max_bubble).$default_form_data; + if ($env{'form.scantron_lastbubblepoints'} ne '') { + $result .= ''; + } $r->print($result); my @validate_phases=( 'sequence', @@ -6400,7 +6446,7 @@ sub scantron_validate_file { =item scantron_remove_file - Removes the requested bubble sheet data file, makes sure that + Removes the requested bubblesheet data file, makes sure that scantron_original_ is never removed @@ -6425,7 +6471,7 @@ sub scantron_remove_file { =item scantron_remove_scan_data - Removes all scan_data correction for the requested bubble sheet + Removes all scan_data correction for the requested bubblesheet data file. (In the case that both the are doing skipped records we need to remember the old skipped lines for the time being so that element persists for a while.) @@ -6462,7 +6508,7 @@ sub scantron_remove_scan_data { =item scantron_getfile - Fetches the requested bubble sheet data file (all 3 versions), and + Fetches the requested bubblesheet data file (all 3 versions), and the scan_data hash Arguments: @@ -6562,7 +6608,7 @@ sub lonnet_putfile { =item scantron_putfile - Stores the current version of the bubble sheet data files, and the + Stores the current version of the bubblesheet data files, and the scan_data hash. (Does not modify the original version only the corrected and skipped versions. @@ -6656,7 +6702,7 @@ sub get_todo_count { =item scantron_put_line - Updates the 'corrected' or 'skipped' versions of the bubble sheet + Updates the 'corrected' or 'skipped' versions of the bubblesheet data file. Arguments: @@ -6845,19 +6891,28 @@ sub scantron_get_correction { #the previous one or the current one if ( $$scan_record{'scantron.PaperID'} =~ /\S/) { - $r->print("

".&mt("An error was detected ($error)". - " for PaperID [_1]", - $$scan_record{'scantron.PaperID'})."

\n"); + $r->print( + '

' + .&mt('An error was detected ([_1]) for PaperID [_2]', + "$error", + ''.$$scan_record{'scantron.PaperID'}.'') + ."

\n"); } else { - $r->print("

".&mt("An error was detected ($error)". - " in scanline [_1]

[_2]
", - $i,$line)."

\n"); - } - my $message="

".&mt("The ID on the form is [_1]
". - "The name on the paper is [_2],[_3]", - $$scan_record{'scantron.ID'}, - $$scan_record{'scantron.LastName'}, - $$scan_record{'scantron.FirstName'})."

"; + $r->print( + '

' + .&mt('An error was detected ([_1]) in scanline [_2] [_3]', + "$error", $i, "

$line
") + ."

\n"); + } + my $message = + '

' + .&mt('The ID on the form is [_1]', + "$$scan_record{'scantron.ID'}") + .'
' + .&mt('The name on the paper is [_2], [_3]', + $$scan_record{'scantron.LastName'}, + $$scan_record{'scantron.FirstName'}) + .'

'; $r->print(''."\n"); $r->print(''."\n"); @@ -6867,10 +6922,10 @@ sub scantron_get_correction { if ($error =~ /ID$/) { if ($error eq 'incorrectID') { - $r->print("

".&mt("The encoded ID is not in the classlist"). + $r->print('

'.&mt("The encoded ID is not in the classlist"). "

\n"); } elsif ($error eq 'duplicateID') { - $r->print("

".&mt("The encoded ID has also been used by a previous paper [_1]",$arg)."

\n"); + $r->print('

'.&mt("The encoded ID has also been used by a previous paper [_1]",$arg)."

\n"); } $r->print($message); $r->print("

".&mt("How should I handle this?")."
\n"); @@ -6886,14 +6941,15 @@ sub scantron_get_correction { $r->print(''); } elsif ($error =~ /CODE$/) { if ($error eq 'incorrectCODE') { - $r->print("

".&mt("The encoded CODE is not in the list of possible CODEs.")."

\n"); + $r->print('

'.&mt("The encoded CODE is not in the list of possible CODEs.")."

\n"); } elsif ($error eq 'duplicateCODE') { - $r->print("

".&mt("The encoded CODE has also been used by a previous paper [_1], and CODEs are supposed to be unique.",join(', ',@{$arg}))."

\n"); + $r->print('

'.&mt("The encoded CODE has also been used by a previous paper [_1], and CODEs are supposed to be unique.",join(', ',@{$arg}))."

\n"); } - $r->print("

".&mt("The CODE on the form is '[_1]'", - $$scan_record{'scantron.CODE'})."
\n"); + $r->print("

".&mt('The CODE on the form is [_1]', + "'$$scan_record{'scantron.CODE'}'") + ."

\n"); $r->print($message); - $r->print("

".&mt("How should I handle this?")."
\n"); + $r->print("

".&mt("How should I handle this?")."

\n"); $r->print("\n
"); my $i=0; if ($error eq 'incorrectCODE' @@ -6920,7 +6976,7 @@ sub scantron_get_correction { $r->print(" "); $r->print("\n
"); @@ -6958,7 +7014,7 @@ ENDSCRIPT "")); $r->print("\n

"); } elsif ($error eq 'doublebubble') { - $r->print("

".&mt("There have been multiple bubbles scanned for some question(s)")."

\n"); + $r->print('

'.&mt("There have been multiple bubbles scanned for some question(s)")."

\n"); # The form field scantron_questions is acutally a list of line numbers. # represented by this form so: @@ -6976,7 +7032,7 @@ ENDSCRIPT } $r->print(&verify_bubbles_checked(@lines_to_correct)); } elsif ($error eq 'missingbubble') { - $r->print("

".&mt("There have been no bubbles scanned for some question(s)")."

\n"); + $r->print('

'.&mt("There have been [_1]no[_2] bubbles scanned for some question(s)",'','')."

\n"); $r->print($message); $r->print("

".&mt("Please indicate which bubble should be used for grading.")."

"); $r->print(&mt("Some questions have no scanned bubbles.")."\n"); @@ -7595,6 +7651,41 @@ sub scantron_validate_missingbubbles { return (0,$currentphase+1); } +sub hand_bubble_option { + my (undef, undef, $sequence) = + &Apache::lonnet::decode_symb($env{'form.selectpage'}); + return if ($sequence eq ''); + my $navmap = Apache::lonnavmaps::navmap->new(); + unless (ref($navmap)) { + return; + } + my $needs_hand_bubbles; + my $map=$navmap->getResourceByUrl($sequence); + my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); + foreach my $res (@resources) { + if (ref($res)) { + if ($res->is_problem()) { + my $partlist = $res->parts(); + foreach my $part (@{ $partlist }) { + my @types = $res->responseType($part); + if (grep(/^(chem|essay|image|formula|math|string|functionplot)$/,@types)) { + $needs_hand_bubbles = 1; + last; + } + } + } + } + } + if ($needs_hand_bubbles) { + my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); + my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config); + return &mt('The sequence to be graded contains response types which are handgraded.').'

'. + &mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?','
'). + ' '.&mt('or').' '. + '

'; + } + return; +} sub scantron_process_students { my ($r,$symb) = @_; @@ -7803,12 +7894,12 @@ SCANTRONFORM $studentrecord .= $recording; } if ($studentrecord ne $studentdata) { - $r->print('

'); + $r->print('

'); if ($scancode eq '') { - $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2].', + $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2].', $uname.':'.$udom,$scan_record->{'scantron.ID'})); } else { - $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2] and CODE: [_3].', + $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2] and CODE: [_3].', $uname.':'.$udom,$scan_record->{'scantron.ID'},$scancode)); } $r->print('
'.&Apache::loncommon::start_data_table()."\n". @@ -7816,12 +7907,12 @@ SCANTRONFORM '

'.&mt('Source').''.&mt('Bubbled responses').''.&mt('Bubble Sheet').''.$studentdata.''.&mt('Bubblesheet').''.$studentdata.'Stored submissions'.$studentrecord.''.&mt('Stored submissions').''.$studentrecord.'