'.
- ''.
- ' Prob. | '.
- ' '.($env{'form.vProb'} eq 'no' ? 'Title' : 'Problem Text').'/Grade | ';
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ ' Prob. | '.
+ ' '.($env{'form.vProb'} eq 'no' ? 'Title' : 'Problem Text').'/Grade | '.
+ &Apache::loncommon::end_data_table_header_row();
&Apache::lonxml::clear_problem_counter();
my ($depth,$question,$prob) = (1,1,1);
@@ -4241,7 +4249,9 @@ sub displayPage {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- $studentTable.=''.$prob.
+ $studentTable.=
+ &Apache::loncommon::start_data_table_row().
+ ' | '.$prob.
(scalar(@{$parts}) == 1 ? '' : ' ('.scalar(@{$parts}).' parts)').' | ';
$studentTable.='';
my %form = ('CODE' => $env{'form.CODE'},);
@@ -4449,12 +4459,14 @@ sub updateGradeByPage {
my $iterator = $navmap->getIterator($map->map_start(),
$map->map_finish());
- my $studentTable=''.
- ''.
- ' Prob. | '.
- ' Title | '.
- ' Previous Score | '.
- ' New Score | ';
+ my $studentTable=
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ ' Prob. | '.
+ ' Title | '.
+ ' Previous Score | '.
+ ' New Score | '.
+ &Apache::loncommon::end_data_table_header_row();
$iterator->next(); # skip the first BEGIN_MAP
my $curRes = $iterator->next(); # for "current resource"
@@ -4467,7 +4479,9 @@ sub updateGradeByPage {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- $studentTable.=''.$prob.
+ $studentTable.=
+ &Apache::loncommon::start_data_table_row().
+ ' | '.$prob.
(scalar(@{$parts}) == 1 ? '' : ' ('.scalar(@{$parts}).' parts)').' | ';
$studentTable.=' '.$title.' | ';
@@ -4555,14 +4569,14 @@ sub updateGradeByPage {
$studentTable.=''.$displayPts[0].' | '.
''.$displayPts[1].' | '.
- ' ';
+ &Apache::loncommon::end_data_table_row();
$prob++;
}
$curRes = $iterator->next();
}
- $studentTable.='
| ';
+ $studentTable.=&Apache::loncommon::end_data_table();
$studentTable.=&show_grading_menu_form($env{'form.symb'});
my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :
'The scores were changed for '.
@@ -5116,7 +5130,8 @@ sub username_to_idmap {
sub scantron_fixup_scanline {
my ($scantron_config,$scan_data,$line,$whichline,$field,$args)=@_;
-
+
+
if ($field eq 'ID') {
if (length($args->{'newid'}) > $$scantron_config{'IDlength'}) {
return ($line,1,'New value too large');
@@ -5147,28 +5162,58 @@ sub scantron_fixup_scanline {
$$scantron_config{'CODElength'})=$args->{'CODE'};
}
} elsif ($field eq 'answer') {
- my $length=$scantron_config->{'Qlength'};
+ &scantron_get_maxbubble(); # Need the bubble counter info.
+ my $length =$scantron_config->{'Qlength'};
my $off=$scantron_config->{'Qoff'};
my $on=$scantron_config->{'Qon'};
- my $answer=${off}x$length;
- if ($args->{'response'} eq 'none') {
- &scan_data($scan_data,
- "$whichline.no_bubble.".$args->{'question'},'1');
- } else {
- if ($on eq 'letter') {
- my @alphabet=('A'..'Z');
- $answer=$alphabet[$args->{'response'}];
- } elsif ($on eq 'number') {
- $answer=$args->{'response'}+1;
- if ($answer == 10) { $answer = '0'; }
+ my $question_number = $args->{'question'} -1;
+ my $first_position = $first_bubble_line{$question_number};
+ my $bubble_count = $bubble_lines_per_response{$question_number};
+ my $bubbles_per_line= $$scantron_config{'Qlength'};
+ my $answer=${off}x($bubbles_per_line*$bubble_count);
+ my $final_answer;
+ if ($$scantron_config{'Qon'} eq 'letter' ||
+ $$scantron_config{'Qon'} eq 'number') {
+ $bubbles_per_line = 10;
+ }
+ if (defined $args->{'response'}) {
+
+ if ($args->{'response'} eq 'none') {
+ &scan_data($scan_data,
+ "$whichline.no_bubble.".$args->{'question'},'1');
} else {
- substr($answer,$args->{'response'},1)=$on;
+ my ($bubble_line, $bubble_number) = split(/:/,$args->{'response'});
+ if ($on eq 'letter') {
+ my @alphabet=('A'..'Z');
+ $answer=$alphabet[$bubble_number];
+ } elsif ($on eq 'number') {
+ $answer= $bubble_number+1;
+ if ($answer == 10) { $answer = '0'; }
+ } else {
+ substr($answer,$bubble_number+$bubble_line*$bubbles_per_line,1)=$on;
+ $final_answer = $answer;
+ }
+ &scan_data($scan_data,
+ "$whichline.no_bubble.".$args->{'question'},undef,'1');
+
+ # Positional notation already has the right final answer length..
+
+ if (($on eq 'letter') || ($on eq 'number')) {
+ for (my $l = 0; $l < $bubble_count; $l++) {
+ if ($l eq $bubble_line) {
+ $final_answer .= $answer;
+ } else {
+ $final_answer .= ' ';
+ }
+ }
+ }
}
- &scan_data($scan_data,
- "$whichline.no_bubble.".$args->{'question'},undef,'1');
+ # $where=$length*($args->{'question'}-1)+$scantron_config->{'Qstart'};
+ #substr($line,$where-1,$length)=$answer;
+ substr($line,
+ $scantron_config->{'Qstart'}+$first_position-1,
+ $bubbles_per_line*$length) = $final_answer;
}
- my $where=$length*($args->{'question'}-1)+$scantron_config->{'Qstart'};
- substr($line,$where-1,$length)=$answer;
}
return $line;
}
@@ -5415,11 +5460,16 @@ sub scantron_parse_scanline {
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
push(@{$record{"scantron.missingerror"}},$questnum);
}
- } elsif (scalar(@array) lt 2) {
+
+ # 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) {
my $location = length($array[0]);
- my $line_num = $location / $$scantron_config{'Qlength'};
+ my $line_num = int($location / $$scantron_config{'Qlength'});
my $bubble = $alphabet[$location % $$scantron_config{'Qlength'}];
+
for (my $ans = 0; $ans < $answers_needed; $ans++) {
if ($ans eq $line_num) {
@@ -6546,6 +6596,7 @@ sub scantron_bubble_selector {
my $total_lines = $lines*2;
my @alphabet=('A'..'Z');
+
$r->print(" |
|