';
+ &Apache::lonxml::clear_problem_counter();
my ($depth,$question,$prob) = (1,1,1);
$iterator->next(); # skip the first BEGIN_MAP
my $curRes = $iterator->next(); # for "current resource"
@@ -4199,7 +4204,8 @@ sub scantron_selectphase {
Options:
-
+
+
@@ -4528,8 +4534,15 @@ sub scantron_find_student {
sub scantron_filter {
my ($curres)=@_;
- # randomout is dysfunctional at best for this purpose
- if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) {
+
+ if (ref($curres) && $curres->is_problem()) {
+ # if the user has asked to not have either hidden
+ # or 'randomout' controlled resources to be graded
+ # don't include them
+ if ($env{'form.scantron_options_hidden'} eq 'ignore_hidden'
+ && $curres->randomout) {
+ return 0;
+ }
return 1;
}
return 0;
@@ -4712,6 +4725,7 @@ sub scantron_form_start {
+
SCANTRONFORM
return $result;
}
@@ -4746,7 +4760,7 @@ sub scantron_validate_file {
$r->print("
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);
@@ -5070,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') {
@@ -5245,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'};
}
@@ -5360,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;
@@ -5388,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);