--- loncom/homework/grades.pm 2006/03/08 21:56:49 1.329 +++ loncom/homework/grades.pm 2006/03/13 20:26:51 1.333 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.329 2006/03/08 21:56:49 albertel Exp $ +# $Id: grades.pm,v 1.333 2006/03/13 20:26:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4204,7 +4204,8 @@ sub scantron_selectphase {
Gathering neccessary info.
");$r->rflush(); #get the student pick code ready $r->print(&Apache::loncommon::studentbrowser_javascript()); - my $max_bubble=&scantron_get_maxbubble($r); + my $max_bubble=&scantron_get_maxbubble(); my $result=&scantron_form_start($max_bubble).$default_form_data; $r->print($result); @@ -4994,7 +5003,7 @@ sub scantron_get_correction { #the previous one or the current one $r->print("An error was detected ($error)");
- if ( defined($$scan_record{'scantron.PaperID'}) ) {
+ if ( $$scan_record{'scantron.PaperID'} =~ /\S/) {
$r->print(" for PaperID ".
$$scan_record{'scantron.PaperID'}." \n");
} else {
@@ -5075,8 +5084,10 @@ ENDSCRIPT
"&scantron_CODElist=".&Apache::lonnet::escape($env{'form.scantron_CODElist'}).
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}).
"&scantron_selectfile=".&Apache::lonnet::escape($env{'form.scantron_selectfile'});
- $r->print(" Selected CODE is ");
- $r->print("\n
");
+ if ($env{'form.scantron_CODElist'} =~ /\S/) {
+ $r->print(" Selected CODE is ");
+ $r->print("\n
");
+ }
$r->print(" as the CODE.");
$r->print("\n
");
} elsif ($error eq 'doublebubble') {
@@ -5250,28 +5261,29 @@ sub scantron_validate_doublebubble {
return (0,$currentphase+1);
}
-sub scantron_get_maxbubble {
- my ($r)=@_;
+sub scantron_get_maxbubble {
if (defined($env{'form.scantron_maxbubble'}) &&
$env{'form.scantron_maxbubble'}) {
return $env{'form.scantron_maxbubble'};
}
+
my $navmap=Apache::lonnavmaps::navmap->new();
my (undef,undef,$sequence)=
&Apache::lonnet::decode_symb($env{'form.selectpage'});
+
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- &Apache::lonnet::delenv('form.counter');
+
+ &Apache::lonxml::clear_problem_counter();
+
foreach my $resource (@resources) {
- my $result=&Apache::lonnet::ssi($resource->src().'?symb='.&Apache::lonnet::escape($resource->symb()));
+ my $result=&Apache::lonnet::ssi($resource->src(),
+ ('symb' => $resource->symb()));
}
&Apache::lonnet::delenv('scantron\.');
- my $envfile=$env{'user.environment'};
- $envfile=~/\/([^\/]+)\.id$/;
- $envfile=$1;
- &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
- $envfile);
- $env{'form.scantron_maxbubble'}=$env{'form.counter'}-1;
+ $env{'form.scantron_maxbubble'} =
+ &Apache::lonxml::get_problem_counter()-1;
+
return $env{'form.scantron_maxbubble'};
}
@@ -5365,7 +5377,8 @@ SCANTRONFORM
next;
}
($uname,$udom)=split(/:/,$uname);
- &Apache::lonnet::delenv('form.counter');
+
+ &Apache::lonxml::clear_problem_counter();
&Apache::lonnet::appenv(%$scan_record);
my $i=0;
@@ -5393,7 +5406,7 @@ SCANTRONFORM
$completedstudents{$uname}={'line'=>$line};
if (&Apache::loncommon::connection_aborted($r)) { last; }
} continue {
- &Apache::lonnet::delenv('form.counter');
+ &Apache::lonxml::clear_problem_counter();
&Apache::lonnet::delenv('scantron\.');
}
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);