--- loncom/homework/grades.pm 2004/05/14 21:30:27 1.202 +++ loncom/homework/grades.pm 2005/02/12 02:37:00 1.243 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.202 2004/05/14 21:30:27 albertel Exp $ +# $Id: grades.pm,v 1.243 2005/02/12 02:37:00 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 { @@ -167,6 +138,20 @@ sub response_type { return \@partlist,\%handgrade,\%responseType; } +sub get_display_part { + my ($partID,$url,$symb)=@_; + if (!defined($symb) || $symb eq '') { + $symb=$ENV{'form.symb'}; + if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) } + } + my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); + if (defined($display) and $display ne '') { + $display.= " (id $partID)"; + } else { + $display=$partID; + } + return $display; +} #--- Show resource title #--- and parts and response type sub showResourceInfo { @@ -194,7 +179,8 @@ sub showResourceInfo { } $partsseen{$partID}=1; } - $result.='
'. - 'Part '.$partid.' Points: | '."\n"; + 'Part: '.$display_part.' Points: | '."\n"; my $ctr = 0; $result.=' |
'.
'
|
Sequence To be Graded: | $title |
Data File that will be used: | $ENV{'form.scantron_selectfile'} |
If this information is correct, please click on '$button_text'.
+If something is incorrect, please click the 'Grading Menu' button to start over.
+ +You have forgetten to specify some information. Please go Back and try again.
"); + if ( $ENV{'form.selectpage'} eq '') { + $r->print('You have not selected a Sequence to grade
'); + } + if ( $ENV{'form.scantron_selectfile'} eq '') { + $r->print('You have not selected a file that contains the student\'s response data.
'); + } + if ( $ENV{'form.scantron_format'} eq '') { + $r->print('You have not selected a the format of the student\'s response data.
'); + } + } else { + my $warning=&scantron_warning_screen('Validate Records'); + $r->print(<Gathering neccessary info.
");$r->rflush(); - my $max_bubble=&scantron_get_maxbubble($r); #get the student pick code ready $r->print(&Apache::loncommon::studentbrowser_javascript()); - my $result= <". $line."\n"); } + my $message="
The ID on the form is ".
+ $$scan_record{'scantron.ID'}."
\n".
+ "The name on the paper is ".
+ $$scan_record{'scantron.LastName'}.",".
+ $$scan_record{'scantron.FirstName'}."
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
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 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'}."
The CODE on the form is '".
+ $$scan_record{'scantron.CODE'}."'
\n");
+ $r->print($message);
$r->print("
How should I handle this?
\n");
$r->print("\n
");
my $i=0;
@@ -4291,6 +4414,7 @@ ENDSCRIPT
$r->print("
There have been multiple bubbles scanned for a some question(s)
\n"); $r->print(''); + $r->print($message); $r->print("Please indicate which bubble should be used for grading
"); foreach my $question (@{$arg}) { my $selected=$$scan_record{"scantron.$question.answer"}; @@ -4298,6 +4422,7 @@ ENDSCRIPT } } elsif ($error eq 'missingbubble') { $r->print("There have been no bubbles scanned for some question(s)
\n"); + $r->print($message); $r->print("Please indicate which bubble should be used for grading
"); $r->print("Some questions have no scanned bubbles\n"); $r->print(' $result"); + &Apache::lonnet::logthis("scantron grading error info name $uname domain $udom 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\.'); @@ -4573,7 +4713,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 ''; @@ -4634,7 +4773,8 @@ sub scantron_upload_scantron_data_save { } return ''; } - $r->print("Doing upload to ".$ENV{'form.courseid'}."