version 1.42, 2002/07/26 20:28:42
|
version 1.43, 2002/07/30 19:59:58
|
Line 131 sub response_type {
|
Line 131 sub response_type {
|
my %seen = (); |
my %seen = (); |
my (@partlist,%handgrade); |
my (@partlist,%handgrade); |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
if (/^\w+response_\d{1,2}.*/) { |
if (/^\w+response_\d+.*/) { |
my ($responsetype,$part) = split(/_/,$_,2); |
my ($responsetype,$part) = split(/_/,$_,2); |
my ($partid,$respid) = split(/_/,$part); |
my ($partid,$respid) = split(/_/,$part); |
$handgrade{$part} = $responsetype.':'.($allkeys =~ /parameter_$part\_handgrade/ ? 'yes' : 'no'); |
$handgrade{$part} = $responsetype.':'.($allkeys =~ /parameter_$part\_handgrade/ ? 'yes' : 'no'); |
Line 158 sub listStudents {
|
Line 158 sub listStudents {
|
for (sort keys(%$handgrade)) { |
for (sort keys(%$handgrade)) { |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
$ENV{'form.handgrade'} = 'yes' if ($handgrade eq 'yes'); |
$ENV{'form.handgrade'} = 'yes' if ($handgrade eq 'yes'); |
$result.='<tr><td><b>Part id: </b>'.$_.'</td>'. |
$result.='<tr><td><b>Part id: </b>'.(split(/_/))[0].'</td>'. |
'<td><b>Type: </b>'.$responsetype.'</td>'. |
'<td><b>Type: </b>'.$responsetype.'</td>'. |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
} |
} |
Line 196 ENDTABLEST
|
Line 196 ENDTABLEST
|
'<td><b> Select </b></td><td><b> Username </b></td>'. |
'<td><b> Select </b></td><td><b> Username </b></td>'. |
'<td><b> Fullname </b></td><td><b> Domain </b></td>'; |
'<td><b> Fullname </b></td><td><b> Domain </b></td>'; |
foreach (sort(@$partlist)) { |
foreach (sort(@$partlist)) { |
$result.='<td><b> Part ID '.$_.' Status </b></td>'; |
$result.='<td><b> Part ID '.(split(/_/))[0].' Status </b></td>'; |
} |
} |
$request->print($result.'</tr>'."\n"); |
$request->print($result.'</tr>'."\n"); |
|
|
Line 206 ENDTABLEST
|
Line 206 ENDTABLEST
|
my $statusflg = ''; |
my $statusflg = ''; |
foreach (keys(%status)) { |
foreach (keys(%status)) { |
$statusflg = 1 if ($status{$_} ne 'nothing'); |
$statusflg = 1 if ($status{$_} ne 'nothing'); |
my ($foo,$partid,$foo) = split(/\./,$_); |
my ($foo,$partid,$foo1) = split(/\./,$_); |
if ($status{'resource.'.$partid.'.submitted_by'} ne '') { |
if ($status{'resource.'.$partid.'.submitted_by'} ne '') { |
$statusflg = ''; |
$statusflg = ''; |
$request->print('<input type="hidden" name="'. |
$request->print('<input type="hidden" name="'. |
Line 431 KEYWORDS
|
Line 431 KEYWORDS
|
|
|
# Student info |
# Student info |
$request->print(($counter == 0 ? '' : '<br />')); |
$request->print(($counter == 0 ? '' : '<br />')); |
my $fullname = ($ENV{'form.fullname'} ne '' ? $ENV{'form.fullname'} : &get_fullname($uname,$udom)); |
# my $fullname = ($ENV{'form.fullname'} ne '' ? $ENV{'form.fullname'} : &get_fullname($uname,$udom)); |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'. |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'. |
'<table border="0" width=100%><tr bgcolor="#ffffff"><td>'; |
'<table border="0" width=100%><tr bgcolor="#ffffff"><td>'; |
|
|
$result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$fullname. |
$result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$ENV{'form.fullname'}. |
|
# $result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$fullname. |
'</td><td> <b>Username: </b>'.$uname. |
'</td><td> <b>Username: </b>'.$uname. |
'</td><td> <b>Domain: </b>'.$udom.'</td></tr>'; |
'</td><td> <b>Domain: </b>'.$udom.'</td></tr>'; |
if ($ENV{'form.handgrade'} eq 'yes') { |
if ($ENV{'form.handgrade'} eq 'yes') { |
Line 555 KEYWORDS
|
Line 556 KEYWORDS
|
$result.='<table border="0"><tr>'; # display radio buttons in a nice table 10 across |
$result.='<table border="0"><tr>'; # display radio buttons in a nice table 10 across |
while ($ctr<=$wgt) { |
while ($ctr<=$wgt) { |
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'onclick="javascript:writeBox(this.form.GRADE_BOX'.$counter.'_'.$partid. |
'onclick="javascript:writeBox(this.form.GD_BOX'.$counter.'_'.$partid. |
',this.form.GRADE_SEL'.$counter.'_'.$partid.','.$ctr. |
',this.form.GD_SEL'.$counter.'_'.$partid.','.$ctr. |
',this.form.stores'.$counter.'_'.$partid.')" '. |
',this.form.stores'.$counter.'_'.$partid.')" '. |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
Line 565 KEYWORDS
|
Line 566 KEYWORDS
|
$result.='</tr></table>'; |
$result.='</tr></table>'; |
|
|
$result.='</td><td> <b>or</b> </td>'; |
$result.='</td><td> <b>or</b> </td>'; |
$result.='<td><input type="text" name="GRADE_BOX'.$counter.'_'.$partid.'"'. |
$result.='<td><input type="text" name="GD_BOX'.$counter.'_'.$partid.'"'. |
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter.'_'.$partid. |
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter.'_'.$partid. |
',this.form.GRADE_BOX'.$counter.'_'.$partid. |
',this.form.GD_BOX'.$counter.'_'.$partid. |
',this.form.GRADE_SEL'.$counter.'_'.$partid. |
',this.form.GD_SEL'.$counter.'_'.$partid. |
',this.form.stores'.$counter.'_'.$partid.')" /></td>'."\n"; |
',this.form.stores'.$counter.'_'.$partid.')" /></td>'."\n"; |
$result.='<td>/'.$wgt.' '.$wgtmsg.' </td><td>'; |
$result.='<td>/'.$wgt.' '.$wgtmsg.' </td><td>'; |
|
|
$result.='<select name="GRADE_SEL'.$counter.'_'.$partid.'" '. |
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
',this.form.GRADE_BOX'.$counter.'_'.$partid. |
',this.form.GD_BOX'.$counter.'_'.$partid. |
',this.form.GRADE_SEL'.$counter.'_'.$partid. |
',this.form.GD_SEL'.$counter.'_'.$partid. |
',this.form.stores'.$counter.'_'.$partid.')" />'."\n". |
',this.form.stores'.$counter.'_'.$partid.')" />'."\n". |
'<option selected="on"> </option>'. |
'<option selected="on"> </option>'. |
'<option>excused</option></select>'."  \n"; |
'<option>excused</option></select>'."  \n"; |
Line 760 sub processHandGrade {
|
Line 761 sub processHandGrade {
|
my $statusflg = ''; |
my $statusflg = ''; |
foreach (keys(%status)) { |
foreach (keys(%status)) { |
$statusflg = 1 if ($status{$_} ne 'nothing'); |
$statusflg = 1 if ($status{$_} ne 'nothing'); |
my ($foo,$partid,$foo) = split(/\./,$_); |
my ($foo,$partid,$foo1) = split(/\./,$_); |
$statusflg = '' if ($status{'resource.'.$partid.'.submitted_by'} ne ''); |
$statusflg = '' if ($status{'resource.'.$partid.'.submitted_by'} ne ''); |
} |
} |
next if ($statusflg eq ''); |
next if ($statusflg eq ''); |
Line 796 sub saveHandGrade {
|
Line 797 sub saveHandGrade {
|
# my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
# my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname); |
my %newrecord; |
my %newrecord; |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
if ($ENV{'form.GRADE_SEL'.$newflg.'_'.$_} eq 'excused') { |
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') { |
$newrecord{'resource.'.$_.'.solved'} = 'excused'; |
$newrecord{'resource.'.$_.'.solved'} = 'excused'; |
} else { |
} else { |
my $pts = ($ENV{'form.GRADE_BOX'.$newflg.'_'.$_} ne '' ? |
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
$ENV{'form.GRADE_BOX'.$newflg.'_'.$_} : $ENV{'form.RADVAL'.$newflg.'_'.$_}); |
$ENV{'form.GD_BOX'.$newflg.'_'.$_} : $ENV{'form.RADVAL'.$newflg.'_'.$_}); |
if ($pts eq '') { |
if ($pts eq '') { |
&userError($request,'No point was assigned for part id '.$_.' and for username '.$stuname.'.'); |
&userError($request,'No point was assigned for part id '.$_.' and for username '.$stuname.'.'); |
return 'error'; |
return 'error'; |
Line 857 sub gradingmenu {
|
Line 858 sub gradingmenu {
|
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
$resptype = $responsetype; |
$resptype = $responsetype; |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$result.='<tr><td><b>Part id: </b>'.$_.'</td>'. |
$result.='<tr><td><b>Part ID: </b>'.(split(/_/))[0].'</td>'. |
'<td><b>Type: </b>'.$responsetype.'</td>'. |
'<td><b>Type: </b>'.$responsetype.'</td>'. |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
} |
} |
Line 927 sub view_edit_entire_class_form {
|
Line 928 sub view_edit_entire_class_form {
|
foreach (sort (@$sections)) { |
foreach (sort (@$sections)) { |
$result.= '<option>'.$_.'</option>'."\n"; |
$result.= '<option>'.$_.'</option>'."\n"; |
} |
} |
$result.= '<option selected="on">all</select>'."<br />\n"; |
$result.='<option selected="on">all</select>'."<br />\n"; |
# $result.=' <b>Display students who has: </b>'. |
|
# '<input type="radio" name="submitonly" value="yes" checked> submitted'. |
|
# '<input type="radio" name="submitonly" value="all"> everybody <br /><br />'; |
|
$result.=' <input type="submit" name="submit" value="View/Grade" /></form>'."\n"; |
$result.=' <input type="submit" name="submit" value="View/Grade" /></form>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
Line 1058 sub viewgrades_js {
|
Line 1056 sub viewgrades_js {
|
textbox.value = point; |
textbox.value = point; |
} |
} |
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.counter"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var scorename = eval("document.classgrade.GRADE_"+user+ |
var scorename = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_awarded"); |
"_"+partid+"_aw"); |
var saveval = eval("document.classgrade.GRADE_"+user+ |
var saveval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_solved_save.value"); |
"_"+partid+"_sv_s.value"); |
var selname = eval("document.classgrade.GRADE_"+user+"_"+partid+"_solved"); |
var selname = eval("document.classgrade.GD_"+user+"_"+partid+"_sv"); |
if (saveval != "correct") { |
if (saveval != "correct") { |
scorename.value = point; |
scorename.value = point; |
selname[0].selected = true; |
if (selname[0].selected != true) { |
|
selname[0].selected = true; |
|
} |
} |
} |
} |
} |
var selval = eval("document.classgrade.SELVAL_"+partid); |
var selval = eval("document.classgrade.SELVAL_"+partid); |
Line 1075 sub viewgrades_js {
|
Line 1075 sub viewgrades_js {
|
|
|
function writeRadText(partid,weight) { |
function writeRadText(partid,weight) { |
var selval = eval("document.classgrade.SELVAL_"+partid); |
var selval = eval("document.classgrade.SELVAL_"+partid); |
|
var radioButton = eval("document.classgrade.RADVAL_"+partid); |
|
var textbox = eval("document.classgrade.TEXTVAL_"+partid); |
if (selval[1].selected) { |
if (selval[1].selected) { |
var radioButton = eval("document.classgrade.RADVAL_"+partid); |
|
for (var i=0; i<radioButton.length; i++) { |
for (var i=0; i<radioButton.length; i++) { |
radioButton[i].checked=false; |
radioButton[i].checked=false; |
|
|
} |
} |
var textbox = eval("document.classgrade.TEXTVAL_"+partid); |
|
textbox.value = ""; |
textbox.value = ""; |
|
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.counter"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var scorename = eval("document.classgrade.GRADE_"+user+ |
var scorename = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_awarded"); |
"_"+partid+"_aw"); |
var saveval = eval("document.classgrade.GRADE_"+user+ |
var saveval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_solved_save.value"); |
"_"+partid+"_sv_s.value"); |
var selname = eval("document.classgrade.GRADE_"+user+ |
var selname = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_solved"); |
"_"+partid+"_sv"); |
if (saveval != "correct") { |
if (saveval != "correct") { |
scorename.value = ""; |
scorename.value = ""; |
selname[1].selected = true; |
selname[1].selected = true; |
} |
} |
} |
} |
} |
} else { |
|
for (i=0;i<document.classgrade.total.value;i++) { |
|
var user = eval("document.classgrade.ctr"+i+".value"); |
|
var scorename = eval("document.classgrade.GD_"+user+ |
|
"_"+partid+"_aw"); |
|
var saveval = eval("document.classgrade.GD_"+user+ |
|
"_"+partid+"_sv_s.value"); |
|
var selname = eval("document.classgrade.GD_"+user+ |
|
"_"+partid+"_sv"); |
|
if (saveval != "correct") { |
|
scorename.value = eval("document.classgrade.GD_"+user+ |
|
"_"+partid+"_aw_s.value");; |
|
selname[0].selected = true; |
|
} |
|
} |
|
} |
} |
} |
|
|
function changeSelect(partid,user) { |
function changeSelect(partid,user) { |
var selval = eval("document.classgrade.GRADE_"+user+'_'+partid+"_solved"); |
var selval = eval("document.classgrade.GD_"+user+'_'+partid+"_sv"); |
selval[0].selected = true; |
selval[0].selected = true; |
} |
} |
|
|
function changeOneScore(partid,user) { |
function changeOneScore(partid,user) { |
var selval = eval("document.classgrade.GRADE_"+user+'_'+partid+"_solved"); |
var selval = eval("document.classgrade.GD_"+user+'_'+partid+"_sv"); |
if (selval[1].selected) { |
if (selval[1].selected) { |
var boxval = eval("document.classgrade.GRADE_"+user+'_'+partid+"_awarded"); |
var boxval = eval("document.classgrade.GD_"+user+'_'+partid+"_aw"); |
boxval.value = ""; |
boxval.value = ""; |
} |
} |
} |
} |
Line 1127 sub viewgrades_js {
|
Line 1142 sub viewgrades_js {
|
selval[0].selected = true; |
selval[0].selected = true; |
|
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.counter"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var resetscore = eval("document.classgrade.GRADE_"+user+ |
var resetscore = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_awarded"); |
"_"+partid+"_aw"); |
resetscore.value = eval("document.classgrade.GRADE_"+user+ |
resetscore.value = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_awarded_save.value"); |
"_"+partid+"_aw_s.value"); |
|
|
var saveselval = eval("document.classgrade.GRADE_"+user+ |
var saveselval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_solved_save.value"); |
"_"+partid+"_sv_s.value"); |
|
|
var selname = eval("document.classgrade.GRADE_"+user+"_"+partid+"_solved"); |
var selname = eval("document.classgrade.GD_"+user+"_"+partid+"_sv"); |
if (saveselval == "excused") { |
if (saveselval == "excused") { |
selname[1].selected = true; |
if (selname[1].selected == false) { selname[1].selected = true;} |
} else { |
} else { |
selname[0].selected = true; |
if (selname[0].selected == false) {selname[0].selected = true}; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
|
function submitForm() { |
|
document.classgrade.submit(); |
|
} |
|
|
</script> |
</script> |
VIEWJAVASCRIPT |
VIEWJAVASCRIPT |
Line 1156 sub viewgrades {
|
Line 1174 sub viewgrades {
|
&viewgrades_js($request); |
&viewgrades_js($request); |
|
|
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); |
$request->print ('<h2><font color="#339933">Manual Grading</font></h2>'); |
my $result='<h2><font color="#339933">Manual Grading</font></h2>'; |
|
|
my $result='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font>'."\n"; |
$result.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font>'."\n"; |
|
|
#view individual student submission form - called using Javascript viewOneStudent |
#view individual student submission form - called using Javascript viewOneStudent |
$result.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
$result.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
Line 1214 sub viewgrades {
|
Line 1232 sub viewgrades {
|
} |
} |
$result.='</table><input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='</table><input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='<input type="button" value="Reset" '. |
$result.='<input type="button" value="Reset" '. |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self>   '; |
'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self> '; |
|
# $result.='<input type="button" value="Submit Changes" '. |
|
# 'onClick="document.classgrade.submit();" TARGET=_self />'."\n"; |
$result.= '<input type="submit" name="submit" value="Submit Changes" />'."\n"; |
$result.= '<input type="submit" name="submit" value="Submit Changes" />'."\n"; |
|
|
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
Line 1242 sub viewgrades {
|
Line 1262 sub viewgrades {
|
my $ctr = 0; |
my $ctr = 0; |
foreach ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) { |
foreach ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) { |
(my $username = $_) = split(/:/); |
(my $username = $_) = split(/:/); |
$result.='<input type="hidden" name="counter'.$ctr.'" value="'.$username.'" />'."\n"; |
$result.='<input type="hidden" name="ctr'.$ctr.'" value="'.$username.'" />'."\n"; |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'}, |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'}, |
$_,$$fullname{$_},\@parts,\%weight); |
$_,$$fullname{$_},\@parts,\%weight); |
$ctr++; |
$ctr++; |
Line 1268 sub viewstudentgrade {
|
Line 1288 sub viewstudentgrade {
|
if ($type eq 'awarded') { |
if ($type eq 'awarded') { |
my $pts = $score eq '' ? '' : $score*$$weight{$part}; |
my $pts = $score eq '' ? '' : $score*$$weight{$part}; |
$result.='<input type="hidden" name="'. |
$result.='<input type="hidden" name="'. |
'GRADE_'.$username.'_'.$part.'_awarded_save" value="'.$pts.'" />'."\n"; |
'GD_'.$username.'_'.$part.'_aw_s" value="'.$pts.'" />'."\n"; |
$result.='<td align="middle"><input type="text" name="'. |
$result.='<td align="middle"><input type="text" name="'. |
'GRADE_'.$username.'_'.$part.'_awarded"'. |
'GD_'.$username.'_'.$part.'_aw"'. |
'onChange="javascript:changeSelect('.$part.',\''.$username.'\')" value="'. |
'onChange="javascript:changeSelect('.$part.',\''.$username.'\')" value="'. |
$pts.'" size="4" /></td>'."\n"; |
$pts.'" size="4" /></td>'."\n"; |
} elsif ($type eq 'solved') { |
} elsif ($type eq 'solved') { |
my ($status,$foo)=split(/_/,$score,2); |
my ($status,$foo)=split(/_/,$score,2); |
$status = 'nothing' if ($status eq ''); |
$status = 'nothing' if ($status eq ''); |
$result.='<input type="hidden" name="'. |
$result.='<input type="hidden" name="'. |
'GRADE_'.$username.'_'.$part.'_solved_save" value="'.$status.'" />'."\n"; |
'GD_'.$username.'_'.$part.'_sv_s" value="'.$status.'" />'."\n"; |
$result.='<td align="middle"><select name="'. |
$result.='<td align="middle"><select name="'. |
'GRADE_'.$username.'_'.$part.'_solved" '. |
'GD_'.$username.'_'.$part.'_sv" '. |
'onChange="javascript:changeOneScore('.$part.',\''.$username.'\')" >'."\n"; |
'onChange="javascript:changeOneScore('.$part.',\''.$username.'\')" >'."\n"; |
my $optsel = '<option selected="on"> </option><option>excused</option>'."\n"; |
my $optsel = '<option selected="on"> </option><option>excused</option>'."\n"; |
$optsel = '<option> </option><option selected="on">excused</option>'."\n" |
$optsel = '<option> </option><option selected="on">excused</option>'."\n" |
Line 1297 sub editgrades {
|
Line 1317 sub editgrades {
|
my ($request) = @_; |
my ($request) = @_; |
|
|
my $symb=$ENV{'form.symb'}; |
my $symb=$ENV{'form.symb'}; |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$symb:$ENV{'form.url'}"); return ''; } |
my $url =$ENV{'form.url'}; |
my $url=$ENV{'form.url'}; |
my $result='<h2><font color="#339933">Current Grade Status</font></h2>'; |
|
$result.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br />'."\n"; |
|
$result.='<font size=+1><b>Section: </b>'.$ENV{'form.section'}.'</font>'."\n"; |
|
$result.= &show_grading_menu_form ($symb,$url); |
|
$result.= '<table border="0"><tr><td bgcolor="#777777">'."\n"; |
|
$result.= '<table border="0"><tr bgcolor="#deffff">'. |
|
'<td rowspan=2><b>Username</b></td><td rowspan=2><b>Fullname</b></td>'."\n"; |
|
|
|
my %scoreptr = ( |
|
'correct' =>'correct_by_override', |
|
'incorrect'=>'incorrect_by_override', |
|
'excused' =>'excused', |
|
'ungraded' =>'ungraded_attempted', |
|
'nothing' => '', |
|
); |
|
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
|
|
my $result.='<form action="/adm/grades" method="post">'."\n". |
my (@partid); |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
my %weight = (); |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
my ($i,$ctr) = (0,0); |
'<input type="hidden" name="command" value="viewgrades" />'."\n". |
while ($ctr < $ENV{'form.totalparts'}) { |
'<input type="submit" name="submit" value="See Grades" /> <br />'."\n"; |
my $partid = $ENV{'form.partid_'.$ctr}; |
|
push @partid,$partid; |
my (@parts) = &getpartlist($url); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
my ($classlist) = &getclasslist($ENV{'form.section'},'0'); |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
foreach my $student ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) { |
$ctr++; |
$result.=&setstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts); |
$result .= '<td colspan = 2 align="center"><b>Part ID '.$partid. |
|
'</b> (Weight = '.$weight{$partid}.')</td>'; |
} |
} |
|
$result .= '</tr><tr bgcolor="#deffff">'; |
|
foreach (@partid) { |
|
$result .= '<td align="center"> <b>Old Score</b> </td>'. |
|
'<td align="center"> <b>New Score</b> </td>'; |
|
} |
|
$result .= '</tr>'."\n"; |
|
|
|
for ($i=0; $i<$ENV{'form.total'}; $i++) { |
|
my $user = $ENV{'form.ctr'.$i}; |
|
my %newrecord; |
|
my $updateflag = 0; |
|
my @userdom = grep /^$user:/,keys %$classlist; |
|
my ($foo,$udom) = split(/:/,$userdom[0]); |
|
|
|
$result .= '<tr bgcolor="#ffffde"><td>'.$user.' </td><td>'. |
|
$$fullname{$userdom[0]}.' </td>'; |
|
|
|
foreach (@partid) { |
|
my $old_aw = $ENV{'form.GD_'.$user.'_'.$_.'_aw_s'}; |
|
my $old_part = $old_aw eq '' ? '' : $old_aw/$weight{$_}; |
|
my $old_score = $scoreptr{$ENV{'form.GD_'.$user.'_'.$_.'_sv_s'}}; |
|
|
|
my $awarded = $ENV{'form.GD_'.$user.'_'.$_.'_aw'}; |
|
my $partial = $awarded eq '' ? '' : $awarded/$weight{$_}; |
|
my $score; |
|
if ($partial eq '') { |
|
$score = $scoreptr{$ENV{'form.GD_'.$user.'_'.$_.'_sv_s'}}; |
|
} elsif ($partial > 0) { |
|
$score = 'correct_by_override'; |
|
} elsif ($partial == 0) { |
|
$score = 'incorrect_by_override'; |
|
} |
|
$score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_sv'} eq 'excused') && |
|
($score ne 'excused')); |
|
$result .= '<td align="center">'.$old_aw.' </td>'. |
|
'<td align="center">'.$awarded. |
|
($score eq 'excused' ? $score : '').' </td>'; |
|
|
|
next if ($old_part eq $partial && $old_score eq $score); |
|
|
|
$updateflag = 1; |
|
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
|
$newrecord{'resource.'.$_.'.solved'} = $score; |
|
|
$result.='<input type="submit" name="submit" value="See Grades" /></table></form>'; |
} |
|
$result .= '</tr>'."\n"; |
|
if ($updateflag) { |
|
$newrecord{'resource.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}"; |
|
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'}, |
|
$udom,$user); |
|
} |
|
} |
|
$result .= '</table></td></tr></table>'."\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 1329 sub setstudentgrade {
|
Line 1416 sub setstudentgrade {
|
foreach my $part (@parts) { |
foreach my $part (@parts) { |
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.GD.$student.$part.$type"}; |
if ($type eq 'solved') { |
if ($type eq 'solved') { |
my $update=0; |
my $update=0; |
if ($newscore eq 'nothing' ) { |
if ($newscore eq 'nothing' ) { |