--- loncom/homework/grades.pm 2004/11/09 20:20:56 1.204.2.9 +++ loncom/homework/grades.pm 2004/09/16 17:47:23 1.212 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.204.2.9 2004/11/09 20:20:56 albertel Exp $ +# $Id: grades.pm,v 1.212 2004/09/16 17:47: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='
'. ''. ''. - ($isCODE?'':''). ''. ''; my ($version); @@ -3237,9 +3242,6 @@ sub displaySubByDates { for ($version=1;$version<=$$record{'version'};$version++) { my $timestamp = scalar(localtime($$record{$version.':timestamp'})); $studentTable.=''; - if ($isCODE) { - $studentTable.=''; - } my @versionKeys = split(/\:/,$$record{$version.':keys'}); my @displaySub = (); foreach my $partid (@{$parts}) { @@ -3853,8 +3855,7 @@ sub scantron_find_student { sub scantron_filter { my ($curres)=@_; - # randomout is dysfunctional at best for this purpose - if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) { + if (ref($curres) && $curres->is_problem() && !$curres->randomout) { return 1; } return 0; @@ -4006,7 +4007,7 @@ sub scantron_form_start { - + @@ -4326,8 +4327,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,21 +4474,13 @@ 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); return(1,$currentphase); } - if (exists($usedCODEs{$CODE}) - && $ENV{'form.scantron_CODEunique'} eq 'yes' + if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'} && !$$scan_record{'scantron.CODE_ignore_dup'}) { &scantron_get_correction($r,$i,$scan_record, \%scantron_config, @@ -4652,14 +4645,11 @@ 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; } + } $completedstudents{$uname}={'line'=>$line}; - if (&Apache::loncommon::connection_aborted($r)) { last; } } continue { &Apache::lonnet::delenv('form.counter'); &Apache::lonnet::delenv('scantron\.'); @@ -4729,7 +4719,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 +4743,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 +4915,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.='

'; $result.='
Date/TimeCODESubmissionStatus 
'.$timestamp.''.$record->{$version.':resource.CODE'}.'
'.