version 1.136, 2003/09/09 18:46:28
|
version 1.140, 2003/09/19 21:54:07
|
Line 218 sub commonJSfunctions {
|
Line 218 sub commonJSfunctions {
|
} |
} |
} |
} |
} else { |
} else { |
if (selectOne.selected) return selectOne.value; |
// only one value it must be the selected one |
|
return selectOne.value; |
} |
} |
} |
} |
</script> |
</script> |
Line 2334 sub editgrades {
|
Line 2335 sub editgrades {
|
$newrecord{'resource.'.$_.'.awarded'} = 0; |
$newrecord{'resource.'.$_.'.awarded'} = 0; |
$newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
$newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
$updateflag = 1; |
$updateflag = 1; |
|
} elsif (!($old_part eq $partial && $old_score eq $score)) { |
|
$updateflag = 1; |
|
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
|
$newrecord{'resource.'.$_.'.solved'} = $score; |
|
$rec_update++; |
} |
} |
|
|
$line .= '<td align="center">'.$old_aw.' </td>'. |
$line .= '<td align="center">'.$old_aw.' </td>'. |
'<td align="center">'.$awarded. |
'<td align="center">'.$awarded. |
($score eq 'excused' ? $score : '').' </td>'; |
($score eq 'excused' ? $score : '').' </td>'; |
|
|
if (!($old_part eq $partial && $old_score eq $score)) { |
|
$updateflag = 1; |
|
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
|
$newrecord{'resource.'.$_.'.solved'} = $score; |
|
$rec_update++; |
|
} |
|
|
|
my $partid=$_; |
my $partid=$_; |
foreach my $stores (@parts) { |
foreach my $stores (@parts) { |
Line 2733 LISTJAVASCRIPT
|
Line 2733 LISTJAVASCRIPT
|
$result.='<form action="/adm/grades" method="post" name="displayPage">'."\n"; |
$result.='<form action="/adm/grades" method="post" name="displayPage">'."\n"; |
$result.=' <b>Problems from:</b> <select name="selectpage">'."\n"; |
$result.=' <b>Problems from:</b> <select name="selectpage">'."\n"; |
my ($titles,$symbx) = &getSymbMap($request); |
my ($titles,$symbx) = &getSymbMap($request); |
my ($curpage,$type,$mapId) = ($symb =~ /(.*?\.(page|sequence))___(\d+)___/); |
my ($curpage) =&Apache::lonnet::decode_symb($symb); |
|
# my ($curpage,$mapId) =&Apache::lonnet::decode_symb($symb); |
|
# my $type=($curpage =~ /\.(page|sequence)/); |
my $ctr=0; |
my $ctr=0; |
foreach (@$titles) { |
foreach (@$titles) { |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
Line 3135 sub getSequenceDropDown {
|
Line 3137 sub getSequenceDropDown {
|
my ($request,$symb)=@_; |
my ($request,$symb)=@_; |
my $result='<select name="selectpage">'."\n"; |
my $result='<select name="selectpage">'."\n"; |
my ($titles,$symbx) = &getSymbMap($request); |
my ($titles,$symbx) = &getSymbMap($request); |
my ($curpage,$type,$mapId) = ($symb =~ /(.*?\.(page|sequence))___(\d+)___/); |
my ($curpage)=&Apache::lonnet::decode_symb($symb); |
my $ctr=0; |
my $ctr=0; |
foreach (@$titles) { |
foreach (@$titles) { |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
Line 3299 sub scantron_parse_scanline {
|
Line 3301 sub scantron_parse_scanline {
|
} |
} |
|
|
sub scantron_add_delay { |
sub scantron_add_delay { |
|
my ($delayqueue,$scanline,$errormessage,$errorcode)=@_; |
|
Apache->request->print('add_delay_error '.$_[2] ); |
|
push(@$delayqueue, |
|
{'line' => $scanline, 'emsg' => $errormessage, |
|
'ecode' => $errorcode } |
|
); |
} |
} |
|
|
sub scantron_find_student { |
sub scantron_find_student { |
my ($scantron_record,$idmap)=@_; |
my ($scantron_record,$idmap)=@_; |
my $scanID=$$scantron_record{'scantron.ID'}; |
my $scanID=$$scantron_record{'scantron.ID'}; |
foreach my $id (keys(%$idmap)) { |
foreach my $id (keys(%$idmap)) { |
Apache->request->print('<pre>checking studnet -'.$id.'- againt -'.$scanID.'- </pre>'); |
#Apache->request->print('<pre>checking studnet -'.$id.'- againt -'.$scanID.'- </pre>'); |
if (lc($id) eq lc($scanID)) { Apache->request->print('success');return $$idmap{$id}; } |
if (lc($id) eq lc($scanID)) { |
|
#Apache->request->print('success'); |
|
return $$idmap{$id}; |
|
} |
} |
} |
return undef; |
return undef; |
} |
} |
Line 3319 sub scantron_filter {
|
Line 3330 sub scantron_filter {
|
return 0; |
return 0; |
} |
} |
|
|
|
#FIXME I think I am doing this in the wrong order, I think it would be |
|
#better to make a several passes analyzing all of the lines in the |
|
#file for common errors wrong/invalid PID/username duplicated |
|
#PID/username, missing bubbles, double bubbles, missing/invalid CODE |
|
#and then get the instructor to fix all of these errors, then grade |
|
#the corrected one, I'll still need to catch error conditions, but |
|
#maybe most will taken care even before we start |
sub scantron_process_students { |
sub scantron_process_students { |
my ($r) = @_; |
my ($r) = @_; |
my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($ENV{'form.selectpage'}); |
my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($ENV{'form.selectpage'}); |
Line 3334 sub scantron_process_students {
|
Line 3352 sub scantron_process_students {
|
my $navmap=Apache::lonnavmaps::navmap->new(); |
my $navmap=Apache::lonnavmaps::navmap->new(); |
my $map=$navmap->getResourceByUrl($sequence); |
my $map=$navmap->getResourceByUrl($sequence); |
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
$r->print("geto ".scalar(@resources)."<br />"); |
# $r->print("geto ".scalar(@resources)."<br />"); |
my $result= <<SCANTRONFORM; |
my $result= <<SCANTRONFORM; |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload"> |
<input type="hidden" name="command" value="scantron_configphase" /> |
<input type="hidden" name="command" value="scantron_configphase" /> |
Line 3343 SCANTRONFORM
|
Line 3361 SCANTRONFORM
|
$r->print($result); |
$r->print($result); |
|
|
my @delayqueue; |
my @delayqueue; |
my $totalcorrect; |
my %completedstudents; |
my $totalincorrect; |
|
|
|
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, |
'Scantron Status','Scantron Progress',scalar(@scanlines)); |
'Scantron Status','Scantron Progress',scalar(@scanlines)); |
|
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, |
|
'Processing first student'); |
|
my $start=&Time::HiRes::time(); |
foreach my $line (@scanlines) { |
foreach my $line (@scanlines) { |
my $studentcorrect; |
$r->print('<pre>line is'.$line.'</pre>'); |
my $studentincorrect; |
|
|
|
chomp($line); |
chomp($line); |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config); |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config); |
my ($uname,$udom); |
my ($uname,$udom); |
if ($uname=&scantron_find_student($scan_record,\%idmap)) { |
unless ($uname=&scantron_find_student($scan_record,\%idmap)) { |
|
&scantron_add_delay(\@delayqueue,$line, |
|
'Unable to find a student that matches',1); |
|
next; |
|
} |
|
if (exists $completedstudents{$uname}) { |
&scantron_add_delay(\@delayqueue,$line, |
&scantron_add_delay(\@delayqueue,$line, |
'Unable to find a student that matches'); |
'Student '.$uname.' has multiple sheets',2); |
|
next; |
} |
} |
$r->print('<pre>doing studnet'.$uname.'</pre>'); |
$r->print('<pre>doing studnet'.$uname.'</pre>'); |
($uname,$udom)=split(/:/,$uname); |
($uname,$udom)=split(/:/,$uname); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::appenv(%$scan_record); |
&Apache::lonnet::appenv(%$scan_record); |
# &Apache::lonhomework::showhash(%ENV); |
# &Apache::lonhomework::showhash(%ENV); |
$Apache::lonxml::debug=1; |
# $Apache::lonxml::debug=1; |
&Apache::lonxml::debug("line is $line"); |
# &Apache::lonxml::debug("line is $line"); |
|
|
my $i=0; |
my $i=0; |
foreach my $resource (@resources) { |
foreach my $resource (@resources) { |
Line 3377 SCANTRONFORM
|
Line 3402 SCANTRONFORM
|
'grade_domain' =>$udom, |
'grade_domain' =>$udom, |
'grade_courseid'=>$ENV{'request.course.id'}, |
'grade_courseid'=>$ENV{'request.course.id'}, |
'grade_symb' =>$resource->symb())); |
'grade_symb' =>$resource->symb())); |
my %score=&Apache::lonnet::restore($resource->symb(), |
# my %score=&Apache::lonnet::restore($resource->symb(), |
$ENV{'request.course.id'}, |
# $ENV{'request.course.id'}, |
$udom,$uname); |
# $udom,$uname); |
foreach my $part ($resource->{PARTS}) { |
# foreach my $part ($resource->{PARTS}) { |
if ($score{'resource.'.$part.'.solved'} =~ /^correct/) { |
# if ($score{'resource.'.$part.'.solved'} =~ /^correct/) { |
$studentcorrect++; |
# $studentcorrect++; |
$totalcorrect++; |
# $totalcorrect++; |
} else { |
# } else { |
$studentincorrect++; |
# $studentincorrect++; |
$totalincorrect++; |
# $totalincorrect++; |
} |
# } |
} |
# } |
$r->print('<pre>'. |
# $r->print('<pre>'. |
$resource->symb().'-'. |
# $resource->symb().'-'. |
$resource->src().'-'.'</pre>result is'.$result); |
# $resource->src().'-'.'</pre>result is'.$result); |
&Apache::lonhomework::showhash(%score); |
# &Apache::lonhomework::showhash(%score); |
# if ($i eq 3) {last;} |
# if ($i eq 3) {last;} |
} |
} |
|
$completedstudents{$uname}={'line'=>$line}; |
|
} continue { |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('scantron\.'); |
&Apache::lonnet::delenv('scantron\.'); |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
'last student Who got a '.$studentcorrect.' correct and '. |
'last student'); |
$studentincorrect.' incorrect. The class has gotten '. |
#last; |
$totalcorrect.' correct and '.$totalincorrect.' incorrect'); |
|
last; |
|
#FIXME |
#FIXME |
#get iterator for $sequence |
#get iterator for $sequence |
#foreach question 'submit' the students answer to the server |
#foreach question 'submit' the students answer to the server |
Line 3409 SCANTRONFORM
|
Line 3434 SCANTRONFORM
|
# generate data to pass back that includes grade recevied |
# generate data to pass back that includes grade recevied |
#} |
#} |
} |
} |
$Apache::lonxml::debug=0; |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
|
my $lasttime = &Time::HiRes::time()-$start; |
|
$r->print("<p>took $lasttime</p>"); |
|
|
|
#$Apache::lonxml::debug=0; |
foreach my $delay (@delayqueue) { |
foreach my $delay (@delayqueue) { |
#FIXME |
#FIXME |
#print out each delayed student with interface to select how |
#print out each delayed student with interface to select how |
Line 3620 sub handler {
|
Line 3649 sub handler {
|
my ($tsymb,$tuname,$tudom,$tcrsid)= |
my ($tsymb,$tuname,$tudom,$tcrsid)= |
&Apache::lonnet::checkin($token); |
&Apache::lonnet::checkin($token); |
if ($tsymb) { |
if ($tsymb) { |
my ($map,$id,$url)=split(/\_\_\_/,$tsymb); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($tsymb); |
if (&Apache::lonnet::allowed('mgr',$tcrsid)) { |
if (&Apache::lonnet::allowed('mgr',$tcrsid)) { |
$request->print(&Apache::lonnet::ssi_body('/res/'.$url, |
$request->print(&Apache::lonnet::ssi_body('/res/'.$url, |
('grade_username' => $tuname, |
('grade_username' => $tuname, |