--- loncom/homework/grades.pm 2004/09/14 13:30:09 1.209
+++ loncom/homework/grades.pm 2004/11/17 20:32:44 1.228
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.209 2004/09/14 13:30:09 ng Exp $
+# $Id: grades.pm,v 1.228 2004/11/17 20:32:44 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,16 +25,6 @@
#
# http://www.lon-capa.org/
#
-# 2/9,2/13 Guy Albertelli
-# 6/8 Gerd Kortemeyer
-# 7/26 H.K. Ng
-# 8/20 Gerd Kortemeyer
-# Year 2002
-# June-August H.K. Ng
-# Year 2003
-# February, March H.K. Ng
-# July, H. K. Ng
-#
package Apache::grades;
use strict;
@@ -101,25 +91,6 @@ sub get_symb_and_url {
return ($symb,$url);
}
-# --- Retrieve the fullname for a user. Return lastname, first middle ---
-# --- Generation is attached next to the lastname if it exists. ---
-sub get_fullname {
- my ($uname,$udom) = @_;
- my %name=&Apache::lonnet::get('environment', ['lastname','generation',
- 'firstname','middlename'],
- $udom,$uname);
- my $fullname;
- my ($tmp) = keys(%name);
- if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
- $fullname = &Apache::loncoursedata::ProcessFullName
- (@name{qw/lastname generation firstname middlename/});
- } else {
- &Apache::lonnet::logthis('grades.pm: no name data for '.$uname.
- '@'.$udom.':'.$tmp);
- }
- return $fullname;
-}
-
#--- Format fullname, username:domain if different for display
#--- Use anywhere where the student names are listed
sub nameUserString {
@@ -1001,6 +972,7 @@ sub sub_page_kw_js {
my $request = shift;
my $iconpath = $request->dir_config('lonIconsURL');
&commonJSfunctions($request);
+ my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
$request->print(<
';
$studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});
my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :
@@ -3501,7 +3474,7 @@ sub scantron_CODElist {
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum);
my $namechoice='';
- foreach my $name (sort(@names)) {
+ foreach my $name (sort {uc($a) cmp uc($b)} @names) {
if ($name =~ /^error: 2 /) { next; }
$namechoice.='';
}
@@ -3538,8 +3511,8 @@ sub scantron_selectphase {
$result.= <'.
' '.
' ';
my ($version);
@@ -3242,6 +3214,9 @@ sub displaySubByDates {
for ($version=1;$version<=$$record{'version'};$version++) {
my $timestamp = scalar(localtime($$record{$version.':timestamp'}));
$studentTable.='Date/Time '.
+ ($isCODE?'CODE ':'').
'Submission '.
'Status '.$timestamp.' ';
+ if ($isCODE) {
+ $studentTable.=''.$record->{$version.':resource.CODE'}.' ';
+ }
my @versionKeys = split(/\:/,$$record{$version.':keys'});
my @displaySub = ();
foreach my $partid (@{$parts}) {
@@ -3410,8 +3385,6 @@ sub updateGradeByPage {
$curRes = $iterator->next();
}
- $navmap->untieHashes();
-
$studentTable.='
+
SCANTRONFORM
@@ -3633,8 +3606,8 @@ SCANTRONFORM
}
$r->print(<
-
+
SCANTRONFORM
$r->print(<
+
-
-
@@ -3651,14 +3624,13 @@ SCANTRONFORM
The encoded CODE has also been used by a previous paper ".join(', ',@{$arg}).", and CODEs are supposed to be unique
\n"); } - $r->print("The CODE on the form is ".
- $$scan_record{'scantron.CODE'}."
\n");
+ $r->print("
The CODE on the form is '".
+ $$scan_record{'scantron.CODE'}."'
\n");
$r->print("
The ID on the form is ".
$$scan_record{'scantron.ID'}."
\n");
$r->print("The name on the paper is ".
@@ -4474,13 +4447,21 @@ sub scantron_validate_CODE {
$scan_data);
my $CODE=$$scan_record{'scantron.CODE'};
my $error=0;
- if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) {
+ if (!&Apache::lonnet::validCODE($CODE)) {
+ &scantron_get_correction($r,$i,$scan_record,
+ \%scantron_config,
+ $line,'incorrectCODE',\%allcodes);
+ return(1,$currentphase);
+ }
+ if (%allcodes && !exists($allcodes{$CODE})
+ && !$$scan_record{'scantron.useCODE'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
$line,'incorrectCODE',\%allcodes);
return(1,$currentphase);
}
- if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}
+ if (exists($usedCODEs{$CODE})
+ && $ENV{'form.scantron_CODEunique'} eq 'yes'
&& !$$scan_record{'scantron.CODE_ignore_dup'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
@@ -4645,11 +4626,18 @@ SCANTRONFORM
if (exists($scan_record->{'scantron.CODE'}) &&
$scan_record->{'scantron.CODE'}) {
$form{'CODE'}=$scan_record->{'scantron.CODE'};
+ } else {
+ $form{'CODE'}='';
}
my $result=&Apache::lonnet::ssi($resource->src(),%form);
-
+ if ($result ne '') {
+ &Apache::lonnet::logthis("scantron grading error -> $result");
+ &Apache::lonnet::logthis("scantron grading error info name $uname domain $domain course $ENV{'request.course.id'} url $resource->src()");
+ }
+ if (&Apache::loncommon::connection_aborted($r)) { last; }
}
$completedstudents{$uname}={'line'=>$line};
+ if (&Apache::loncommon::connection_aborted($r)) { last; }
} continue {
&Apache::lonnet::delenv('form.counter');
&Apache::lonnet::delenv('scantron\.');
@@ -4658,7 +4646,6 @@ SCANTRONFORM
# my $lasttime = &Time::HiRes::time()-$start;
# $r->print("
took $lasttime
"); - $navmap->untieHashes(); $r->print(""); $r->print(&show_grading_menu_form($symb,$url)); return ''; @@ -4719,7 +4706,8 @@ sub scantron_upload_scantron_data_save { } return ''; } -# $r->print("Doing upload to ".$ENV{'form.courseid'}."