version 1.69, 2003/02/27 22:39:11
|
version 1.70, 2003/02/28 21:06:28
|
Line 1080 KEYWORDS
|
Line 1080 KEYWORDS
|
$seen{$partid}++; |
$seen{$partid}++; |
next if ($$handgrade{$_} =~ /:no$/); |
next if ($$handgrade{$_} =~ /:no$/); |
push @partlist,$partid; |
push @partlist,$partid; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
|
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
|
'<font color="red">problem weight assigned by computer</font>'); |
|
$wgt = ($wgt > 0 ? $wgt : '1'); |
|
my $score = ($record{'resource.'.$partid.'.awarded'} eq '' ? |
|
'' : $record{'resource.'.$partid.'.awarded'}*$wgt); |
|
$result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'; |
|
$result.='<table border="0"><tr><td><b>Part </b>'.$partid.' <b>Points: </b></td><td>'; |
|
|
|
my $ctr = 0; |
$result=&gradeBox($symb,$uname,$udom,$counter,$partid,\%record); |
$result.='<table border="0"><tr>'; # display radio buttons in a nice table 10 across |
|
while ($ctr<=$wgt) { |
|
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
|
'onclick="javascript:writeBox(this.form.GD_BOX'.$counter.'_'.$partid. |
|
',this.form.GD_SEL'.$counter.'_'.$partid.','.$ctr. |
|
',this.form.stores'.$counter.'_'.$partid.')" '. |
|
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
|
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
|
$ctr++; |
|
} |
|
$result.='</tr></table>'; |
|
|
|
$result.='</td><td> <b>or</b> </td>'; |
|
$result.='<td><input type="text" name="GD_BOX'.$counter.'_'.$partid.'"'. |
|
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
|
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter.'_'.$partid. |
|
',this.form.GD_BOX'.$counter.'_'.$partid. |
|
',this.form.GD_SEL'.$counter.'_'.$partid. |
|
',this.form.stores'.$counter.'_'.$partid. |
|
','.$wgt.')" /></td>'."\n"; |
|
$result.='<td>/'.$wgt.' '.$wgtmsg.' </td><td>'; |
|
|
|
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
|
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
|
',this.form.GD_BOX'.$counter.'_'.$partid. |
|
',this.form.GD_SEL'.$counter.'_'.$partid. |
|
',this.form.stores'.$counter.'_'.$partid.')" >'."\n"; |
|
if ($record{'resource.'.$partid.'.solved'} eq 'excused') { |
|
$result.='<option> </option>'. |
|
'<option selected="on">excused</option></select>'; |
|
} else { |
|
$result.='<option selected="on"> </option>'. |
|
'<option>excused</option></select>'; |
|
} |
|
$result.="  \n"; |
|
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="0" />'; |
|
$result.='</td></tr></table>'."\n"; |
|
$request->print($result); |
$request->print($result); |
} |
} |
$result='<input type="hidden" name="partlist'.$counter. |
$result='<input type="hidden" name="partlist'.$counter. |
Line 2346 sub pickStudentPage {
|
Line 2302 sub pickStudentPage {
|
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
|
|
function checkPickOne(formname) { |
function checkPickOne(formname) { |
var user = radioSelection(formname.pickOne); |
var user = radioSelection(formname.student); |
if (user == null) { |
if (user == null) { |
alert("Please select the student you wish to grade."); |
alert("Please select the student you wish to grade."); |
return; |
return; |
} |
} |
|
var ptr = pullDownSelection(formname.selectpage); |
|
formname.page.value = formname.eval("page"+ptr).value; |
|
formname.title.value = formname.eval("title"+ptr).value; |
formname.submit(); |
formname.submit(); |
} |
} |
|
|
Line 2364 function radioSelection(radioButton) {
|
Line 2323 function radioSelection(radioButton) {
|
} |
} |
return selection; |
return selection; |
} |
} |
|
|
|
function pullDownSelection(selectOne) { |
|
var selection=null; |
|
for (var i=0; i<selectOne.length; i++) { |
|
if (selectOne[i].selected) { |
|
selection=selectOne[i].value; |
|
return selection; |
|
} |
|
} |
|
} |
</script> |
</script> |
LISTJAVASCRIPT |
LISTJAVASCRIPT |
|
|
Line 2379 LISTJAVASCRIPT
|
Line 2348 LISTJAVASCRIPT
|
my $curtitle = &Apache::lonnet::metadata($pagepath.$pagename,'title'); |
my $curtitle = &Apache::lonnet::metadata($pagepath.$pagename,'title'); |
|
|
$result.='<form action="/adm/grades" method="post" name="displayPage">'."<br>\n"; |
$result.='<form action="/adm/grades" method="post" name="displayPage">'."<br>\n"; |
$result.=' <b>Problems from:</b> <select name="page">'."\n"; |
$result.=' <b>Problems from:</b> <select name="selectpage">'."\n"; |
my ($titles,$symbx) = &getSymbMap(); |
my ($titles,$symbx) = &getSymbMap(); |
# shift @$titles; # skip the top level sequence |
# shift @$titles; # skip the top level sequence |
|
my $ctr=0; |
foreach (@$titles) { |
foreach (@$titles) { |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
my $check_select = ($showtitle eq $curtitle ? 'selected="on"' : ''); |
$result.='<option value="'.$ctr.'" '. |
$result.='<option value="'.$_.'" '.$check_select.'>'.$showtitle.'</option>'."\n"; |
($showtitle eq $curtitle ? 'selected="on"' : '').'>'.$showtitle.'</option>'."\n"; |
|
$ctr++; |
} |
} |
$result.= '</select>'."<br>\n"; |
$result.= '</select>'."<br>\n"; |
|
$ctr=0; |
|
foreach (@$titles) { |
|
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
|
$result.='<input type="hidden" name="page'.$ctr.'" value="'.$$symbx{$_}.'" />'."\n"; |
|
$result.='<input type="hidden" name="title'.$ctr.'" value="'.$showtitle.'" />'."\n"; |
|
$ctr++; |
|
} |
|
$result.='<input type="hidden" name="page" />'."\n"; |
|
$result.='<input type="hidden" name="title" />'."\n"; |
|
|
# $result.=' <b>View Problems: </b><input type="radio" name="vProb" value="no" checked /> no '."\n". |
# $result.=' <b>View Problems: </b><input type="radio" name="vProb" value="no" checked /> no '."\n". |
# '<input type="radio" name="vProb" value="yes" /> yes '."<br>\n"; |
# '<input type="radio" name="vProb" value="yes" /> yes '."<br>\n"; |
Line 2413 LISTJAVASCRIPT
|
Line 2393 LISTJAVASCRIPT
|
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
$studentTable.=($ptr%4 == 1 ? '<tr bgcolor="#ffffe6"><td>' : '</td><td>'); |
$studentTable.=($ptr%4 == 1 ? '<tr bgcolor="#ffffe6"><td>' : '</td><td>'); |
$studentTable.='<input type="radio" name="pickOne" value="'.$student.'" /> '.$$fullname{$student}. |
$studentTable.='<input type="radio" name="student" value="'.$student.'" /> '.$$fullname{$student}. |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font>'."\n"; |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font>'."\n"; |
$studentTable.=($ptr%4 == 0 ? '</td></tr>' : ''); |
$studentTable.=($ptr%4 == 0 ? '</td></tr>' : ''); |
$ptr++; |
$ptr++; |
Line 2422 LISTJAVASCRIPT
|
Line 2402 LISTJAVASCRIPT
|
$studentTable.='</td><td> </td><td> ' if ($ptr%4 == 3); |
$studentTable.='</td><td> </td><td> ' if ($ptr%4 == 3); |
$studentTable.='</td><td> ' if ($ptr%4 == 0); |
$studentTable.='</td><td> ' if ($ptr%4 == 0); |
$studentTable.='</td></tr></table></td></tr></table>'."\n"; |
$studentTable.='</td></tr></table></td></tr></table>'."\n"; |
$studentTable.='<br /> <input type="button" onClick="javascript:checkPickOne(this.form);" value="Submit" /></form>'."\n"; |
$studentTable.='<br /> <input type="button" '. |
|
'onClick="javascript:checkPickOne(this.form);"value="Submit" /></form>'."\n"; |
|
|
$studentTable.=&show_grading_menu_form($symb,$url); |
$studentTable.=&show_grading_menu_form($symb,$url); |
$request->print($studentTable); |
$request->print($studentTable); |
Line 2473 sub displayPage {
|
Line 2454 sub displayPage {
|
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $pageTitle = $ENV{'form.page'}; |
my $pageTitle = $ENV{'form.page'}; |
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
my ($uname,$udom) = split(/:/,$ENV{'form.pickOne'}); |
my ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
my ($idx,$showtitle) = ($pageTitle =~ /(\d+)\.(.*)/); |
my ($idx,$showtitle) = ($pageTitle =~ /(\d+)\.(.*)/); |
|
|
my $result='<h3><font color="#339933"> '.$showtitle.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
$result.='<h3> Student: '.$$fullname{$ENV{'form.pickOne'}}. |
$result.='<h3> Student: '.$$fullname{$ENV{'form.student'}}. |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font></h3>'."\n"; |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font></h3>'."\n"; |
|
|
my ($pg_titles,$pg_symbx) = &getSymbMap(); |
|
|
|
my $navmap = Apache::lonnavmaps::navmap-> new( |
my $navmap = Apache::lonnavmaps::navmap-> new( |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
|
my ($mapUrl, $id, $resUrl) = split(/___/, $ENV{'form.page'}); |
my ($mapUrl, $id, $resUrl) = split(/___/, $$pg_symbx{$ENV{'form.page'}}); |
|
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
|
|
my $iterator = $navmap->getIterator($map->map_start(), |
my $iterator = $navmap->getIterator($map->map_start(), |
Line 2509 sub displayPage {
|
Line 2487 sub displayPage {
|
my $title = $curRes->compTitle(); |
my $title = $curRes->compTitle(); |
push @titles,$minder.'.'.$title; # minder, just in case two titles are identical |
push @titles,$minder.'.'.$title; # minder, just in case two titles are identical |
if (scalar(@{$parts}) > 1) { shift @{$parts}; } |
if (scalar(@{$parts}) > 1) { shift @{$parts}; } |
for my $part (@$parts) { |
$parts{$minder.'.'.$title} = join '::',@{$parts}; |
$result.='title='.$title.'part='.$part.':<br>'; |
|
} |
|
$parts{$minder.'.'.$title} = join '::',@$parts; |
|
|
|
$symbx{$minder.'.'.$title} = $curRes->symb(); |
$symbx{$minder.'.'.$title} = $curRes->symb(); |
$minder++; |
$minder++; |
|
|
Line 2522 sub displayPage {
|
Line 2496 sub displayPage {
|
$ctr++; |
$ctr++; |
} |
} |
|
|
|
|
$navmap->init(); |
$navmap->init(); |
$request->print($result); |
$request->print($result); |
|
&sub_page_js($request); |
|
|
my $studentTable.= |
my $studentTable='<form action="/adm/grades" method="post" name="gradePage">'."\n". |
|
'<input type="hidden" name="command" value="gradePage" />'."\n". |
|
'<input type="hidden" name="student" value="'.$ENV{'form.student'}.'" />'."\n". |
|
'<input type="hidden" name="page" value="'.$pageTitle.'" />'."\n". |
|
'<input type="hidden" name="title" value="'.$ENV{'form.title'}.'" />'."\n"; |
|
|
|
$studentTable.= |
'<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<td><b> No </b></td>'. |
'<td align="center"><b> No </b></td>'. |
'<td><b> Title</b></td>'. |
'<td><b> Title</b></td>'. |
'<td><b> Answer</b></td>'. |
'<td><b> Answer</b></td>'. |
'<td><b> Grade</b></td></tr>'; |
'<td><b> Grade</b></td></tr>'; |
my $question=1; |
my $question=1; |
foreach (@titles) { |
foreach (@titles) { |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
my ($minder,$showtitle) = ($_ =~ /(\d+)\.(.*)/); |
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question.'</td>'; |
my @parts = split(/::/,$parts{$_}); |
|
$studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question. |
|
(scalar(@parts) == 1 ? '' : '<br>('.scalar(@parts).' parts)').'</td>'; |
$studentTable.='<td valign="top"> '.$showtitle.' </td>'; |
$studentTable.='<td valign="top"> '.$showtitle.' </td>'; |
$studentTable.='<td> '. |
$studentTable.='<td> '. |
&Apache::loncommon::get_student_answers($symbx{$_},$uname,$udom,$ENV{'request.course.id'}).'</td>'; |
&Apache::loncommon::get_student_answers($symbx{$_},$uname,$udom,$ENV{'request.course.id'}).'</td>'; |
|
|
my (undef,undef,$requesturl)=split(/___/,$symbx{$_}); |
my %record = &Apache::lonnet::restore($symbx{$_},$ENV{'request.course.id'},$udom,$uname); |
$requesturl=&Apache::lonnet::clutter($requesturl); |
|
my $subresult=&Apache::lonnet::ssi($requesturl, |
|
('grade_target' => 'analyze'), |
|
('grade_domain' => $udom), |
|
('grade_user' => $uname), |
|
('grade_symb' => $symbx{$_}), |
|
('grade_courseid' => $ENV{'request.course.id'})); |
|
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
|
my %analyze=&Apache::lonnet::str2hash($subresult); |
|
|
|
$studentTable.='<td> '; |
$studentTable.='<td> '; |
while (my($key,$value) = each (%analyze)){ |
foreach my $partid (@parts) { |
$studentTable.='key='.$key.'->value='.$value.'<br>'; |
$studentTable.=&gradeBox($symbx{$_},$uname,$udom,$question,$partid,\%record); |
|
$question++; |
} |
} |
$studentTable.='</td></tr>'; |
$studentTable.='</td></tr>'; |
$question++; |
|
|
|
} |
} |
|
|
$studentTable.='</table></td></tr></table>'; |
$studentTable.='</table></td></tr></table>'; |
# $result.='<form action="/adm/grades" method="post" name="displayPage">'."<br>\n"; |
$studentTable.='</form>'; |
# $result.='</form>'."\n"; |
|
|
|
$request->print($studentTable); |
$request->print($studentTable); |
|
|
|
|
return ''; |
return ''; |
} |
} |
|
|
|
sub gradeBox { |
|
my ($symb,$uname,$udom,$counter,$partid,$record) = @_; |
|
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
|
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : |
|
'<font color="red">problem weight assigned by computer</font>'); |
|
$wgt = ($wgt > 0 ? $wgt : '1'); |
|
my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? |
|
'' : $$record{'resource.'.$partid.'.awarded'}*$wgt); |
|
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'; |
|
$result.='<table border="0"><tr><td><b>Part </b>'.$partid.' <b>Points: </b></td><td>'; |
|
|
|
my $ctr = 0; |
|
$result.='<table border="0"><tr>'; # display radio buttons in a nice table 10 across |
|
while ($ctr<=$wgt) { |
|
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
|
'onclick="javascript:writeBox(this.form.GD_BOX'.$counter.'_'.$partid. |
|
',this.form.GD_SEL'.$counter.'_'.$partid.','.$ctr. |
|
',this.form.stores'.$counter.'_'.$partid.')" '. |
|
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
|
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
|
$ctr++; |
|
} |
|
$result.='</tr></table>'; |
|
$result.='</td><td> <b>or</b> </td>'; |
|
$result.='<td><input type="text" name="GD_BOX'.$counter.'_'.$partid.'"'. |
|
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
|
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter.'_'.$partid. |
|
',this.form.GD_BOX'.$counter.'_'.$partid. |
|
',this.form.GD_SEL'.$counter.'_'.$partid. |
|
',this.form.stores'.$counter.'_'.$partid. |
|
','.$wgt.')" /></td>'."\n"; |
|
$result.='<td>/'.$wgt.' '.$wgtmsg.' </td><td>'; |
|
|
|
$result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. |
|
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
|
',this.form.GD_BOX'.$counter.'_'.$partid. |
|
',this.form.GD_SEL'.$counter.'_'.$partid. |
|
',this.form.stores'.$counter.'_'.$partid.')" >'."\n"; |
|
if ($$record{'resource.'.$partid.'.solved'} eq 'excused') { |
|
$result.='<option> </option>'. |
|
'<option selected="on">excused</option></select>'; |
|
} else { |
|
$result.='<option selected="on"> </option>'. |
|
'<option>excused</option></select>'; |
|
} |
|
$result.="  \n"; |
|
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="0" />'; |
|
$result.='</td></tr></table>'."\n"; |
|
return $result; |
|
} |
|
|
#--- Form to input a receipt number --- |
#--- Form to input a receipt number --- |
sub verifyReceipt_form { |
sub verifyReceipt_form { |
my ($symb,$url) = @_; |
my ($symb,$url) = @_; |