--- loncom/homework/grades.pm 2004/03/04 14:09:47 1.179
+++ loncom/homework/grades.pm 2004/04/20 06:11:49 1.186
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.179 2004/03/04 14:09:47 albertel Exp $
+# $Id: grades.pm,v 1.186 2004/04/20 06:11:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -511,7 +511,7 @@ sub verifyreceipt {
my $request = shift;
my $courseid = $ENV{'request.course.id'};
- my $receipt = unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}).'-'.
+ my $receipt = &Apache::lonnet::recprefix($courseid).'-'.
$ENV{'form.receipt'};
$receipt =~ s/[^\-\d]//g;
my $url = $ENV{'form.url'};
@@ -1704,8 +1704,10 @@ KEYWORDS
($ENV{'form.command'} eq 'processGroup' && $counter == $total)) {
$toGrade.=''.&show_grading_menu_form($symb,$url)
}
- $request = print($toGrade);
+ $request->print($toGrade);
return;
+ } else {
+ $request->print(''."\n");
}
# essay grading message center
@@ -3443,6 +3445,30 @@ sub scantron_scantab {
return $result;
}
+sub scantron_CODElist {
+ my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
+ my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+ my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum);
+ my $namechoice='';
+ foreach my $name (@names) {
+ $namechoice.='';
+ }
+ $namechoice='';
+ return $namechoice;
+}
+
+sub scantron_CODEunique {
+ my $result='
The ID on the form is ".
+ $$scan_record{'scantron.ID'}."
\n");
+ $r->print("The name on the paper is ".
+ $$scan_record{'scantron.LastName'}.",".
+ $$scan_record{'scantron.FirstName'}."
How should I handle this?
\n");
+ $r->print("\n
There have been multiple bubbles scanned for a some question(s)
\n"); @@ -4058,6 +4124,48 @@ sub scantron_bubble_selector { sub scantron_validate_CODE { my ($r,$currentphase) = @_; #FIXME doesn't do anything yet + my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'}); + if ($scantron_config{'CODElocation'} && + $scantron_config{'CODEstart'} && + $scantron_config{'CODElength'}) { + if (!$ENV{'form.scantron_CODElist'}) { + &FIXME_blow_up() + } + } else { + &Apache::lonnet::logthis(" CODE stuf $scantron_config{'CODElocation'}:$scantron_config{'CODEstart'}:$scantron_config{'CODElength'}"); + return (0,$currentphase+1); + } + + my %usedCODEs; + + my $old_name=$ENV{'form.scantron_CODElist'}; + my $cdom =$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; + my $cnum =$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; + my %result=&Apache::lonnet::get('CODEs',[$old_name],$cdom,$cnum); + my %allcodes=map {($_,1)} split(',',$result{$old_name}); + + my ($scanlines,$scan_data)=&scantron_getfile(); + for (my $i=0;$i<=$scanlines->{'count'};$i++) { + my $line=&scantron_get_line($scanlines,$i); + if ($line=~/^[\s\cz]*$/) { next; } + my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config, + $scan_data); + my $CODE=$$scan_record{'scantron.CODE'}; + my $error=0; + if (!exists($allcodes{$CODE})) { + &scantron_get_correction($r,$i,$scan_record, + \%scantron_config, + $line,'incorrectCODE',$CODE); + return(1); + } + if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}) { + &scantron_get_correction($r,$i,$scan_record, + \%scantron_config, + $line,'duplicateCODE',$CODE); + return(1); + } + $usedCODEs{$CODE}++; + } return (0,$currentphase+1); } @@ -4202,7 +4310,8 @@ sub scantron_upload_scantron_data { my ($r)=@_; $r->print(&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'})); my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid', - 'domainid'); + 'domainid', + 'coursename'); my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'}, 'domainid'); my $default_form_data=&defaultFormData(&get_symb_and_url($r,1)); @@ -4219,12 +4328,14 @@ sub scantron_upload_scantron_data {'. - ''. - ' scores from file | |
'. ' scantron forms | |
'. - ''. - ' submission Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}). + ''. + ' '.&mt('receipt').': '. + &Apache::lonnet::recprefix($ENV{'request.course.id'}). '-'. ' |