--- loncom/interface/lonpickcode.pm 2005/02/17 08:29:43 1.5 +++ loncom/interface/lonpickcode.pm 2005/04/07 06:56:23 1.6 @@ -1,7 +1,7 @@ # The LearningOnline Network # Pick a CODE from the list of possible CODEs # -# $Id: lonpickcode.pm,v 1.5 2005/02/17 08:29:43 albertel Exp $ +# $Id: lonpickcode.pm,v 1.6 2005/04/07 06:56:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,12 +33,13 @@ use Apache::Constants qw(:common); use Apache::loncommon(); use Apache::grades(); use Apache::lonlocal; +use Apache::lonnet; sub get_code_freq { my ($r)=@_; my %codes; my %scantron_config= - &Apache::grades::get_scantron_config($ENV{'form.scantron_format'}); + &Apache::grades::get_scantron_config($env{'form.scantron_format'}); $r->rflush(); my ($scanlines,$scan_data)=&Apache::grades::scantron_getfile(); for (my $i=0;$i<=$scanlines->{'count'};$i++) { @@ -73,8 +74,8 @@ ENDDOCUMENT 'form','scantron_format', 'scantron_CODElist']); - if (!($ENV{'request.course.id'}) && - (&Apache::lonnet::allowed('usc',$ENV{'request.course.id'}))) { + if (!($env{'request.course.id'}) && + (&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { $r->print('Access not allowed.'); return OK; } @@ -83,8 +84,8 @@ ENDDOCUMENT $r->print(< function gochoose(newcode) { - opener.document.$ENV{'form.form'}.scantron_CODE_selectedvalue.value=newcode; - var slct=opener.document.$ENV{'form.form'}.scantron_CODE_resolution; + opener.document.$env{'form.form'}.scantron_CODE_selectedvalue.value=newcode; + var slct=opener.document.$env{'form.form'}.scantron_CODE_resolution; var i; for (i=0;iprint("

The CODE on the paper is ".$ENV{'form.curCODE'}. + $r->print("

The CODE on the paper is ".$env{'form.curCODE'}. ". Please Select a new one.

\n".'
'); my %codes=&Apache::grades::get_codes(); my %code_freq=&get_code_freq($r); - my $num_matches=length($ENV{'form.curCODE'}); + my $num_matches=length($env{'form.curCODE'}); for (my $i=$num_matches;$i>=0;$i--) { my $to_print="

CODEs with $i matches

"; $to_print.=''; my $print; foreach my $code (sort(keys(%codes))) { - if (&Apache::grades::num_matches($ENV{'form.curCODE'},$code) != $i) { next; } + if (&Apache::grades::num_matches($env{'form.curCODE'},$code) != $i) { next; } $print=1; my ($count,$list); if (!ref($code_freq{$code})) {
CODEexams using this CODE