');
+ $r->print($grading_menu_button);
return
}
@@ -5265,7 +5281,12 @@ sub scantron_parse_scanline {
|| (&occurence_count($currentquest, "[A-Z]") > 1)) {
push(@{$record{'scantron.doubleerror'}},$questnum);
for (my $ans = 0; $ans < $answers_needed; $ans++) {
- $record{"scantron.$ansnum.answer"}='';
+ my $bubble = substr($currentquest, $ans, 1);
+ if ($bubble =~ /[A-Z]/ ) {
+ $record{"scantron.$ansnum.answer"} = $bubble;
+ } else {
+ $record{"scantron.$ansnum.answer"}='';
+ }
$ansnum++;
}
@@ -5300,7 +5321,12 @@ sub scantron_parse_scanline {
|| (&occurence_count($currentquest, '\d') > 1)) {
push(@{$record{'scantron.doubleerror'}},$questnum);
for (my $ans = 0; $ans < $answers_needed; $ans++) {
- $record{"scantron.$ansnum.answer"}='';
+ my $bubble = substr($currentquest, $ans, 1);
+ if ($bubble =~ /\d/) {
+ $record{"scantron.$ansnum.answer"} = $alphabet[$bubble];
+ } else {
+ $record{"scantron.$ansnum.answer"}=' ';
+ }
$ansnum++;
}
@@ -5347,7 +5373,7 @@ sub scantron_parse_scanline {
}
} elsif (scalar(@array) lt 2) {
- my $location = [length($array[0])];
+ my $location = length($array[0]);
my $line_num = $location / $$scantron_config{'Qlength'};
my $bubble = $alphabet[$location % $$scantron_config{'Qlength'}];
@@ -5370,20 +5396,22 @@ sub scantron_parse_scanline {
my $first_answer = $ansnum;
for (my $ans =0; $ans < $answers_needed; $ans++) {
- $record{"scantron.$ansnum.answer"} = '';
- $ans++;
+ my $item = $first_answer+$ans;
+ $record{"scantron.$item.answer"} = '';
}
my @ans=@array;
- my $i=length($ans[0]);shift(@ans);
+ my $i=0;
+ my $increment = 0;
while ($#ans) {
- $i+=length($ans[0])+1;
- my $line = $i/$$scantron_config{'Qlength'} + $first_answer;
+ $i+=length($ans[0]) + $increment;
+ my $line = int($i/$$scantron_config{'Qlength'} + $first_answer);
my $bubble = $i%$$scantron_config{'Qlength'};
-
$record{"scantron.$line.answer"}.=$alphabet[$bubble];
shift(@ans);
+ $increment = 1;
}
+ $ansnum += $answers_needed;
}
}
}
@@ -5743,7 +5771,6 @@ SCANTRONFORM
my $line = 0;
while (defined($env{"form.scantron.bubblelines.$line"})) {
- &Apache::lonnet::logthis("Saving chunk for $line");
my $chunk =
''."\n";
$chunk .=
@@ -5809,7 +5836,6 @@ sub scantron_validate_file {
}
my $currentphase=$env{'form.validatepass'};
- &Apache::lonnet::logthis("Phase: $currentphase");
my $stop=0;
while (!$stop && $currentphase < scalar(@validate_phases)) {
@@ -6321,7 +6347,7 @@ sub scantron_validate_ID {
sub scantron_get_correction {
my ($r,$i,$scan_record,$scan_config,$line,$error,$arg)=@_;
-#FIXME in the case of a duplicated ID the previous line, probaly need
+#FIXME in the case of a duplicated ID the previous line, probably need
#to show both the current line and the previous one and allow skipping
#the previous one or the current one
@@ -6420,10 +6446,10 @@ ENDSCRIPT
$r->print($message);
$r->print("
Please indicate which bubble should be used for grading
");
foreach my $question (@{$arg}) {
-
my $selected = &get_response_bubbles($scan_record, $question);
+ my @select_array = split(/:/,$selected);
&scantron_bubble_selector($r,$scan_config,$question,
- split('',$selected));
+ @select_array);
}
} elsif ($error eq 'missingbubble') {
$r->print("
There have been no bubbles scanned for some question(s)
\n");
@@ -6454,22 +6480,24 @@ ENDSCRIPT
$r - Apache request object
$scan_config - hash from &get_scantron_config()
$quest - number of the bubble line to make a corrector for
- $selected - array of letters of previously selected bubbles
+ $lines - array of answer lines.
=cut
sub scantron_bubble_selector {
- my ($r,$scan_config,$quest,@selected)=@_;
+ my ($r,$scan_config,$quest,@lines)=@_;
my $max=$$scan_config{'Qlength'};
+
my $scmode=$$scan_config{'Qon'};
+ my $bubble_length = scalar(@lines);
+
if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; }
my $response = $quest-1;
my $lines = $bubble_lines_per_response{$response};
- &Apache::lonnet::logthis("Question $quest, lines: $lines");
my $total_lines = $lines*2;
my @alphabet=('A'..'Z');
@@ -6479,11 +6507,7 @@ sub scantron_bubble_selector {
if ($l != 0) {
$r->print('
');
}
-
- # FIXME: This loop probably has to be considerably more clever for
- # multiline bubbles: User can multibubble by having bubbles in
- # several lines. User can skip lines legitimately etc. etc.
-
+ my @selected = split(//,$lines[$l]);
for (my $i=0;$i<$max;$i++) {
$r->print("\n".'
');
if ($selected[0] eq $alphabet[$i]) {
@@ -6733,14 +6757,11 @@ sub scantron_validate_doublebubble {
=cut
sub scantron_get_maxbubble {
- &Apache::lonnet::logthis("get_max_bubble");
if (defined($env{'form.scantron_maxbubble'}) &&
$env{'form.scantron_maxbubble'}) {
- &Apache::lonnet::logthis("cached");
&restore_bubble_lines();
return $env{'form.scantron_maxbubble'};
}
- &Apache::lonnet::logthis("computing");
my (undef, undef, $sequence) =
&Apache::lonnet::decode_symb($env{'form.selectpage'});
@@ -6778,9 +6799,9 @@ sub scantron_get_maxbubble {
foreach my $part_id (@{$analysis{'parts'}}) {
- my ($trash, $part) = split(/\./, $part_id);
- my $lines = $analysis{"$part_id.bubble_lines"}[0];
+
+ my $lines = $analysis{"$part_id.bubble_lines"};;
# TODO - make this a persistent hash not an array.
@@ -7186,10 +7207,6 @@ sub grading_menu {
my $probTitle = &Apache::lonnet::gettitle($symb);
my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
- #
- # Define menu data
- $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
- my ($table) = &showResourceInfo($symb,$env{'form.probTitle'});
$request->print($table);
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),
'handgrade'=>$hdgrade,
@@ -7219,29 +7236,15 @@ sub grading_menu {
$fields{'command'} = 'scantron_selectphase';
$url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
push (@menu, { url => $url,
- name => &mt('Grade Scantron Forms'),
+ name => &mt('Grade/Manage Scantron Forms'),
short_description =>
&mt('')});
$fields{'command'} = 'verify';
$url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
push (@menu, { url => "",
- jscript => ' onClick="javascript:checkChoice2(document.forms.gradingMenu,\'5\',\'verify\')" ',
name => &mt('Verify Receipt'),
short_description =>
&mt('')});
- $fields{'command'} = 'manage';
- $url = &Apache::lonhtmlcommon::build_url('/adm/helper/resettimes.helper',\%fields);
- push (@menu, { url => $url,
- name => &mt('Manage Access Times'),
- short_description =>
- &mt('')});
- $fields{'command'} = 'view';
- $url = &Apache::lonhtmlcommon::build_url('/adm/pickcode',\%fields);
- push (@menu, { url => $url,
- name => &mt('View Saved CODEs'),
- short_description =>
- &mt('')});
-
#
# Create the menu
my $Str;
@@ -7263,10 +7266,10 @@ sub grading_menu {
$menudata->{'url'}.'" >'.
$menudata->{'name'}."\n";
} else {
- $Str .='