');
+ $request->print('');#LC_grade_show_user_body
+ $request->print('');#LC_grade_show_user
# print end of form
@@ -3149,14 +3173,12 @@ sub viewgrades {
$sectionClass=&mt('Students in Section(s) [_1]',$section_display).'';
}
$result.='
'.&mt('Assign Common Grade To [_1]',$sectionClass);
- $result.= '
'."\n".
- '
';
+ $result.= &Apache::loncommon::start_data_table();
#radio buttons/text box for assigning points for a section or class.
#handles different parts of a problem
my ($partlist,$handgrade,$responseType) = &response_type($symb);
my %weight = ();
my $ctsparts = 0;
- $result.='
';
my %seen = ();
my @part_response_id = &flatten_responseType($responseType);
foreach my $part_response_id (@part_response_id) {
@@ -3168,12 +3190,14 @@ sub viewgrades {
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb);
$weight{$partid} = $wgt eq '' ? '1' : $wgt;
+ $result.=&Apache::loncommon::start_data_table_row().'
';
$result.=''."\n";
$result.=''."\n";
my $display_part=&get_display_part($partid,$symb);
- $result.='
Part: '.$display_part.' Point:
';
+ $result.=
+ 'Part: '.$display_part.' Point:
';
$result.='
';
my $ctr = 0;
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across
@@ -3188,26 +3212,27 @@ sub viewgrades {
$partid.'" size="4" '.'onChange="javascript:writePoint(\''.
$partid.'\','.$weight{$partid}.',\'textval\')" /> /'.
$weight{$partid}.' (problem weight)'."\n";
- $result.= '
'."\n".
+ $result.=&Apache::loncommon::end_data_table()."\n".
'';
$result.='';
+ 'onClick="javascript:resetEntry('.$ctsparts.');" />';
#table listing all the students in a section/class
#header of table
$result.= '
Assign Grade to Specific Students in '.$sectionClass;
- $result.= '
';
+ $result.=&Apache::loncommon::end_data_table_header_row();
my %last_resets =
&get_last_resets($symb,$env{'request.course.id'},\@partids);
@@ -3248,7 +3273,7 @@ sub viewgrades {
$result.=&viewstudentgrade($symb,$env{'request.course.id'},
$_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets);
}
- $result.='
';
+ $result.=&Apache::loncommon::end_data_table();
$result.=''."\n";
$result.=''."\n";
@@ -3271,7 +3296,7 @@ sub viewstudentgrade {
my ($uname,$udom) = split(/:/,$student);
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my %aggregates = ();
- my $result='
'.
+ my $result=&Apache::loncommon::start_data_table_row().'
'.
''.
"\n".$ctr.'
'.
'
'."\n";
}
}
- $result.='
';
+ $result.=&Apache::loncommon::end_data_table_row();
return $result;
}
@@ -3337,15 +3362,14 @@ sub editgrades {
my $symb=&get_symb($request);
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
- my $title='
'."\n";
- my $noupdate;
+ $result .= &Apache::loncommon::end_data_table_header_row().
+ &Apache::loncommon::start_data_table_header_row().
+ $header.
+ &Apache::loncommon::end_data_table_header_row();
+ my @noupdate;
my ($updateCtr,$noupdateCtr) = (1,1);
for ($i=0; $i<$env{'form.total'}; $i++) {
my $line;
@@ -3407,7 +3432,9 @@ sub editgrades {
my $usec=$classlist->{"$uname:$udom"}[5];
if (!&canmodify($usec)) {
my $numcols=scalar(@partid)*4+2;
- $noupdate.=$line."
Not allowed to modify student
";
+ push(@noupdate,
+ $line."
".
+ &mt('Not allowed to modify student')."
");
next;
}
my %aggregate = ();
@@ -3476,7 +3503,7 @@ sub editgrades {
'
'.$awarded.'
';
}
}
- $line.=''."\n";
+ $line.="\n";
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -3509,10 +3536,13 @@ sub editgrades {
}
}
- $result.='
'."\n".
- &show_grading_menu_form ($symb);
- my $msg = ' Number of records updated = '.$rec_update.
- ' for '.$count.' student'.($count <= 1 ? '' : 's').'. '.
- 'Total number of students = '.$env{'form.total'}.' ';
+ $result .= &Apache::loncommon::end_data_table().
+ &show_grading_menu_form($symb);
+ my $msg = '
'.
+ &mt('Number of records updated = [_1] for [quant,_2,student].',
+ $rec_update,$count).' '.
+ ''.&mt('Total number of students = [_1]',$env{'form.total'}).
+ '
';
return $title.$msg.$result;
}
@@ -4057,12 +4099,13 @@ LISTJAVASCRIPT
$request->print($result);
my $studentTable.=' Select a student you wish to grade and then click on the Next button. '.
- '
';
my %form = ('CODE' => $env{'form.CODE'},);
@@ -4407,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"
@@ -4425,7 +4479,9 @@ sub updateGradeByPage {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- $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 '.
@@ -5074,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');
@@ -5105,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;
}
@@ -5219,6 +5306,7 @@ sub scan_data {
sub scantron_parse_scanline {
my ($line,$whichline,$scantron_config,$scan_data,$just_header)=@_;
+
my %record;
my $questions=substr($line,$$scantron_config{'Qstart'}-1); # Answers
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); # earlier stuff
@@ -5257,7 +5345,9 @@ sub scantron_parse_scanline {
my $questnum=0;
my $ansnum =1; # Multiple 'answer lines'/question.
- while ($questions) {
+ chomp($questions); # Get rid of any trailing \n.
+ $questions =~ s/\r$//; # Get rid of trailing \r too (MAC or Win uploads).
+ while (length($questions)) {
my $answers_needed = $bubble_lines_per_response{$questnum};
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed;
@@ -5300,9 +5390,8 @@ sub scantron_parse_scanline {
}
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
push(@{$record{"scantron.missingerror"}},$questnum);
- $ansnum += $answers_needed;
+ # $ansnum += $answers_needed;
}
-
} else {
for (my $ans = 0; $ans < $answers_needed; $ans++) {
$record{"scantron.$ansnum.answer"} = substr($currentquest, $ans, 1);
@@ -5371,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) {
@@ -6460,7 +6554,8 @@ ENDSCRIPT
join(',',@{$arg}).'" />');
foreach my $question (@{$arg}) {
my $selected = &get_response_bubbles($scan_record, $question);
- &scantron_bubble_selector($r,$scan_config,$question);
+ my @select_array = split(/:/,$selected); # ought to be an array of empties.
+ &scantron_bubble_selector($r,$scan_config,$question, @select_array);
}
} else {
$r->print("\n
");
@@ -6480,7 +6575,7 @@ ENDSCRIPT
$r - Apache request object
$scan_config - hash from &get_scantron_config()
$quest - number of the bubble line to make a corrector for
- $lines - array of answer lines.
+ @lines - array of answer lines.
=cut
@@ -6501,6 +6596,7 @@ sub scantron_bubble_selector {
my $total_lines = $lines*2;
my @alphabet=('A'..'Z');
+
$r->print("
$quest
");
for (my $l = 0; $l < $lines; $l++) {
@@ -6534,9 +6630,10 @@ sub scantron_bubble_selector {
# multiline questions (different values e.g..).
for (my $i=0;$i<$max;$i++) {
+ my $value = "$l:$i"; # Relative bubble line #: Bubble in line.
$r->print("\n".
'