version 1.31, 2002/06/25 21:07:56
|
version 1.33, 2002/06/27 21:34:18
|
Line 87 sub verifyreceipt {
|
Line 87 sub verifyreceipt {
|
} |
} |
} |
} |
$request->printf('<p>'.$matches." match%s</p>",$matches <= 1 ? '' : 'es'); |
$request->printf('<p>'.$matches." match%s</p>",$matches <= 1 ? '' : 'es'); |
|
# needs to print who is matched |
} |
} |
return ''; |
return ''; |
} |
} |
Line 116 ENDHEADER
|
Line 117 ENDHEADER
|
return ''; |
return ''; |
} |
} |
|
|
|
sub student_gradeStatus { |
|
my ($url,$udom,$uname) = @_; |
|
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
|
my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
|
foreach my $part (&getpartlist($url)) { |
|
my ($temp,$part,$type)=split(/_/,$part); |
|
if ($type eq 'solved') { |
|
my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); |
|
$status = 'nothing' if ($status eq ''); |
|
return $type,$status; |
|
} |
|
} |
|
return ''; |
|
} |
|
|
sub listStudents { |
sub listStudents { |
my ($request) = shift; |
my ($request) = shift; |
my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"}; |
Line 124 sub listStudents {
|
Line 140 sub listStudents {
|
$request->print(<<ENDTABLEST); |
$request->print(<<ENDTABLEST); |
<h2><font color="#339933">Show Student Submissions on Assessment</font></h2> |
<h2><font color="#339933">Show Student Submissions on Assessment</font></h2> |
|
|
<table border="0"><tr><td bgcolor="#000000"> |
<table border="0"><tr><td bgcolor="#777777"> |
<table border="0"> |
<table border="0"> |
<tr bgcolor="#e6ffff"><td colspan="6"><b>Resource: </b> $ENV{'form.url'}</td></tr> |
<tr bgcolor="#e6ffff"><td colspan="7"><b>Resource: </b> $ENV{'form.url'}</td></tr> |
<tr bgcolor="#e6ffff"><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td> |
<tr bgcolor="#e6ffff"><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td> |
<td><b>View Problem</b></td><td><b>Submissions</b></td><td><b>Action</b></td></tr> |
<td><b>View Problem</b></td><td><b>Submissions</b></td> |
|
<td><b>Grade Status</b></td><td><b>Action</b></td></tr> |
ENDTABLEST |
ENDTABLEST |
my (%classlist) = &getclasslist($cdom,$cnum,'0'); |
my (%classlist) = &getclasslist($cdom,$cnum,'0'); |
foreach my $student ( sort(@{ $classlist{'allids'} }) ) { |
foreach my $student ( sort(@{ $classlist{'allids'} }) ) { |
Line 145 ENDTABLEST
|
Line 162 ENDTABLEST
|
$fullname.=$name{'firstname'}.' '.$name{'middlename'}; |
$fullname.=$name{'firstname'}.' '.$name{'middlename'}; |
} |
} |
if ( $Apache::grades::viewgrades eq 'F' ) { |
if ( $Apache::grades::viewgrades eq 'F' ) { |
$request->print("\n".'<tr bgcolor=#ffffe6>'."<td>$sname</td><td>$fullname</td><td>$sdom</td>". |
$request->print("\n".'<tr bgcolor=#ffffe6>'."<td>$sname</td><td>$fullname</td><td align=\"middle\">$sdom</td>". |
'<form action="/adm/grades" method="post">'); |
'<form action="/adm/grades" method="post">'); |
if ($ENV{'form.url'}) { |
if ($ENV{'form.url'}) { |
$request->print( |
$request->print( |
Line 167 ENDTABLEST
|
Line 184 ENDTABLEST
|
'<input type="radio" name="vProb" value="no" checked> no '. |
'<input type="radio" name="vProb" value="no" checked> no '. |
'<input type="radio" name="vProb" value="yes"> yes </td>'); |
'<input type="radio" name="vProb" value="yes"> yes </td>'); |
$request->print('<td>'. |
$request->print('<td>'. |
'<input type="radio" name="submission" value="last" checked> last '. |
'<input type="radio" name="lastSub" value="last" checked> last '. |
'<input type="radio" name="submission" value="all"> all </td>'); |
'<input type="radio" name="lastSub" value="all"> all </td>'); |
|
my ($type,$status) = &student_gradeStatus($ENV{'form.url'},$cdom,$sname); |
|
$request->print( |
|
'<td align="middle">'.$status.' </td>'); |
$request->print( |
$request->print( |
'<td><input type="submit" name="submit" value="View/Grade" />'); |
'<td><input type="submit" name="submit" value="View/Grade" />'); |
$request->print('</td></tr></form>'); |
$request->print('</td></tr></form>'); |
Line 237 sub viewstudentgrade {
|
Line 257 sub viewstudentgrade {
|
my (@requests) = ('lastname','firstname','middlename','generation'); |
my (@requests) = ('lastname','firstname','middlename','generation'); |
my (%name) = &Apache::lonnet::get('environment',\@requests,$domain,$username); |
my (%name) = &Apache::lonnet::get('environment',\@requests,$domain,$username); |
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$username); |
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$username); |
|
|
my $fullname=$name{'lastname'}.$name{'generation'}; |
my $fullname=$name{'lastname'}.$name{'generation'}; |
if ($fullname =~ /[^\s]+/) { $fullname.=', '; } |
if ($fullname =~ /[^\s]+/) { $fullname.=', '; } |
$fullname.=$name{'firstname'}.' '.$name{'middlename'}; |
$fullname.=$name{'firstname'}.' '.$name{'middlename'}; |
Line 252 sub viewstudentgrade {
|
Line 273 sub viewstudentgrade {
|
my ($status,$foo)=split(/_/,$score,2); |
my ($status,$foo)=split(/_/,$score,2); |
$result.="<td align=\"middle\"><select name=\"GRADE.$student.$part.$type\">\n"; |
$result.="<td align=\"middle\"><select name=\"GRADE.$student.$part.$type\">\n"; |
my $optsel = '<option>correct</option><option>incorrect</option><option>excused</option>'. |
my $optsel = '<option>correct</option><option>incorrect</option><option>excused</option>'. |
'<option>ungraded</option><option>handgraded</option><option>nothing</option>'."\n"; |
'<option>ungraded</option><option>partial</option><option>nothing</option>'."\n"; |
$status = 'nothing' if ($status eq ''); |
$status = 'nothing' if ($status eq ''); |
$optsel =~ s/<option>$status/<option selected="on">$status/; |
$optsel =~ s/<option>$status/<option selected="on">$status/; |
$result.=$optsel; |
$result.=$optsel; |
Line 277 sub setstudentgrade {
|
Line 298 sub setstudentgrade {
|
my ($temp,$part,$type)=split(/_/,$part); |
my ($temp,$part,$type)=split(/_/,$part); |
my $oldscore=$record{"resource.$part.$type"}; |
my $oldscore=$record{"resource.$part.$type"}; |
my $newscore=$ENV{"form.GRADE.$student.$part.$type"}; |
my $newscore=$ENV{"form.GRADE.$student.$part.$type"}; |
|
print "old=$oldscore:new=$newscore:<br>"; |
if ($type eq 'solved') { |
if ($type eq 'solved') { |
my $update=0; |
my $update=0; |
if ($newscore eq 'nothing' ) { |
if ($newscore eq 'nothing' ) { |
Line 305 sub setstudentgrade {
|
Line 327 sub setstudentgrade {
|
} |
} |
} |
} |
if ( scalar(keys(%newrecord)) > 0 ) { |
if ( scalar(keys(%newrecord)) > 0 ) { |
$newrecord{"resource.regrader"}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
print "grader=$newrecord{'resource.regrader'}:<br>records<br>"; |
|
while (my ($k,$v) = each %newrecord) { |
|
print "k=$k:v=$v:<br>\n"; |
|
} |
&Apache::lonnet::cstore(\%newrecord,$symb,$courseid,$domain,$stuname); |
&Apache::lonnet::cstore(\%newrecord,$symb,$courseid,$domain,$stuname); |
|
|
$result.="Stored away ".scalar(keys(%newrecord))." elements.<br />\n"; |
$result.="Stored away ".scalar(keys(%newrecord))." elements.<br />\n"; |
Line 313 sub setstudentgrade {
|
Line 339 sub setstudentgrade {
|
return $result; |
return $result; |
} |
} |
|
|
# -- show submissions of a student, option to grade |
|
# |
# |
|
# --------------------------- show submissions of a student, option to grade -------- |
sub submission { |
sub submission { |
my ($request) = @_; |
my ($request) = @_; |
|
|
$request->print(<<JAVASCRIPT); |
$request->print(<<JAVASCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript" language="javascript"> |
function changeRadio(title,url) { |
function updateRadio(radioButton,formtextbox,formsel,wgt) { |
|
var pts = formtextbox.value; |
|
var resetbox =false; |
|
if (isNaN(pts) || pts < 0) { |
|
alert("A number equal or greater than 0 is expected. Entered value = "+pts); |
|
for (var i=0; i<radioButton.length; i++) { |
|
if (radioButton[i].checked) { |
|
formtextbox.value = i; |
|
resetbox = true; |
|
} |
|
} |
|
if (!resetbox) { |
|
formtextbox.value = ""; |
|
} |
|
return; |
} |
} |
|
|
|
for (var i=0; i<radioButton.length; i++) { |
|
radioButton[i].checked=false; |
|
if (pts == i) { |
|
radioButton[i].checked=true; |
|
} |
|
} |
|
updateSelect(formsel,pts,wgt); |
|
} |
|
|
|
function writeBox(formrad,formsel,pts,wgt) { |
|
formrad.value = pts; |
|
updateSelect(formsel,pts,wgt); |
|
return; |
|
} |
|
|
|
function updateSelect(formsel,pts,wgt) { |
|
if (pts == 0) { |
|
formsel[1].selected = true; |
|
} |
|
if (pts > 0 && pts < wgt) { |
|
formsel[4].selected = true; |
|
} |
|
if (pts == wgt) { |
|
formsel[0].selected = true; |
|
} |
|
return; |
|
} |
|
|
</script> |
</script> |
JAVASCRIPT |
JAVASCRIPT |
my $url=$ENV{'form.url'}; |
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
|
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; } |
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; } |
|
print "formstu=$ENV{'form.student'}:<br>"; |
my ($uname,$udom) = &finduser($ENV{'form.student'}); |
my ($uname,$udom) = &finduser($ENV{'form.student'}); |
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; } |
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; } |
my $symb; |
|
if ($ENV{'form.symb'}) { |
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
$symb=$ENV{'form.symb'}; |
|
} else { |
|
$symb=&Apache::lonnet::symbread($url); |
|
} |
|
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
# |
# |
# header info |
# header info |
my $result='<h2><font color="#339933">Submission Record</font></h2>'; |
my $result='<h2><font color="#339933">Submission Record</font></h2>'; |
$result.='<table border="0"><tr><td><b>Username: </b>'.$uname.'</td><td><b>Fullname: </b>'.$ENV{'form.fullname'}.'</td><td><b>Domain: </b>'.$udom.'</td></tr>'; |
$result.='<table border="0"><tr><td><b>Username: </b>'.$uname. |
|
'</td><td><b>Fullname: </b>'.$ENV{'form.fullname'}.'</td><td><b>Domain: </b>'.$udom.'</td></tr>'; |
$result.='<tr><td colspan=3><b>Resource: </b>'.$url.'</td></tr></table>'; |
$result.='<tr><td colspan=3><b>Resource: </b>'.$url.'</td></tr></table>'; |
# |
# |
# option to display problem |
# option to display problem |
Line 347 JAVASCRIPT
|
Line 414 JAVASCRIPT
|
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
$result.='<table border="0"><tr><td bgcolor="#000000">'; |
$result.='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
$result.='<table border="0"><tr><td bgcolor="#e6ffff">'; |
$result.='<table border="0" width="100%"><tr><td bgcolor="#e6ffff">'; |
$result.='<b>Student\'s view of the problem</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
$result.='<b>Student\'s view of the problem</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
$result.='<b>Correct answer:</b><br />'.$companswer; |
$result.='<b>Correct answer:</b><br />'.$companswer; |
$result.='</td></tr></table>'; |
$result.='</td></tr></table>'; |
$result.='</td></tr></table><br />'; |
$result.='</td></tr></table><br />'; |
} |
} |
my $last = ''; |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
$last = 'last' if ($ENV{'form.submission'} eq 'last'); |
|
my $answer=&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, |
my $answer=&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, |
$ENV{'request.course.id'},$last); |
$ENV{'request.course.id'},$last); |
$result.=$answer; |
$result.=$answer; |
|
|
my $maxpt = &Apache::lonnet::EXT('resource.partid.weight',$symb,$udom,$uname); |
my $wgt = &Apache::lonnet::EXT('resource.partid.weight',$symb,$udom,$uname); |
my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
my $score = $record{'resource.0.awarded'}*$maxpt; |
my $score = $record{'resource.0.awarded'}*$wgt; |
|
|
$result.= '<form action="/adm/grades" method="post" name="SCORE">'."\n". |
$result.= '<form action="/adm/grades" method="post" name="SCORE">'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="vProb" value="'.$ENV{'form.vProb'}.'" />'."\n". |
'<table border="0"><tr><td><b>Points</b></td><td>'; |
'<input type="hidden" name="lastSub" value="'.$last.'" />'."\n". |
|
'<input type="hidden" name="command" value="handgrade" />'."\n". |
|
'<input type="hidden" name="NCT"'. |
|
' value="'.($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1').'" />'."\n"; |
|
|
|
my $counter = 0; |
|
$result.='<input type="hidden" name="WGT'.$counter.'" value="'.$wgt.'" />'. |
|
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'.$udom.'" />'."\n"; |
|
$result.='<table border="0"><tr><td><b>Points</b></td><td>'; |
my $ctr = 0; |
my $ctr = 0; |
while ($ctr<=$maxpt) { |
while ($ctr<=$wgt) { |
$result.= '<input type="radio" name="radval" '. |
$result.= '<input type="radio" name="RADVAL'.$counter.'" '. |
'onclick="javascript:SCORE.GRADE_'.$ENV{'form.student'}.'.value='.$ctr.'" value="'.$ctr.'" '. |
'onclick="javascript:writeBox(this.form.GRADE_BOX'.$counter. |
($score == $ctr? 'checked':'').' /> '.$ctr."\n"; |
',this.form.GRADE_SEL'.$counter.',\''.$ctr.'\',\''.$wgt.'\')" '. |
|
($score == $ctr? 'checked':'').' /> '.$ctr."\n"; |
$ctr++; |
$ctr++; |
} |
} |
$result.='</td><td> <b>or</b> </td>'; |
$result.='</td><td> <b>or</b> </td>'; |
$result.='<td><input type="text" name="GRADE_'.$ENV{'form.student'}.'"'. |
$result.='<td><input type="text" name="GRADE_BOX'.$counter.'"'. |
($score ne ''? ' value = "'.$score.'"':'').' size="4" /></td>'."\n"; |
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
$result.='<td>/'.$maxpt.' (max pts)</td><td>'; |
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter. |
|
',this.form.GRADE_BOX'.$counter. |
|
',this.form.GRADE_SEL'.$counter.',\''.$wgt.'\')" /></td>'."\n"; |
|
$result.='<td>/'.($wgt > 0 ? $wgt.' (problem weight)' : '<font color="red">invalid problem weight</font>' ). |
|
' </td><td>'; |
|
|
foreach my $part (&getpartlist($url)) { |
foreach my $part (&getpartlist($url)) { |
my ($temp,$part,$type)=split(/_/,$part); |
my ($temp,$part,$type)=split(/_/,$part); |
if ($type eq 'solved') { |
if ($type eq 'solved') { |
my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); |
my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); |
$result.="<select name=\"GRADE.$uname:$udom.$part.$type\">\n"; |
$result.='<select name="GRADE_SEL'.$counter.'">'."\n"; |
my $optsel = '<option>correct</option><option>incorrect</option>'. |
my $optsel = '<option>correct</option><option>incorrect</option>'. |
'<option>excused</option><option>ungraded</option>'. |
'<option>excused</option><option>ungraded</option>'. |
'<option>handgraded</option><option>nothing</option>'."\n"; |
'<option>partial</option><option>nothing</option>'."\n"; |
$status = 'nothing' if ($status eq ''); |
$status = 'nothing' if ($status eq ''); |
$optsel =~ s/<option>$status/<option selected="on">$status/; |
$optsel =~ s/<option>$status/<option selected="on">$status/; |
$result.=$optsel; |
$result.=$optsel; |
$result.="</select></td></tr>\n"; |
$result.="</select></td></tr>\n"; |
} |
} |
} |
} |
$result.='<tr><td colspan="5">The buttons do not work yet.<input type="submit" name="gradeOpt" value="Save N Next" /> '; |
|
|
$result.='<tr><td colspan="6"><input type="submit" name="gradeOpt" value="Save & Next" />'; |
|
my $ntstu ='<select name="NTSTU">'. |
|
'<option>1</option><option>2</option>'. |
|
'<option>3</option><option>5</option>'. |
|
'<option>7</option><option>10</option></select>'."\n"; |
|
my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); |
|
$ntstu =~ s/<option>$nsel/<option selected="on">$nsel/; |
|
$result.=$ntstu.'student(s) '."\n <br />"; |
$result.='<input type="submit" name="gradeOpt" value="Next" /> '; |
$result.='<input type="submit" name="gradeOpt" value="Next" /> '; |
$result.='<input type="submit" name="gradeOpt" value="Previous" /> '; |
$result.='<input type="submit" name="gradeOpt" value="Previous" /> '; |
|
$result.='(Next and Previous do not save the scores.)'; |
$result.='</td><tr></table></form>'; |
$result.='</td><tr></table></form>'; |
return $result; |
return $result; |
} |
} |
|
|
|
sub processHandGrade { |
|
my ($request) = @_; |
|
my $result=''; |
|
|
|
my $url = $ENV{'form.url'}; |
|
my $symb = $ENV{'form.symb'}; |
|
my $button = $ENV{'form.gradeOpt'}; |
|
my $ngrade = $ENV{'form.NCT'}; |
|
my $ntstu = $ENV{'form.NTSTU'}; |
|
my $vProb = $ENV{'form.vProb'}; |
|
my $lastSub= $ENV{'form.lastSub'}; |
|
|
|
my (@parts) = sort(&getpartlist($url)); |
|
if ($button eq 'Save & Next') { |
|
my $ctr = 0; |
|
while ($ctr < $ENV{'form.NCT'}) { |
|
my $pts = ($ENV{'form.GRADE_BOX'.$ctr} ne '' ? $ENV{'form.GRADE_BOX'.$ctr} : $ENV{'form.RADVAL'.$ctr}); |
|
my $wgt = $ENV{'form.WGT'.$ctr}; |
|
my $sel = $ENV{'form.GRADE_SEL'.$ctr}; |
|
my $score = $pts/$wgt if ($wgt != 0); |
|
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); |
|
&saveHandGrade($url,$symb,$uname,$udom,$score,@parts); |
|
$ctr++; |
|
} |
|
} |
|
my $firststu = $ENV{'form.unamedom0'}; |
|
my $laststu = $ENV{'form.unamedom'.($ngrade-1)}; |
|
|
|
#get classlist |
|
my ($cdom,$cnum) = split(/_/,$ENV{'request.course.id'}); |
|
my (%classlist) = &getclasslist($cdom,$cnum,'0'); |
|
|
|
my (@nextlist,@prevlist); |
|
my ($nextflg,$prevflg,$ctr) = (0,0,0); |
|
foreach my $student ( sort(@{ $classlist{'allids'} }) ) { |
|
my ($uname,$udom) = split(/:/,$student); |
|
if ($nextflg == 1 && $button =~ /Next$/) { |
|
push @nextlist,$uname if ($ctr < $ENV{'form.NTSTU'}); |
|
$ctr++; |
|
} |
|
$nextflg = 1 if ($student eq $laststu); |
|
$prevflg = 1 if ($student eq $firststu); |
|
} |
|
foreach my $student (@nextlist) { |
|
$ENV{'form.student'} = $student; |
|
$request->print(&submission($request)); |
|
} |
|
$request->print ("<h2><font color=\"#339933\">Grading</font></h2>"); |
|
|
|
#get info for each student |
|
foreach my $student ( sort(@{ $classlist{'allids'} }) ) { |
|
my $display=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts); |
|
print "ID=$ENV{'request.course.id'}:STU=$student:DIS=$display:<br>\n"; |
|
# $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts); |
|
} |
|
|
|
return 'The End'; |
|
# return $result; |
|
} |
|
|
|
sub saveHandGrade { |
|
my ($url,$symb,$stuname,$domain,$newscore,@parts) = @_; |
|
|
|
# my ($stuname,$domain) = split(/:/,$student); |
|
my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
|
my %newrecord; |
|
|
|
foreach my $part (@parts) { |
|
my ($temp,$part,$type)=split(/_/,$part); |
|
my $oldscore=$record{"resource.$part.$type"}; |
|
if ($type eq 'solved') { |
|
my $update=0; |
|
if ($newscore eq 'nothing' ) { |
|
if ($oldscore ne '') { |
|
$update=1; |
|
$newscore = ''; |
|
} |
|
} elsif ($oldscore !~ m/^$newscore/) { |
|
$update=1; |
|
if ($newscore eq 'correct') { $newscore = 'correct_by_override'; } |
|
if ($newscore eq 'incorrect') { $newscore = 'incorrect_by_override'; } |
|
if ($newscore eq 'excused') { $newscore = 'excused'; } |
|
if ($newscore eq 'ungraded') { $newscore = 'ungraded_attempted'; } |
|
if ($newscore eq 'partial') { $newscore = 'partial_correct'; } |
|
} |
|
if ($update) { $newrecord{"resource.$part.$type"}=$newscore; } |
|
} else { |
|
if ($oldscore ne $newscore) { |
|
$newrecord{"resource.$part.$type"}=$newscore; |
|
} |
|
} |
|
if ( scalar(keys(%newrecord)) > 0 ) { |
|
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
# print "grader=$newrecord{'resource.regrader'}:<br>records<br>"; |
|
# while (my ($k,$v) = each %newrecord) { |
|
# print "k=$k:v=$v:<br>\n"; |
|
# } |
|
# &Apache::lonnet::cstore(\%newrecord,$symb,$courseid,$domain,$stuname); |
|
} |
|
return ''; |
|
} |
|
} |
|
|
sub get_symb_and_url { |
sub get_symb_and_url { |
my ($request) = @_; |
my ($request) = @_; |
my $url=$ENV{'form.url'}; |
my $url=$ENV{'form.url'}; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
my $symb=$ENV{'form.symb'}; |
# my $symb=$ENV{'form.symb'}; |
if (!$symb) { $symb=&Apache::lonnet::symbread($url); } |
# if (!$symb) { $symb=&Apache::lonnet::symbread($url); } |
|
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
return ($symb,$url); |
return ($symb,$url); |
} |
} |
Line 440 sub gradingmenu {
|
Line 632 sub gradingmenu {
|
if (!$symb) {return '';} |
if (!$symb) {return '';} |
|
|
my $result='<h2> <font color="#339933">Select a Grading Method</font></h2><br />'; |
my $result='<h2> <font color="#339933">Select a Grading Method</font></h2><br />'; |
$result.='<table width=100% border=0><tr><td bgcolor=#000000>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
$result.=' <b>Resource :</b> '.$url.'</td></tr>'."\n"; |
$result.=' <b>Resource :</b> '.$url.'</td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
Line 493 sub viewgrades {
|
Line 685 sub viewgrades {
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="submit" name="submit" value="Submit Changes" />'."\n". |
'<input type="submit" name="submit" value="Submit Changes" />'."\n". |
'<table border=0><tr><td bgcolor="#000000">'."\n". |
'<table border=0><tr><td bgcolor="#777777">'."\n". |
'<table border=0>'."\n". |
'<table border=0>'."\n". |
'<tr bgcolor='.$headerclr.'><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td>'."\n"; |
'<tr bgcolor='.$headerclr.'><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td>'."\n"; |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
Line 868 sub handler {
|
Line 1060 sub handler {
|
$request->print(&gradingmenu($request)); |
$request->print(&gradingmenu($request)); |
} elsif ($command eq 'viewgrades') { |
} elsif ($command eq 'viewgrades') { |
$request->print(&viewgrades($request)); |
$request->print(&viewgrades($request)); |
|
} elsif ($command eq 'handgrade') { |
|
$request->print(&processHandGrade($request)); |
} elsif ($command eq 'editgrades') { |
} elsif ($command eq 'editgrades') { |
$request->print(&editgrades($request)); |
$request->print(&editgrades($request)); |
} elsif ($command eq 'verify') { |
} elsif ($command eq 'verify') { |