--- loncom/homework/grades.pm 2004/12/04 00:03:24 1.204.2.10
+++ loncom/homework/grades.pm 2004/09/24 22:03:23 1.215
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.204.2.10 2004/12/04 00:03:24 albertel Exp $
+# $Id: grades.pm,v 1.215 2004/09/24 22:03:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -174,7 +174,6 @@ sub get_display_part {
if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) }
}
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb);
- &Apache::lonnet::logthis("\nsymb $symb\n url $url\npartID $partID\ndisplay $display \n");
if (defined($display) and $display ne '') {
$display.= " (id $partID)";
} else {
@@ -365,27 +364,36 @@ sub getclasslist {
#
my %sections;
my %fullnames;
- foreach (keys(%$classlist)) {
- # the following undefs are for 'domain', and 'username' respectively.
- my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
- @{$classlist->{$_}};
+ foreach my $student (keys(%$classlist)) {
+ my $end =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_END()];
+ my $start =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_START()];
+ my $id =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_ID()];
+ my $section =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_SECTION()];
+ my $fullname =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_FULLNAME()];
+ my $status =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_STATUS()];
# filter students according to status selected
if ($filterlist && $ENV{'form.Status'} ne 'Any') {
if ($ENV{'form.Status'} ne $status) {
- delete ($classlist->{$_});
+ delete ($classlist->{$student});
next;
}
}
- $section = ($section ne '' ? $section : 'no');
+ $section = ($section ne '' ? $section : 'none');
if (&canview($section)) {
if ($getsec eq 'all' || $getsec eq $section) {
$sections{$section}++;
- $fullnames{$_}=$fullname;
+ $fullnames{$student}=$fullname;
} else {
- delete($classlist->{$_});
+ delete($classlist->{$student});
}
} else {
- delete($classlist->{$_});
+ delete($classlist->{$student});
}
}
my %seen = ();
@@ -2320,7 +2328,7 @@ sub viewgrades {
my $sectionClass;
if ($ENV{'form.section'} eq 'all') {
$sectionClass='Class ';
- } elsif ($ENV{'form.section'} eq 'no') {
+ } elsif ($ENV{'form.section'} eq 'none') {
$sectionClass='Students in no Section ';
} else {
$sectionClass='Students in Section '.$ENV{'form.section'}.'';
@@ -3219,12 +3227,9 @@ sub displayPage {
sub displaySubByDates {
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_;
- my $isCODE=0;
- if (exists($record->{'resource.CODE'})) { $isCODE=1; }
my $studentTable='
'.
'
'.
'
Date/Time
'.
- ($isCODE?'
CODE
':'').
'
Submission
'.
'
Status
';
my ($version);
@@ -3237,9 +3242,6 @@ sub displaySubByDates {
for ($version=1;$version<=$$record{'version'};$version++) {
my $timestamp = scalar(localtime($$record{$version.':timestamp'}));
$studentTable.='
'.$timestamp.'
';
- if ($isCODE) {
- $studentTable.='
'.$record->{$version.':resource.CODE'}.'
';
- }
my @versionKeys = split(/\:/,$$record{$version.':keys'});
my @displaySub = ();
foreach my $partid (@{$parts}) {
@@ -4006,7 +4008,7 @@ sub scantron_form_start {
-
+
@@ -4326,8 +4328,8 @@ sub scantron_get_correction {
} elsif ($error eq 'duplicateCODE') {
$r->print("
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 ".
@@ -4473,14 +4475,7 @@ sub scantron_validate_CODE {
$scan_data);
my $CODE=$$scan_record{'scantron.CODE'};
my $error=0;
- 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'}) {
+ if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
$line,'incorrectCODE',\%allcodes);
@@ -4535,7 +4530,7 @@ sub scantron_get_maxbubble {
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
&Apache::lonnet::delenv('form.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());
}
&Apache::lonnet::delenv('scantron\.');
my $envfile=$ENV{'user.environment'};
@@ -4652,8 +4647,6 @@ 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 (&Apache::loncommon::connection_aborted($r)) { last; }
@@ -4729,7 +4722,8 @@ sub scantron_upload_scantron_data_save {
}
return '';
}
-# $r->print("Doing upload to ".$ENV{'form.courseid'}." ");
+ my %coursedata=&Apache::lonnet::coursedescription($ENV{'form.domainid'}.'_'.$ENV{'form.courseid'});
+ $r->print("Doing upload to ".$coursedata{'description'}." ");
my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'},
$ENV{'form.domainid'});
my $fname=$ENV{'form.upfile.filename'};
@@ -4752,17 +4746,14 @@ sub scantron_upload_scantron_data_save {
$r->print("Error: The file you attempted to upload, ".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"').", contained no information. Please check that you entered the correct filename.");
} else {
my $result=&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},$ENV{'form.domainid'},$home,'upfile',$fname);
-# if ($result =~ m|^/uploaded/|) {
- if ($result !~ m|^/uploaded/|) {
-# $r->print("Success: Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location ".$result."");
-# } else {
+ if ($result =~ m|^/uploaded/|) {
+ $r->print("Success: Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location ".$result."");
+ } else {
$r->print("Error: An error (".$result.") occurred when attempting to upload the file, ".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."");
}
}
if ($symb) {
-# $r->print(&show_grading_menu_form($symb,$url));
$r->print(&scantron_selectphase($r,$uploadedfile));
-
} else {
$r->print($doanotherupload);
}
@@ -4927,9 +4918,6 @@ GRADINGMENUJS
$result.=&mt('Student Status').':'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
- if (ref($sections) && (grep /no/,@$sections)) {
- $result.=' (Section "no" implies the students were not assigned a section.) ';
- }
$result.='