version 1.5, 2005/02/17 08:29:43
|
version 1.10, 2006/03/16 21:54:40
|
Line 33 use Apache::Constants qw(:common);
|
Line 33 use Apache::Constants qw(:common);
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::grades(); |
use Apache::grades(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
sub get_code_freq { |
sub get_code_freq { |
my ($r)=@_; |
my ($r)=@_; |
my %codes; |
my %codes; |
my %scantron_config= |
my %scantron_config= |
&Apache::grades::get_scantron_config($ENV{'form.scantron_format'}); |
&Apache::grades::get_scantron_config($env{'form.scantron_format'}); |
$r->rflush(); |
$r->rflush(); |
my ($scanlines,$scan_data)=&Apache::grades::scantron_getfile(); |
my ($scanlines,$scan_data)=&Apache::grades::scantron_getfile(); |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
for (my $i=0;$i<=$scanlines->{'count'};$i++) { |
my $line=&Apache::grades::scantron_get_line($scanlines,$i); |
my $line=&Apache::grades::scantron_get_line($scanlines,$scan_data,$i); |
if ($line=~/^[\s\cz]*$/) { next; } |
if ($line=~/^[\s\cz]*$/) { next; } |
my $scan_record= |
my $scan_record= |
&Apache::grades::scantron_parse_scanline($line,$i, |
&Apache::grades::scantron_parse_scanline($line,$i, |
Line 59 sub handler {
|
Line 60 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDDOCUMENT); |
|
$html |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
</head> |
|
ENDDOCUMENT |
|
|
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['curCODE','scantron_selectfile', |
['curCODE','scantron_selectfile', |
'form','scantron_format', |
'form','scantron_format','symb', |
'scantron_CODElist']); |
'scantron_CODElist','command']); |
|
|
if (!($ENV{'request.course.id'}) && |
if (!($env{'request.course.id'}) && |
(&Apache::lonnet::allowed('usc',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { |
$r->print('<body>Access not allowed.</body>'); |
$r->print(&Apache::loncommon::start_page(). |
|
&mt('Access not allowed.'). |
|
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
if ($env{'form.command'} eq 'codelist') { |
|
&code_list($r); |
|
} elsif ($env{'form.command'} eq 'showcodes') { |
|
&show_codes($r); |
|
} else { |
|
&picking_a_code($r); |
|
} |
|
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
|
} |
|
|
|
sub code_list { |
|
my ($r,$secondview)=@_; |
|
if (!$secondview) { |
|
$r->print(&Apache::loncommon::start_page("View CODEs",undef, |
|
{'no_nav_bar' => 1})); |
|
$r->print("<p>".&mt('Select a set of saved CODEs to view.')."</p>"); |
|
} else { |
|
$r->print("<p>".&mt('Select another set of saved CODEs to view.')."</p>"); |
|
} |
|
$r->print("<form method='POST' action='/adm/pickcode' name='pickcode'>"); |
|
$r->print(&Apache::grades::scantron_CODElist()); |
|
$r->print("<input type='hidden' name='command' value='showcodes' />"); |
|
$r->print("<input type='hidden' name='symb' value='".$env{'form.symb'}."' />"); |
|
$r->print("<input type='hidden' name='url' value='".$env{'form.url'}."' />"); |
|
$r->print("<input type='submit' name='submit' value='".&mt("View")."' />"); |
|
$r->print("</form>"); |
|
$r->print(&Apache::grades::show_grading_menu_form($env{'form.symb'}, |
|
$env{'form.url'})); |
|
} |
|
|
|
sub show_codes { |
|
my ($r)=@_; |
|
$r->print(&Apache::loncommon::start_page("View CODEs",undef, |
|
{'no_nav_bar' => 1})); |
|
my %codes=&Apache::grades::get_codes(); |
|
$r->print("<h2>".$env{'form.scantron_CODElist'}."</h2>"); |
|
$r->print('<pre>'); |
|
foreach my $code (sort(keys(%codes))) { |
|
$r->print($code."\n"); |
|
} |
|
$r->print('</pre>'); |
|
&code_list($r,1); |
|
} |
|
|
$r->print(&Apache::loncommon::bodytag("Selecting a CODE")); |
sub picking_a_code { |
|
my ($r)=@_; |
|
$r->print(&Apache::loncommon::start_page("Selecting a CODE",undef, |
|
{'no_nav_bar' => 1})); |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script> |
<script> |
function gochoose(newcode) { |
function gochoose(newcode) { |
opener.document.$ENV{'form.form'}.scantron_CODE_selectedvalue.value=newcode; |
opener.document.$env{'form.form'}.scantron_CODE_selectedvalue.value=newcode; |
var slct=opener.document.$ENV{'form.form'}.scantron_CODE_resolution; |
var slct=opener.document.$env{'form.form'}.scantron_CODE_resolution; |
var i; |
var i; |
for (i=0;i<slct.length;i++) { |
for (i=0;i<slct.length;i++) { |
if (slct[i].value=='use_found') { slct[i].checked=true; } |
if (slct[i].value=='use_found') { slct[i].checked=true; } |
Line 95 function gochoose(newcode) {
|
Line 137 function gochoose(newcode) {
|
ENDSCRIPT |
ENDSCRIPT |
|
|
|
|
$r->print("<p>The CODE on the paper is <tt><b>".$ENV{'form.curCODE'}. |
$r->print("<p>The CODE on the paper is <tt><b>".$env{'form.curCODE'}. |
"</b></tt>. Please Select a new one.</p>\n".'<form>'); |
"</b></tt>. Please Select a new one.</p>\n".'<form>'); |
my %codes=&Apache::grades::get_codes(); |
my %codes=&Apache::grades::get_codes(); |
my %code_freq=&get_code_freq($r); |
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--) { |
for (my $i=$num_matches;$i>=0;$i--) { |
my $to_print="<p> CODEs with $i matches</p>"; |
my $to_print="<p> CODEs with $i matches</p>"; |
$to_print.='<table border="1"><tr><td></td><td>CODE</td><td>exams using this CODE</td>'; |
$to_print.='<table border="1"><tr><td></td><td>CODE</td><td>exams using this CODE</td>'; |
my $print; |
my $print; |
foreach my $code (sort(keys(%codes))) { |
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; |
$print=1; |
my ($count,$list); |
my ($count,$list); |
if (!ref($code_freq{$code})) { |
if (!ref($code_freq{$code})) { |
Line 124 ENDSCRIPT
|
Line 166 ENDSCRIPT
|
$to_print.='</table>'; |
$to_print.='</table>'; |
if ($print) { $r->print($to_print); } |
if ($print) { $r->print($to_print); } |
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form>'); |
return OK; |
|
} |
} |
|
|
1; |
1; |