version 1.130.2.1.2.5, 2003/09/29 20:58:50
|
version 1.130.2.1.2.6, 2003/09/29 21:31:30
|
Line 3276 sub username_to_idmap {
|
Line 3276 sub username_to_idmap {
|
} |
} |
|
|
sub scantron_fixup_scanline { |
sub scantron_fixup_scanline { |
my ($scantron_config,$scan_data,$line,$field,$newvalue,$arg) = @_; |
my ($scantron_config,$scan_data,$line,$whichline,$field,$newvalue,$arg)=@_; |
if ($field eq 'ID') { |
if ($field eq 'ID') { |
if ($newvalue > $$scantron_config{'IDlength'}) { |
if ($newvalue > $$scantron_config{'IDlength'}) { |
return ($line,1,'New value to large'); |
return ($line,1,'New value to large'); |
Line 3292 sub scantron_fixup_scanline {
|
Line 3292 sub scantron_fixup_scanline {
|
my $off=$scantron_config->{'Qoff'}; |
my $off=$scantron_config->{'Qoff'}; |
my $on=$scantron_config->{'Qon'}; |
my $on=$scantron_config->{'Qon'}; |
my $answer=${off}x$length; |
my $answer=${off}x$length; |
if ($arg ne 'none') { |
if ($arg eq 'none') { |
substr($answer,$arg,1)=$on; |
&scan_data($scan_data,"$whichline.no_bubble.$newvalue",'1'); |
&scan_data($scan_data,"no_bubble.$newvalue",undef,'1'); |
|
} else { |
} else { |
&scan_data($scan_data,"no_bubble.$newvalue",'1'); |
substr($answer,$arg,1)=$on; |
|
&scan_data($scan_data,"$whichline.no_bubble.$newvalue",undef,'1'); |
} |
} |
my $where=$length*($newvalue-1)+$scantron_config->{'Qstart'}; |
my $where=$length*($newvalue-1)+$scantron_config->{'Qstart'}; |
Apache->request->print("where $where arg $arg "); |
Apache->request->print("where $where arg $arg "); |
Line 3308 sub scantron_fixup_scanline {
|
Line 3308 sub scantron_fixup_scanline {
|
} |
} |
|
|
sub scan_data { |
sub scan_data { |
my ($scan_data,$key,$value,$delete); |
my ($scan_data,$key,$value,$delete)=@_; |
my $filename=$ENV{'form.scantron_selectfile'}; |
my $filename=$ENV{'form.scantron_selectfile'}; |
if (defined($value)) { |
if (defined($value)) { |
$scan_data->{$filename.'_'.$key} = $value; |
$scan_data->{$filename.'_'.$key} = $value; |
Line 3318 sub scan_data {
|
Line 3318 sub scan_data {
|
} |
} |
|
|
sub scantron_parse_scanline { |
sub scantron_parse_scanline { |
my ($line,$scantron_config,$scan_data)=@_; |
my ($line,$whichline,$scantron_config,$scan_data)=@_; |
my %record; |
my %record; |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
Line 3351 sub scantron_parse_scanline {
|
Line 3351 sub scantron_parse_scanline {
|
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
my @array=split($$scantron_config{'Qon'},$currentquest,-1); |
if (length($array[0]) eq $$scantron_config{'Qlength'}) { |
if (length($array[0]) eq $$scantron_config{'Qlength'}) { |
$record{"scantron.$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
if (!&scan_data($scan_data,"no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
} |
} |
} else { |
} else { |
Line 3425 sub scantron_process_corrections {
|
Line 3425 sub scantron_process_corrections {
|
$ENV{'form.scantron_domain'}; |
$ENV{'form.scantron_domain'}; |
my $newid=$classlist->{$newstudent}->[&Apache::loncoursedata::CL_ID]; |
my $newid=$classlist->{$newstudent}->[&Apache::loncoursedata::CL_ID]; |
($line,$err,$errmsg)= |
($line,$err,$errmsg)= |
&scantron_fixup_scanline(\%scantron_config,$scan_data,$line,'ID', |
&scantron_fixup_scanline(\%scantron_config,$scan_data,$line,$which, |
$newid); |
'ID',$newid); |
} elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) { |
} elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) { |
foreach my $question (split(',',$ENV{'form.scantron_questions'})) { |
foreach my $question (split(',',$ENV{'form.scantron_questions'})) { |
($line,$err,$errmsg)= |
($line,$err,$errmsg)= |
&scantron_fixup_scanline(\%scantron_config,$scan_data,$line, |
&scantron_fixup_scanline(\%scantron_config,$scan_data,$line, |
'answer',$question, |
$which,'answer',$question, |
$ENV{"form.scantron_correct_Q_$question"}); |
$ENV{"form.scantron_correct_Q_$question"}); |
if ($err) { last; } |
if ($err) { last; } |
} |
} |
Line 3586 sub scantron_validate_ID {
|
Line 3586 sub scantron_validate_ID {
|
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
my $line=&scantron_get_line($scanlines,$i); |
my $line=&scantron_get_line($scanlines,$i); |
if (!$line) { next; } |
if (!$line) { next; } |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data); |
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, |
|
$scan_data); |
my $id=$$scan_record{'scantron.ID'}; |
my $id=$$scan_record{'scantron.ID'}; |
$r->print("<p>Checking ID ".$$scan_record{'scantron.ID'}. |
$r->print("<p>Checking ID ".$$scan_record{'scantron.ID'}. |
" on paper ID ".$$scan_record{'scantron.PaperID'}."</p>\n"); |
" on paper ID ".$$scan_record{'scantron.PaperID'}."</p>\n"); |
Line 3713 sub scantron_validate_doublebubble {
|
Line 3714 sub scantron_validate_doublebubble {
|
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
my $line=&scantron_get_line($scanlines,$i); |
my $line=&scantron_get_line($scanlines,$i); |
if (!$line) { next; } |
if (!$line) { next; } |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data); |
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, |
|
$scan_data); |
if (!defined($$scan_record{'scantron.doubleerror'})) { next; } |
if (!defined($$scan_record{'scantron.doubleerror'})) { next; } |
&scantron_get_correction($r,$i,$scan_record,\%scantron_config,$line, |
&scantron_get_correction($r,$i,$scan_record,\%scantron_config,$line, |
'doublebubble', |
'doublebubble', |
Line 3737 sub scantron_validate_missingbubbles {
|
Line 3739 sub scantron_validate_missingbubbles {
|
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
my $line=&scantron_get_line($scanlines,$i); |
my $line=&scantron_get_line($scanlines,$i); |
if (!$line) { next; } |
if (!$line) { next; } |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data); |
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, |
|
$scan_data); |
if (!defined($$scan_record{'scantron.missingerror'})) { next; } |
if (!defined($$scan_record{'scantron.missingerror'})) { next; } |
my @to_correct; |
my @to_correct; |
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) { |
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) { |
Line 3795 SCANTRONFORM
|
Line 3798 SCANTRONFORM
|
my $line=&scantron_get_line($scanlines,$i); |
my $line=&scantron_get_line($scanlines,$i); |
if (!$line) { next; } |
if (!$line) { next; } |
$r->print('<pre>line is'.$line.'</pre>'); |
$r->print('<pre>line is'.$line.'</pre>'); |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data); |
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, |
|
$scan_data); |
my ($uname,$udom); |
my ($uname,$udom); |
unless ($uname=&scantron_find_student($scan_record,\%idmap)) { |
unless ($uname=&scantron_find_student($scan_record,\%idmap)) { |
&scantron_add_delay(\@delayqueue,$line, |
&scantron_add_delay(\@delayqueue,$line, |
Line 4165 sub send_header {
|
Line 4169 sub send_header {
|
#remotewindow.close(); |
#remotewindow.close(); |
#</script>"); |
#</script>"); |
$request->print(&Apache::loncommon::bodytag('Grading')); |
$request->print(&Apache::loncommon::bodytag('Grading')); |
|
$request->rflush(); |
} |
} |
|
|
sub send_footer { |
sub send_footer { |