'.$prob.
+ $studentTable.=
+ &Apache::loncommon::start_data_table_row().
+ ' | '.$prob.
(scalar(@{$parts}) == 1 ? '' : ' ('.scalar(@{$parts}).' parts)').' | ';
$studentTable.='';
my %form = ('CODE' => $env{'form.CODE'},);
@@ -4264,30 +4325,33 @@ sub displaySubByDates {
my $isCODE=0;
my $isTask = ($symb =~/\.task$/);
if (exists($record->{'resource.CODE'})) { $isCODE=1; }
- my $studentTable=''.
- ''.
- 'Date/Time | '.
- ($isCODE?'CODE | ':'').
- 'Submission | '.
- 'Status | ';
+ my $studentTable=&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ ''.&mt('Date/Time').' | '.
+ ($isCODE?''.&mt('CODE').' | ':'').
+ ''.&mt('Submission').' | '.
+ ''.&mt('Status').' | '.
+ &Apache::loncommon::end_data_table_header_row();
my ($version);
my %mark;
my %orders;
$mark{'correct_by_student'} = $checkIcon;
if (!exists($$record{'1:timestamp'})) {
- return ' Nothing submitted - no attempts ';
+ return ' '.&mt('Nothing submitted - no attempts').' ';
}
my $interaction;
for ($version=1;$version<=$$record{'version'};$version++) {
- my $timestamp = scalar(localtime($$record{$version.':timestamp'}));
+ my $timestamp =
+ &Apache::lonlocal::locallocaltime($$record{$version.':timestamp'});
if (exists($$record{$version.':resource.0.version'})) {
$interaction = $$record{$version.':resource.0.version'};
}
my $where = ($isTask ? "$version:resource.$interaction"
: "$version:resource");
- $studentTable.=''.$timestamp.' | ';
+ $studentTable.=&Apache::loncommon::start_data_table_row().
+ ''.$timestamp.' | ';
if ($isCODE) {
$studentTable.=''.$record->{$version.':resource.CODE'}.' | ';
}
@@ -4306,14 +4370,14 @@ sub displaySubByDates {
my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
: ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
- $displaySub[0].='Part: '.$display_part.' ';
- $displaySub[0].='(ID '.
+ $displaySub[0].=''.&mt('Part:').' '.$display_part.' ';
+ $displaySub[0].='('.&mt('ID').' '.
$responseId.') ';
if ($$record{"$where.$partid.tries"} eq '') {
- $displaySub[0].='Trial not counted';
+ $displaySub[0].=&mt('Trial not counted');
} else {
- $displaySub[0].='Trial '.
- $$record{"$where.$partid.tries"};
+ $displaySub[0].=&mt('Trial [_1]',
+ $$record{"$where.$partid.tries"});
}
my $responseType=($isTask ? 'Task'
: $responseType->{$partid}->{$responseId});
@@ -4353,12 +4417,12 @@ sub displaySubByDates {
}
$studentTable.=''.$displaySub[0].' | '.$displaySub[1];
if ($displaySub[2]) {
- $studentTable.='Manually graded by '.$displaySub[2];
+ $studentTable.=&mt('Manually graded by [_1]',$displaySub[2]);
}
- $studentTable.=' | ';
-
+ $studentTable.=' '.
+ &Apache::loncommon::end_data_table_row();
}
- $studentTable.='
| ';
+ $studentTable.=&Apache::loncommon::end_data_table();
return $studentTable;
}
@@ -4395,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"
@@ -4413,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.' | ';
@@ -4501,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 '.
@@ -5062,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');
@@ -5093,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;
}
@@ -5207,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
@@ -5245,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;
@@ -5269,7 +5371,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++;
}
@@ -5283,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);
@@ -5304,7 +5410,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++;
}
@@ -5349,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.
- my $location = [length($array[0])];
- my $line_num = $location / $$scantron_config{'Qlength'};
+ } elsif (scalar(@array) le 2) {
+
+ my $location = length($array[0]);
+ 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) {
@@ -5374,20 +5490,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;
}
}
}
@@ -5747,7 +5865,6 @@ SCANTRONFORM
my $line = 0;
while (defined($env{"form.scantron.bubblelines.$line"})) {
- &Apache::lonnet::logthis("Saving chunk for $line");
my $chunk =
''."\n";
$chunk .=
@@ -5813,7 +5930,6 @@ sub scantron_validate_file {
}
my $currentphase=$env{'form.validatepass'};
- &Apache::lonnet::logthis("Phase: $currentphase");
my $stop=0;
while (!$stop && $currentphase < scalar(@validate_phases)) {
@@ -6424,10 +6540,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");
@@ -6438,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");
@@ -6458,36 +6575,35 @@ 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');
+
$r->print("$quest | ");
for (my $l = 0; $l < $lines; $l++) {
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]) {
@@ -6514,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".
' | | ");
+ $quest.'" value="'.$value.'" />'.$alphabet[$i]."");
}
$r->print(' ');
@@ -6737,14 +6854,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'});
@@ -6782,9 +6896,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.
@@ -6834,6 +6948,9 @@ sub scantron_validate_missingbubbles {
$scan_data);
if (!defined($$scan_record{'scantron.missingerror'})) { next; }
my @to_correct;
+
+ # Probably here's where the error is...
+
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {
if ($missing > $max_bubble) { next; }
push(@to_correct,$missing);
@@ -7166,7 +7283,7 @@ sub show_grading_menu_form {
''."\n".
''."\n".
''."\n".
- ''."\n".
+ ''."\n".
''."\n";
return $result;
}
@@ -7190,10 +7307,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,
@@ -7240,7 +7353,7 @@ sub grading_menu {
$Str .= ''.
''."\n".
''."\n".
- ''."\n".
+ ''."\n".
''."\n".
''."\n".
''."\n";
@@ -7264,7 +7377,6 @@ sub grading_menu {
$Str .= ' '.(' 'x8).$menudata->{'short_description'}.
"\n";
}
- $Str .="\n";
$Str .="\n";
$request->print(<
@@ -7351,9 +7463,8 @@ sub submit_options {
GRADINGMENUJS
&commonJSfunctions($request);
- my $result=' Manual Grading/View Submission';
my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
- $result.=$table;
+ my $result;
my (undef,$sections) = &getclasslist('all','0');
my $savedState = &savedState();
my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'});
@@ -7370,102 +7481,104 @@ GRADINGMENUJS
''."\n".
''."\n";
- $result.=''."\n".
- ''."\n".
- ' Select a Grading/Viewing Option | '."\n".
- ''."\n";
-
- $result.=''."\n";
-
- $result.=' | '; #';
-
-# $result.=''."\n".' | ';
- $result.= ' '."\n".
- ' | '."\n";
+ $result.='
+
+
+
+
+
+ '.&Apache::lonstatistics::GroupSelect('group','multiple',5).'
+
+
+
+
+
+ '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '.&mt('Grade Complete Folder for One Student').'
+
+
+
+
+ ';
return $result;
}
@@ -8071,7 +8184,6 @@ sub handler {
} elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) {
$request->print(&csvuploadassign($request));
} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) {
- &Apache::lonnet::logthis("Selecting pyhase");
$request->print(&scantron_selectphase($request));
} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) {
$request->print(&scantron_do_warning($request));
|