'."\n");
- if ($env{'form.handgrade'} eq 'no') {
- my $checkMark='
Note: Part(s) graded correct by the computer is marked with a '.
- $checkIcon.' symbol.'."\n";
- $request->print($checkMark);
- }
-
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
if ($env{'form.vProb'} eq 'yes' or $env{'form.vAns'} eq 'yes') {
@@ -1953,10 +1953,11 @@ KEYWORDS
}
# This is where output for one specific student would start
- my $bgcolor='#DDEEDD';
- if (int($counter/2) eq $counter) { $bgcolor='#DDDDEE'; }
+ my $add_class = ($counter%2) ? 'LC_grade_show_user_odd_row' : '';
$request->print("\n\n".
- '
'."\n");
# print student answer/submission
# Options are (1) Handgaded submission only
# (2) Last submission, includes submission that is not handgraded
@@ -2049,12 +2010,14 @@ KEYWORDS
# (4) The whole record for this student
if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) {
my ($string,$timestamp)= &get_last_submission(\%record);
- my $lastsubonly=''.
- ($$timestamp eq '' ? '' : 'Date Submitted: '.
- $$timestamp)."
\n";
+
+ my $lastsubonly;
+
if ($$timestamp eq '') {
- $lastsubonly.='
'.$$string[0];
+ $lastsubonly.='
'.$$string[0].'
';
} else {
+ $lastsubonly = '
Date Submitted: '.$$timestamp."\n";
+
my %seenparts;
my @part_response_id = &flatten_responseType($responseType);
foreach my $part (@part_response_id) {
@@ -2077,16 +2040,16 @@ KEYWORDS
}
my $responsetype = $responseType->{$partid}->{$respid};
if (!exists($record{"resource.$partid.$respid.submission"})) {
- $lastsubonly.='
Part: '.
+ $lastsubonly.="\n".'
Part: '.
$display_part.' ( ID '.$respid.
' ) '.
- 'Nothing submitted - no attempts
';
+ ''.&mt('Nothing submitted - no attempts').'
';
next;
}
- foreach (@$string) {
- my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/;
+ foreach my $submission (@$string) {
+ my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
- my ($ressub,$subval) = split(/:/,$_,2);
+ my ($ressub,$subval) = split(/:/,$submission,2);
# Similarity check
my $similar='';
if($env{'form.checkPlag'}){
@@ -2116,31 +2079,32 @@ KEYWORDS
($env{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
my $display_part=&get_display_part($partid,$symb);
- $lastsubonly.='
Part: '.
+ $lastsubonly.='
Part: '.
$display_part.' ( ID '.$respid.
' ) ';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
if (@$files) {
- $lastsubonly.=' Like all files provided by users, this file may contain virusses ';
+ $lastsubonly.=' '.&mt('Like all files provided by users, this file may contain virusses').' ';
my $file_counter = 0;
foreach my $file (@$files) {
- $file_counter ++;
+ $file_counter++;
&Apache::lonnet::allowuploaded('/adm/grades',$file);
$lastsubonly.=' '.$file.'';
}
$lastsubonly.=' ';
}
- $lastsubonly.='Submitted Answer: '.
+ $lastsubonly.=''.&mt('Submitted Answer:').' '.
&cleanRecord($subval,$responsetype,$symb,$partid,
$respid,\%record,$order);
if ($similar) {$lastsubonly.="
';
+ $result .= &mt('This student has submitted too many '.
+ 'collaborators. Maximum is [_1].',$ncol);
+ $result .= '
';
+ }
+ }
+ return ($result,$fullname,\@col_fullnames);
+}
+
#--- Retrieve the last submission for all the parts
sub get_last_submission {
my ($returnhash)=@_;
@@ -3906,7 +3941,8 @@ sub csvuploadassign {
if ($wgt) {
$entries{$fields{$dest}}=~s/\s//g;
my $pcr=$entries{$fields{$dest}} / $wgt;
- my $award='correct_by_override';
+ my $award=($pcr == 0) ? 'incorrect_by_override'
+ : 'correct_by_override';
$grades{"resource.$part.awarded"}=$pcr;
$grades{"resource.$part.solved"}=$award;
$points{$part}=1;
@@ -4257,30 +4293,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.='
');
+ $r->print($grading_menu_button);
return
}
@@ -5201,6 +5239,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
@@ -5239,7 +5278,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;
@@ -5263,7 +5304,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++;
}
@@ -5277,9 +5323,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);
@@ -5298,7 +5343,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++;
}
@@ -5345,7 +5395,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'}];
@@ -5368,20 +5418,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;
}
}
}
@@ -5741,7 +5793,6 @@ SCANTRONFORM
my $line = 0;
while (defined($env{"form.scantron.bubblelines.$line"})) {
- &Apache::lonnet::logthis("Saving chunk for $line");
my $chunk =
''."\n";
$chunk .=
@@ -5807,7 +5858,6 @@ sub scantron_validate_file {
}
my $currentphase=$env{'form.validatepass'};
- &Apache::lonnet::logthis("Phase: $currentphase");
my $stop=0;
while (!$stop && $currentphase < scalar(@validate_phases)) {
@@ -6319,7 +6369,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
@@ -6418,10 +6468,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");
@@ -6432,7 +6482,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
");
@@ -6452,22 +6503,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');
@@ -6477,11 +6530,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]) {
@@ -6731,14 +6780,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'});
@@ -6776,9 +6822,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.
@@ -6828,6 +6874,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);
@@ -7184,10 +7233,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,
@@ -7217,29 +7262,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;
@@ -7261,10 +7292,10 @@ sub grading_menu {
$menudata->{'url'}.'" >'.
$menudata->{'name'}."\n";
} else {
- $Str .='