');
}
-
- # 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]) {
@@ -6438,6 +6708,8 @@ sub scantron_validate_CODE {
my %allcodes=&get_codes();
+ &scantron_get_maxbubble(); # parse needs the lines per response array.
+
my ($scanlines,$scan_data)=&scantron_getfile();
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$scan_data,$i);
@@ -6490,6 +6762,9 @@ sub scantron_validate_doublebubble {
#get scantron line setup
my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
my ($scanlines,$scan_data)=&scantron_getfile();
+
+ &scantron_get_maxbubble(); # parse needs the bubble line array.
+
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
@@ -6513,21 +6788,25 @@ sub scantron_validate_doublebubble {
resource and then checking &Apache::lonxml::get_problem_counter()
for what the current value of the problem counter is.
- Caches the result to $env{'form.scantron_maxbubble'}
+ Caches the results to $env{'form.scantron_maxbubble'},
+ $env{'form.scantron.bubble_lines.n'} and
+ $env{'form.scantron.first_bubble_line.n'}
+ which are the total number of bubble, lines, the number of bubble
+ lines for reponse n and number of the first bubble line for response n.
=cut
sub scantron_get_maxbubble {
-
if (defined($env{'form.scantron_maxbubble'}) &&
$env{'form.scantron_maxbubble'}) {
+ &restore_bubble_lines();
return $env{'form.scantron_maxbubble'};
}
- my $navmap=Apache::lonnavmaps::navmap->new();
- my (undef,undef,$sequence)=
+ my (undef, undef, $sequence) =
&Apache::lonnet::decode_symb($env{'form.selectpage'});
+ my $navmap=Apache::lonnavmaps::navmap->new();
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
@@ -6538,9 +6817,14 @@ sub scantron_get_maxbubble {
my $cid = $env{'request.course.id'};
my $total_lines = 0;
%bubble_lines_per_response = ();
+ %first_bubble_line = ();
+
+ my $response_number = 0;
+ my $bubble_line = 0;
foreach my $resource (@resources) {
my $symb = $resource->symb();
+ &Apache::lonxml::clear_bubble_lines_for_part();
my $result=&Apache::lonnet::ssi($resource->src(),
('symb' => $resource->symb()),
('grade_target' => 'analyze'),
@@ -6555,16 +6839,25 @@ sub scantron_get_maxbubble {
foreach my $part_id (@{$analysis{'parts'}}) {
- my $bubble_lines = $analysis{"$part_id.bubble_lines"}[0];
- if (!$bubble_lines) {
- $bubble_lines = 1;
- }
- $bubble_lines_per_response{"$symb.$part_id"} = $bubble_lines;
- $total_lines = $total_lines + $bubble_lines;
+
+
+ my $lines = $analysis{"$part_id.bubble_lines"};;
+
+ # TODO - make this a persistent hash not an array.
+
+
+ $first_bubble_line{$response_number} = $bubble_line;
+ $bubble_lines_per_response{$response_number} = $lines;
+ $response_number++;
+
+ $bubble_line += $lines;
+ $total_lines += $lines;
}
}
&Apache::lonnet::delenv('scantron\.');
+
+ &save_bubble_lines();
$env{'form.scantron_maxbubble'} =
$total_lines;
return $env{'form.scantron_maxbubble'};
@@ -6575,7 +6868,8 @@ sub scantron_get_maxbubble {
=item scantron_validate_missingbubbles
Validates all scanlines in the selected file to not have any
- bubble lines with missing bubbles that haven't been verified as missing.
+ answers that don't have bubbles that have not been verified
+ to be bubble free.
=cut
@@ -6597,6 +6891,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);
@@ -6669,6 +6966,9 @@ SCANTRONFORM
my $start=&Time::HiRes::time();
my $i=-1;
my ($uname,$udom,$started);
+
+ &scantron_get_maxbubble(); # Need the bubble lines array to parse.
+
while ($i<$scanlines->{'count'}) {
($uname,$udom)=('','');
$i++;
@@ -6719,8 +7019,6 @@ SCANTRONFORM
}
my $result=&Apache::lonnet::ssi($resource->src(),%form);
if ($result ne '') {
- &Apache::lonnet::logthis("scantron grading error -> $result");
- &Apache::lonnet::logthis("scantron grading error info name $uname domain $udom course $env{'request.course.id'} url ".$resource->src());
}
if (&Apache::loncommon::connection_aborted($r)) { last; }
}
@@ -6952,10 +7250,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,
@@ -6985,47 +7279,47 @@ 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 => $url,
- jscript => ' onChange="javascript:checkReceiptNo(this.form,\'OK\')" ',
+ push (@menu, { url => "",
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;
# $Str .= ''.&mt('Please select a grading task').'';
- $Str .= '\n";
$request->print(<
@@ -7038,14 +7332,14 @@ sub grading_menu {
cmdsave = 'submission';
}
formname.command.value = cmd;
- formname.saveState.value = "saveCmd="+cmdsave+":saveSec="+pullDownSelection(formname.section)+
- ":saveSub="+pullDownSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status);
if (val < 5) formname.submit();
if (val == 5) {
- if (!checkReceiptNo(formname,'notOK')) { return false;}
- formname.submit();
+ if (!checkReceiptNo(formname,'notOK')) {
+ return false;
+ } else {
+ formname.submit();
+ }
}
- if (val < 7) formname.submit();
}
function checkReceiptNo(formname,nospace) {
@@ -7064,43 +7358,6 @@ sub grading_menu {
GRADINGMENUJS
&commonJSfunctions($request);
- my $result=' Manual Grading/View Submission';
- $result.=$table;
- my (undef,$sections) = &getclasslist('all','0');
- my $savedState = &savedState();
- my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'});
- my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'});
- my $saveSub = ($$savedState{'saveSub'} eq '' ? 'all' : $$savedState{'saveSub'});
- my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
-
- $result.=' |