version 1.30, 2002/06/24 21:05:12
|
version 1.31, 2002/06/25 21:07:56
|
Line 244 sub viewstudentgrade {
|
Line 244 sub viewstudentgrade {
|
$result.="<tr bgcolor=$cellclr><td>$username</td><td>$fullname</td><td align=\"middle\">$domain</td>\n"; |
$result.="<tr bgcolor=$cellclr><td>$username</td><td>$fullname</td><td align=\"middle\">$domain</td>\n"; |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
my ($temp,$part,$type)=split(/_/,$part); |
my ($temp,$part,$type)=split(/_/,$part); |
#print "resource.$part.$type = ".$record{"resource.$part.$type"}." <br />\n"; |
my $score=$record{"resource.$part.$type"}; |
if ($type eq 'awarded') { |
if ($type eq 'awarded' || $type eq 'tries') { |
my $score=$record{"resource.$part.$type"}; |
$result.='<td align="middle"><input type="text" name="GRADE.'.$student.'.'.$part.'.'.$type. |
$result.="<td align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n"; |
'" value="'.$score.'" size="4" /></td>'."\n"; |
} elsif ($type eq 'tries') { |
|
my $score=$record{"resource.$part.$type"}; |
|
$result.="<td align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n" |
|
} elsif ($type eq 'solved') { |
} elsif ($type eq 'solved') { |
my $score=$record{"resource.$part.$type"}; |
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"; |
if ($score =~ /^correct/) { |
my $optsel = '<option>correct</option><option>incorrect</option><option>excused</option>'. |
$result.="<option selected=\"on\">correct</option>\n<option>incorrect</option>\n<option>excused</option>\n<option>ungraded</option>\n<option>nothing</option>\n"; |
'<option>ungraded</option><option>handgraded</option><option>nothing</option>'."\n"; |
} elsif ($score =~ /^incorrect/) { |
$status = 'nothing' if ($status eq ''); |
$result.="<option>correct</option>\n<option selected=\"on\">incorrect</option>\n<option>excused</option>\n<option>ungraded</option>\n<option>nothing</option>\n"; |
$optsel =~ s/<option>$status/<option selected="on">$status/; |
} elsif ($score eq '') { |
$result.=$optsel; |
$result.="<option>correct</option>\n<option>incorrect</option>\n<option>excused</option>\n<option>ungraded</option>\n<option selected=\"on\">nothing</option>\n"; |
|
} elsif ($score =~ /^excused/) { |
|
$result.="<option>correct</option>\n<option>incorrect</option>\n<option selected=\"on\">excused</option>\n<option>ungraded</option>\n<option>nothing</option>\n"; |
|
} elsif ($score =~ /^ungraded/) { |
|
$result.="<option>correct</option>\n<option>incorrect</option>\n<option>excused</option>\n<option selected=\"on\">ungraded</option>\n<option>nothing</option>\n"; |
|
} |
|
$result.="</select></td>\n"; |
$result.="</select></td>\n"; |
} |
} |
} |
} |
$result.='<td></td></tr>'; |
$result.='<td></td></tr>'; |
return $result; |
return $result; |
} |
} |
#FIXME need to look at the meatdata <stores> spec on what type of data to accept and provide an |
|
|
#FIXME need to look at the metadata <stores> spec on what type of data to accept and provide an |
#interface based on that, also do that to above function. |
#interface based on that, also do that to above function. |
sub setstudentgrade { |
sub setstudentgrade { |
my ($url,$symb,$courseid,$student,@parts) = @_; |
my ($url,$symb,$courseid,$student,@parts) = @_; |
|
|
my $result =''; |
my $result =''; |
|
|
my ($stuname,$domain) = split(/:/,$student); |
my ($stuname,$domain) = split(/:/,$student); |
|
|
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$stuname); |
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$stuname); |
|
|
my %newrecord; |
my %newrecord; |
|
|
foreach my $part (@parts) { |
foreach my $part (@parts) { |
Line 324 sub setstudentgrade {
|
Line 313 sub setstudentgrade {
|
return $result; |
return $result; |
} |
} |
|
|
|
# -- show submissions of a student, option to grade |
|
# |
sub submission { |
sub submission { |
my ($request) = @_; |
my ($request) = @_; |
|
$request->print(<<JAVASCRIPT); |
|
<script type="text/javascript"> |
|
function changeRadio(title,url) { |
|
} |
|
</script> |
|
JAVASCRIPT |
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'})--; |
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; } |
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; } |
# if ($ENV{'form.student'} eq '') { &listStudents($request); return ''; } |
|
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; |
my $symb; |
Line 339 sub submission {
|
Line 335 sub submission {
|
$symb=&Apache::lonnet::symbread($url); |
$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 |
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 |
if ($ENV{'form.vProb'} eq 'yes') { |
if ($ENV{'form.vProb'} eq 'yes') { |
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
Line 350 sub submission {
|
Line 349 sub submission {
|
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
$result.='<table border="0"><tr><td bgcolor="#000000">'; |
$result.='<table border="0"><tr><td bgcolor="#000000">'; |
$result.='<table border="0"><tr><td bgcolor="#e6ffff">'; |
$result.='<table border="0"><tr><td bgcolor="#e6ffff">'; |
$result.='<b>Student\'s view of the problem:</b></td></tr><tr><td bgcolor="#ffffe6">'.$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 />'; |
Line 359 sub submission {
|
Line 358 sub submission {
|
$last = 'last' if ($ENV{'form.submission'} eq '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.'<br />Needs an interface for inputting scores'; |
$result.=$answer; |
|
|
my (@parts) = sort(&getpartlist($url)); |
my $maxpt = &Apache::lonnet::EXT('resource.partid.weight',$symb,$udom,$uname); |
|
my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
|
my $score = $record{'resource.0.awarded'}*$maxpt; |
|
|
#start the form |
$result.= '<form action="/adm/grades" method="post" name="SCORE">'."\n". |
$result.= '<form action="/adm/grades" method="post">'."\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="command" value="editgrades" />'."\n". |
'<table border=0><tr><td bgcolor="#000000">'."\n". |
'<table border="0"><tr><td><b>Points</b></td><td>'; |
'<table border=0>'."\n". |
my $ctr = 0; |
'<tr bgcolor="#e6ffff"><td>'."\n"; |
while ($ctr<=$maxpt) { |
|
$result.= '<input type="radio" name="radval" '. |
$result.='</tr>'; |
'onclick="javascript:SCORE.GRADE_'.$ENV{'form.student'}.'.value='.$ctr.'" value="'.$ctr.'" '. |
#get info for each student |
($score == $ctr? 'checked':'').' /> '.$ctr."\n"; |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$uname,@parts); |
$ctr++; |
|
} |
|
$result.='</td><td> <b>or</b> </td>'; |
|
$result.='<td><input type="text" name="GRADE_'.$ENV{'form.student'}.'"'. |
|
($score ne ''? ' value = "'.$score.'"':'').' size="4" /></td>'."\n"; |
|
$result.='<td>/'.$maxpt.' (max pts)</td><td>'; |
|
|
$result.='</table></td></tr></table><input type="submit" name="submit" value="Submit Changes" /></form>'; |
foreach my $part (&getpartlist($url)) { |
|
my ($temp,$part,$type)=split(/_/,$part); |
|
if ($type eq 'solved') { |
|
my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); |
|
$result.="<select name=\"GRADE.$uname:$udom.$part.$type\">\n"; |
|
my $optsel = '<option>correct</option><option>incorrect</option>'. |
|
'<option>excused</option><option>ungraded</option>'. |
|
'<option>handgraded</option><option>nothing</option>'."\n"; |
|
$status = 'nothing' if ($status eq ''); |
|
$optsel =~ s/<option>$status/<option selected="on">$status/; |
|
$result.=$optsel; |
|
$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.='<input type="submit" name="gradeOpt" value="Next" /> '; |
|
$result.='<input type="submit" name="gradeOpt" value="Previous" /> '; |
|
$result.='</td><tr></table></form>'; |
return $result; |
return $result; |
} |
} |
|
|
Line 477 sub viewgrades {
|
Line 499 sub viewgrades {
|
foreach my $part (@parts) { |
foreach my $part (@parts) { |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
|
print "Manual grading:$url:$part:$display:<br>"; |
$result.='<td><b>'.$display.'</b></td>'."\n"; |
$result.='<td><b>'.$display.'</b></td>'."\n"; |
} |
} |
$result.='</tr>'; |
$result.='</tr>'; |
#get info for each student |
#get info for each student |
foreach my $student ( sort(@{ $classlist{'allids'} }) ) { |
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); |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts); |
} |
} |
$result.='</table></td></tr></table><input type="submit" name="submit" value="Submit Changes" /></form>'; |
$result.='</table></td></tr></table>'; |
|
$result.='<input type="submit" name="submit" value="Submit Changes" /></form>'; |
$result.=&show_grading_menu_form($symb,$url); |
$result.=&show_grading_menu_form($symb,$url); |
return $result; |
return $result; |
} |
} |