--- loncom/homework/grades.pm 2007/11/08 01:48:18 1.485 +++ loncom/homework/grades.pm 2007/11/13 11:06:54 1.490 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.485 2007/11/08 01:48:18 albertel Exp $ +# $Id: grades.pm,v 1.490 2007/11/13 11:06:54 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -733,9 +733,12 @@ sub verifyreceipt { $receipt =~ s/[^\-\d]//g; my ($symb) = &get_symb($request); - my $title.='

Verifying Submission Receipt '. - $receipt.'

'."\n". - '

Resource: '.$env{'form.probTitle'}.'



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

'. + &mt('Verifying Submission Receipt [_1]',$receipt). + '

'."\n". + '

'.&mt('Resource: [_1]',$env{'form.probTitle'}). + '

'."\n"; my ($string,$contents,$matches) = ('','',0); my (undef,undef,$fullname) = &getclasslist('all','0'); @@ -745,6 +748,19 @@ sub verifyreceipt { $env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; } my $parts=['0']; if ($receiptparts) { ($parts)=&response_type($symb); } + + my $header = + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ' '.&mt('Fullname').' '."\n". + ' '.&mt('Username').' '."\n". + ' '.&mt('Domain').' '; + if ($receiptparts) { + $header.=' '.&mt('Problem Part').' '; + } + $header.= + &Apache::loncommon::end_data_table_header_row(); + foreach (sort { if (lc($$fullname{$a}) ne lc($$fullname{$b})) { @@ -755,7 +771,9 @@ sub verifyreceipt { my ($uname,$udom)=split(/\:/); foreach my $part (@$parts) { if ($receipt eq &Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb,$part)) { - $contents.=' '."\n". + $contents.= + &Apache::loncommon::start_data_table_row(). + ' '."\n". ''.$$fullname{$_}.' '."\n". ' '.$uname.' '. @@ -763,28 +781,23 @@ sub verifyreceipt { if ($receiptparts) { $contents.=' '.$part.' '; } - $contents.=''."\n"; + $contents.= + &Apache::loncommon::end_data_table_row()."\n"; $matches++; } } } if ($matches == 0) { - $string = $title.'No match found for the above receipt.'; + $string = $title.&mt('No match found for the above receipt.'); } else { $string = &jscriptNform($symb).$title. - 'The above receipt matches the following student'. - ($matches <= 1 ? '.' : 's.')."\n". - '
'."\n". - ''."\n". - ''."\n". - ''."\n". - ''; - if ($receiptparts) { - $string.=''; - } - $string.=''."\n".$contents. - '
 Fullname  Username  Domain  Problem Part 
'."\n"; + '

'. + &mt('The above receipt matches the following [numerate,_1,student].',$matches). + '

'. + $header. + $contents. + &Apache::loncommon::end_data_table()."\n"; } return $string.&show_grading_menu_form($symb); } @@ -4888,52 +4901,48 @@ sub scantron_selectphase { # Chunk of form to prompt for a file to grade and how: - $result.= < - -
- - - $default_form_data - - - - - - - - - - - - - - - - - - - - + $result.= ' +
+ + + '.$default_form_data.' + '.&Apache::loncommon::start_data_table('LC_scantron_action').' + '.&Apache::loncommon::start_data_table_header_row().' + + '.&Apache::loncommon::end_data_table_header_row().' + '.&Apache::loncommon::start_data_table_row().' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::start_data_table_row().' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::start_data_table_row().' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::start_data_table_row().' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::start_data_table_row().' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::start_data_table_row().' - - + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::start_data_table_row().' - -
-  Specify file and which Folder/Sequence to grade -
Sequence to grade: $sequence_selector
Filename of scoring office file: $file_selector
Format of data file: $format_selector
Saved CODEs to validate against: $CODE_selector
Each CODE is only to be used once: $CODE_unique
+  Specify file and which Folder/Sequence to grade + Sequence to grade: '.$sequence_selector.' Filename of scoring office file: '.$file_selector.' Format of data file: '.$format_selector.' Saved CODEs to validate against: '.$CODE_selector.' Each CODE is only to be used once: '.$CODE_unique.' Options:

- -
- -SCANTRONFORM + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::end_data_table().' + +'; $r->print($result); @@ -4942,18 +4951,17 @@ SCANTRONFORM # Chunk of form to prompt for a scantron file upload. - $r->print(< - - - - - - + $r->print(' +
+ '.&Apache::loncommon::start_data_table('LC_scantron_action').' + '.&Apache::loncommon::start_data_table_header_row().' + + '.&Apache::loncommon::end_data_table_header_row().' + '.&Apache::loncommon::start_data_table_row().' - -
-  Specify a Scantron data file to upload. -
+  Specify a Scantron data file to upload. + -SCANTRONFORM +'); my $default_form_data=&defaultFormData(&get_symb($r,1)); my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; @@ -4979,47 +4987,38 @@ SCANTRONFORM UPLOAD - $r->print(<print('
- - -SCANTRONFORM + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::end_data_table().' +'); } # Chunk of the form that prompts to view a scoring office file, # corrected file, skipped records in a file. - $r->print(< -
- - $default_form_data - - - - - - - - - - + '.&Apache::loncommon::end_data_table_header_row().' + '.&Apache::loncommon::start_data_table_row().' + - -
-  Download a scoring office file -
Filename of scoring office file: $file_selector
+ $r->print(' +
+ + '.$default_form_data.' + + '.&Apache::loncommon::start_data_table('LC_scantron_action').' + '.&Apache::loncommon::start_data_table_header_row().' +
+  Download a scoring office file + Filename of scoring office file: '.$file_selector.' +
-
- -
- -SCANTRONFORM + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::end_data_table().' + +
+'); - $r->print(''); &Apache::lonpickcode::code_list($r,2); - $r->print(''); $r->print($grading_menu_button); return } @@ -5407,10 +5406,9 @@ sub scantron_parse_scanline { my $answer_length = $$scantron_config{'Qlength'} * $answers_needed; - $questnum++; my $currentquest = substr($questions,0,$answer_length); - $questions = substr($questions,0,$answer_length)=''; + $questions = substr($questions,$answer_length); if (length($currentquest) < $answer_length) { next; } # Qon letter implies for each slot in currentquest we have: @@ -5420,7 +5418,6 @@ sub scantron_parse_scanline { if ($$scantron_config{'Qon'} eq 'letter') { - if ($currentquest =~ /\?/ || $currentquest =~ /\*/ || (&occurence_count($currentquest, "[A-Z]") > 1)) { @@ -5449,7 +5446,8 @@ sub scantron_parse_scanline { } } else { for (my $ans = 0; $ans < $answers_needed; $ans++) { - $record{"scantron.$ansnum.answer"} = substr($currentquest, $ans, 1); + my $bubble = substr($currentquest, $ans, 1); + $record{"scantron.$ansnum.answer"} = $bubble; $ansnum++; } } @@ -5516,10 +5514,9 @@ sub scantron_parse_scanline { push(@{$record{"scantron.missingerror"}},$questnum); } - # If the bubble is not the last position, there will be - # 2 elements. If it is the last position, there will be 1 element. - } elsif (scalar(@array) le 2) { + + } elsif (scalar(@array) eq 2) { my $location = length($array[0]); my $line_num = int($location / $$scantron_config{'Qlength'}); @@ -6952,9 +6949,10 @@ sub scantron_get_maxbubble { foreach my $part_id (@{$analysis{'parts'}}) { - my $lines = $analysis{"$part_id.bubble_lines"};; + + # TODO - make this a persistent hash not an array.