version 1.38, 2002/07/10 21:08:38
|
version 1.39, 2002/07/18 21:27:57
|
Line 42 use Apache::loncommon;
|
Line 42 use Apache::loncommon;
|
use Apache::lonhomework; |
use Apache::lonhomework; |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Time::HiRes qw( gettimeofday tv_interval ); |
#use Time::HiRes qw( gettimeofday tv_interval ); |
|
|
sub moreinfo { |
sub moreinfo { |
my ($request,$reason) = @_; |
my ($request,$reason) = @_; |
Line 96 sub verifyreceipt {
|
Line 96 sub verifyreceipt {
|
} |
} |
|
|
sub student_gradeStatus { |
sub student_gradeStatus { |
my ($url,$udom,$uname) = @_; |
my ($url,$udom,$uname,$partlist) = @_; |
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); |
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); |
my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
foreach my $part (&getpartlist($url)) { |
my %partstatus = (); |
my ($temp,$part,$type)=split(/_/,$part); |
foreach (@$partlist) { |
if ($type eq 'solved') { |
my ($status,$foo)=split(/_/,$record{"resource.$_.solved"},2); |
my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); |
|
$status = 'partial' if ($foo =~ /^partially/); |
|
$status = 'nothing' if ($status eq ''); |
$status = 'nothing' if ($status eq ''); |
return $type,$status; |
$partstatus{$_} = $status; |
} |
} |
} |
return %partstatus; |
return ''; |
|
} |
} |
|
|
sub get_fullname { |
sub get_fullname { |
my ($sname,$sdom) = @_; |
my ($uname,$udom) = @_; |
my %name=&Apache::lonnet::get('environment', ['lastname','generation', |
my %name=&Apache::lonnet::get('environment', ['lastname','generation', |
'firstname','middlename'], |
'firstname','middlename'], |
$sdom,$sname); |
$udom,$uname); |
my $fullname; |
my $fullname; |
my ($tmp) = keys(%name); |
my ($tmp) = keys(%name); |
if ($tmp !~ /^(con_lost|error|no_such_host)/i) { |
if ($tmp !~ /^(con_lost|error|no_such_host)/i) { |
Line 126 sub get_fullname {
|
Line 123 sub get_fullname {
|
return $fullname; |
return $fullname; |
} |
} |
|
|
|
sub response_type { |
|
my ($url) = shift; |
|
my $allkeys = &Apache::lonnet::metadata($url,'keys'); |
|
my %seen = (); |
|
my (@partlist,%handgrade); |
|
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
|
if (/^\w+response_\d{1,2}.*/) { |
|
my ($responsetype,$part) = split(/_/,$_,2); |
|
my ($partid,$respid) = split(/_/,$part); |
|
$handgrade{$part} = $responsetype.':'.($allkeys =~ /parameter_$part\_handgrade/ ? 'yes' : 'no'); |
|
next if ($seen{$partid} > 0); |
|
$seen{$partid}++; |
|
push @partlist,$partid; |
|
} |
|
} |
|
return \@partlist,\%handgrade; |
|
} |
|
|
|
|
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 133 sub listStudents {
|
Line 149 sub listStudents {
|
my $getsec =$ENV{'form.section'}; |
my $getsec =$ENV{'form.section'}; |
my $submitonly=$ENV{'form.submitonly'}; |
my $submitonly=$ENV{'form.submitonly'}; |
|
|
|
my $result='<h2><font color="#339933"> View Submissions for a Student or a Group of Students</font></h2>'; |
|
$result.='<table border="0">'; |
|
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font></td></tr>'; |
|
my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); |
|
for (sort keys(%$handgrade)) { |
|
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
|
$result.='<tr><td><b>Part id: </b>'.$_.'</td>'. |
|
'<td><b>Type: </b>'.$responsetype.'</td>'. |
|
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
|
} |
|
$result.='</table>'; |
|
$request->print($result); |
|
|
$request->print(<<ENDTABLEST); |
$request->print(<<ENDTABLEST); |
<h2><font color="#339933"> View Submissions for a Student or a Group of Students</font></h2> |
<form action="/adm/grades" method="post"> |
<font size=+1><b>Resource:</b> $ENV{'form.url'}<br /><br /> |
|
<form action="/adm/grades" method="post"> <b>View Options</b></font><br /> |
|
<b>View Problem: </b><input type="radio" name="vProb" value="no" checked> no |
<b>View Problem: </b><input type="radio" name="vProb" value="no" checked> no |
<input type="radio" name="vProb" value="yes"> yes <br /> |
<input type="radio" name="vProb" value="yes"> yes <br /> |
<b>Submissions: </b> |
<b>Submissions: </b> |
<input type="radio" name="lastSub" value="lastonly" checked> last sub only |
<input type="radio" name="lastSub" value="lastonly" checked /> last sub only |
<input type="radio" name="lastSub" value="last"> last sub & parts info |
<input type="radio" name="lastSub" value="last" /> last sub & parts info |
<input type="radio" name="lastSub" value="all"> all details |
<input type="radio" name="lastSub" value="all" /> all details |
<input type="hidden" name="section" value="$getsec"> |
<input type="hidden" name="section" value="$getsec" /> |
<input type="hidden" name="submitonly" value="$submitonly"> |
<input type="hidden" name="submitonly" value="$submitonly" /> |
<input type="hidden" name="response" value="$ENV{'form.response'}"> |
<input type="hidden" name="response" value="$ENV{'form.response'}" /> |
<input type="hidden" name="handgrade" value="$ENV{'form.handgrade'}"> |
<input type="hidden" name="handgrade" value="$ENV{'form.handgrade'}" /> |
<table border="0"><tr><td bgcolor="#777777"> |
<input type="submit" name="submit" value="View/Grade" /> |
<table border="0"><tr bgcolor="#e6ffff"> |
|
<td><b> Select </b></td><td><b> Username </b></td> |
|
<td><b> Fullname </b></td><td><b> Domain </b></td> |
|
<td><b> Grade Status </b></td></tr> |
|
ENDTABLEST |
ENDTABLEST |
if ($ENV{'form.url'}) { |
if ($ENV{'form.url'}) { |
$request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n"); |
$request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n"); |
Line 161 ENDTABLEST
|
Line 184 ENDTABLEST
|
} |
} |
$request->print('<input type="hidden" name="command" value="processGroup" />'."\n"); |
$request->print('<input type="hidden" name="command" value="processGroup" />'."\n"); |
|
|
my $t0=&Time::HiRes::time(); |
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0'); |
|
|
my ($classlist) = &getclasslist($getsec,'0'); |
$result='<table border="0"><tr><td bgcolor="#777777">'. |
my $t1=&Time::HiRes::time(); |
'<table border="0"><tr bgcolor="#e6ffff">'. |
print "getclasslist=",$t1-$t0,"<br />"; |
'<td><b> Select </b></td><td><b> Username </b></td>'. |
|
'<td><b> Fullname </b></td><td><b> Domain </b></td>'; |
foreach my $student ( sort(@{ $$classlist{$getsec} }) ) { |
foreach (sort(@$partlist)) { |
my ($sname,$sdom) = split(/:/,$student); |
$result.='<td><b> Part ID '.$_.' Status </b></td>'; |
my ($type,$status) = &student_gradeStatus($ENV{'form.url'},$cdom,$sname); |
} |
next if ($status eq 'nothing' && $submitonly eq 'yes'); |
$request->print($result.'</tr>'."\n"); |
|
|
|
foreach my $student (sort(@{ $$classlist{$getsec} }) ) { |
|
my ($uname,$udom) = split(/:/,$student); |
|
my (%status) = &student_gradeStatus($ENV{'form.url'},$udom,$uname,$partlist); |
|
my $statusflg = ''; |
|
foreach (keys(%status)) { |
|
$statusflg = 1 if ($status{$_} ne 'nothing'); |
|
} |
|
next if ($statusflg eq '' && $submitonly eq 'yes'); |
|
|
my $fullname = &get_fullname($sname,$sdom); |
|
if ( $Apache::grades::viewgrades eq 'F' ) { |
if ( $Apache::grades::viewgrades eq 'F' ) { |
$request->print("\n".'<tr bgcolor="#ffffe6">'. |
$result='<tr bgcolor="#ffffe6">'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
$student.':'.$fullname.'"></td>'."\n". |
$student.':'.$$fullname{$student}.'"></td>'."\n". |
'<td> '.$sname.' </td>'."\n". |
'<td> '.$uname.' </td>'."\n". |
'<td> '.$fullname.' </td>'."\n". |
'<td> '.$$fullname{$student}.' </td>'."\n". |
'<td align="middle"> '.$sdom.' </td>'."\n"); |
'<td align="middle"> '.$udom.' </td>'."\n"; |
$request->print('<td align="middle"> '.$status.' </td>'."\n"); |
|
|
|
$request->print('</tr>'); |
foreach (sort keys(%status)) { |
|
$result.='<td align="middle"> '.$status{$_}.' </td>'."\n"; |
|
} |
|
$request->print($result.'</tr>'."\n"); |
} |
} |
} |
} |
my $t2=&Time::HiRes::time(); |
|
print "processclasslist=",$t2-$t1,"<br />"; |
|
$request->print('</table></td></tr></table>'); |
$request->print('</table></td></tr></table>'); |
$request->print('<input type="submit" name="submit" value="View/Grade" /><form />'); |
$request->print('<input type="submit" name="submit" value="View/Grade" /><form />'); |
} |
} |
Line 202 sub processGroup {
|
Line 233 sub processGroup {
|
return; |
return; |
} |
} |
foreach (@stuchecked) { |
foreach (@stuchecked) { |
my ($sname,$sdom,$fullname) = split(/:/); |
my ($uname,$udom,$fullname) = split(/:/); |
$ENV{'form.student'} = $sname; |
$ENV{'form.student'} = $uname; |
$ENV{'form.fullname'} = $fullname; |
$ENV{'form.fullname'} = $fullname; |
&submission($request,$ctr,$total); |
&submission($request,$ctr,$total); |
$ctr++; |
$ctr++; |
} |
} |
return 'The End'; |
return ''; |
} |
} |
|
|
sub userError { |
sub userError { |
Line 237 sub finduser {
|
Line 268 sub finduser {
|
} |
} |
|
|
sub getclasslist { |
sub getclasslist { |
my ($getsec,$hideexpired) = @_; |
my ($getsec,$hideexpired) = @_; |
my ($coursedomain,$coursenum) = split(/_/,$ENV{'request.course.id'}); |
my %classlist=&Apache::lonnet::dump('classlist', |
my %classlist=&Apache::lonnet::dump('classlist',$coursedomain,$coursenum); |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
my $now = time; |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
my (@holdsec,@sections); |
my $now = time; |
foreach my $student (keys(%classlist)) { |
my (@holdsec,@sections,%allids,%stusec,%fullname); |
my ($end,$start)=split(/:/,$classlist{$student}); |
foreach (keys(%classlist)) { |
# still a student? |
my ($end,$start,$id,$section,$fullname)=split(/:/,$classlist{$_}); |
if (($hideexpired) && ($end) && ($end < $now)) { |
# still a student? |
next; |
if (($hideexpired) && ($end) && ($end < $now)) { |
} |
next; |
my ($unam,$udom) = split(/:/,$student,2); |
} |
my $section = &Apache::lonnet::usection($udom,$unam,$ENV{'request.course.id'}); |
$section = ($section ne '' ? $section : 'no'); |
$section = ($section ne '-1' ? $section : 'no'); |
push @holdsec,$section; |
push @holdsec,$section; |
if ($getsec eq 'all' || $getsec eq $section) { |
push (@{ $classlist{$getsec} }, $student) if ($getsec eq 'all' || $getsec eq $section); |
push (@{ $classlist{$getsec} }, $_); |
} |
$allids{$_}=$id; |
my %seen = (); |
$stusec{$_}=$section; |
foreach my $item (@holdsec) { |
$fullname{$_}=$fullname; |
push (@sections, $item) unless $seen{$item}++; |
} |
} |
} |
return (\%classlist,\@sections); |
my %seen = (); |
|
foreach my $item (@holdsec) { |
|
push (@sections, $item) unless $seen{$item}++; |
|
} |
|
return (\%classlist,\@sections,\%allids,\%stusec,\%fullname); |
} |
} |
|
|
sub getpartlist { |
sub getpartlist { |
Line 275 sub getpartlist {
|
Line 310 sub getpartlist {
|
|
|
sub viewstudentgrade { |
sub viewstudentgrade { |
my ($url,$symb,$courseid,$student,@parts) = @_; |
my ($url,$symb,$courseid,$student,@parts) = @_; |
my $result =''; |
|
my $cellclr = '"#ffffdd"'; |
my $cellclr = '"#ffffdd"'; |
my ($username,$domain) = split(/:/,$student); |
my ($username,$domain) = split(/:/,$student); |
|
|
my $fullname = &get_fullname($username,$domain); |
my $fullname = &get_fullname($username,$domain); |
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$username); |
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$username); |
|
|
$result.="<tr bgcolor=$cellclr><td>$username</td><td>$fullname</td><td align=\"middle\">$domain</td>\n"; |
my $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); |
my $score=$record{"resource.$part.$type"}; |
my $score=$record{"resource.$part.$type"}; |
Line 293 sub viewstudentgrade {
|
Line 327 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>partial</option><option>nothing</option>'."\n"; |
'<option>ungraded</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 333 sub setstudentgrade {
|
Line 367 sub setstudentgrade {
|
if ($newscore eq 'incorrect') { $newscore = 'incorrect_by_override'; } |
if ($newscore eq 'incorrect') { $newscore = 'incorrect_by_override'; } |
if ($newscore eq 'excused') { $newscore = 'excused'; } |
if ($newscore eq 'excused') { $newscore = 'excused'; } |
if ($newscore eq 'ungraded') { $newscore = 'ungraded_attempted'; } |
if ($newscore eq 'ungraded') { $newscore = 'ungraded_attempted'; } |
if ($newscore eq 'partial') { $newscore = 'correct_partially_by_override'; } |
# if ($newscore eq 'partial') { $newscore = 'correct_partially_by_override'; } |
} else { |
} else { |
#$result.="$stuname:$part:$type:unchanged $oldscore to $newscore:<br />\n"; |
#$result.="$stuname:$part:$type:unchanged $oldscore to $newscore:<br />\n"; |
} |
} |
Line 392 sub submission {
|
Line 426 sub submission {
|
$request->print($result); |
$request->print($result); |
} |
} |
|
|
# kwclr is the only variable that is non blank if this has been used once. |
# kwclr is the only variable that is guaranteed to be non blank if this subroutine has been called once. |
my %keyhash = (); |
my %keyhash = (); |
if ($ENV{'form.kwclr'} eq '') { |
if ($ENV{'form.kwclr'} eq '') { |
%keyhash = &Apache::lonnet::dump('nohist_handgrade', |
%keyhash = &Apache::lonnet::dump('nohist_handgrade', |
Line 411 sub submission {
|
Line 445 sub submission {
|
} |
} |
$request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n". |
$request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
|
'<input type="hidden" name="refresh" value="off" />'."\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="vProb" value="'.$ENV{'form.vProb'}.'" />'."\n". |
'<input type="hidden" name="vProb" value="'.$ENV{'form.vProb'}.'" />'."\n". |
Line 453 KEYWORDS
|
Line 488 KEYWORDS
|
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>Username: </b>'.$uname. |
$result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$fullname. |
'</td><td><b>Fullname: </b>'.$fullname. |
'</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') { |
# my $subonly = &get_last_submission($symb,$uname,$udom,$ENV{'request.course.id'}); |
# my $subonly = &get_last_submission($symb,$uname,$udom,$ENV{'request.course.id'}); |
my ($classlist) = &getclasslist('all','0'); |
my ($classlist) = &getclasslist('all','0'); |
my @collaborators; |
my @collaborators; |
# foreach ( sort(@{ $$classlist{'all'} }) ) { |
# foreach ( sort(@{ $$classlist{'all'} }) ) { |
# my ($sname,$sdom) = split(/:/); |
# my ($uname,$udom) = split(/:/); |
# push @collaborators,$sname if (grep /\b$sname(\b|\.)/i,$subonly); |
# push @collaborators,$uname if (grep /\b$uname(\b|\.)/i,$subonly); |
# } |
# } |
# push @collaborators,'leede','carlandmm','freyniks'; # as a test to display collaborators. |
# push @collaborators,'leede','carlandmm','freyniks'; # as a test to display collaborators. |
if (scalar(@collaborators) != 0) { |
if (scalar(@collaborators) != 0) { |
Line 478 KEYWORDS
|
Line 513 KEYWORDS
|
$result.='</table>'."\n"; |
$result.='</table>'."\n"; |
$request->print($result); |
$request->print($result); |
|
|
|
my ($partlist,$handgrade) = &response_type($url); |
|
|
# print student answer |
# print student answer |
if ($ENV{'form.lastSub'} eq 'lastonly') { |
if ($ENV{'form.lastSub'} eq 'lastonly') { |
my ($string,$timestamp)=&get_last_submission ($symb,$uname,$udom,$ENV{'request.course.id'}); |
my ($string,$timestamp)=&get_last_submission ($symb,$uname,$udom,$ENV{'request.course.id'}); |
$string=&keywords_highlight(join('::::',@$string)); |
|
my $lastsubonly='<table border="0" width=100%><tr><td bgcolor="#777777">'; |
my $lastsubonly='<table border="0" width=100%><tr><td bgcolor="#777777">'; |
$lastsubonly.='<table border="0" width=100%><tr bgcolor="#ddffff">'; |
$lastsubonly.='<table border="0" width=100%><tr bgcolor="#ddffff">'; |
$lastsubonly.='<td><b>Last Submission Only</b>'. |
$lastsubonly.='<td><b>Last Submission Only</b>'. |
($timestamp eq '' ? '' : ' <b>Date Submitted:</b> '.@$timestamp).'</td></tr>'; |
($$timestamp eq '' ? '' : ' <b>Date Submitted:</b> '.$$timestamp).'</td></tr>'; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'; |
if ($$timestamp eq '') { |
$lastsubonly.=$string; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0].'</td></tr>'; |
|
} else { |
|
for my $part (sort keys(%$handgrade)) { |
|
foreach (@$string) { |
|
my ($partid,$respid) = /^resource\.(\d{1,2})\.(\d{1,2})\.submission/; |
|
if ($part eq ($partid.'_'.$respid)) { |
|
my ($ressub,$subval) = split(/:/,$_,2); |
|
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part ID</b> '. |
|
$partid.' <b>Response ID</b> '.$respid. |
|
' <b>Submission</b> '.&keywords_highlight($subval).'</td></tr>'; |
|
} |
|
} |
|
} |
|
} |
$lastsubonly.='</td></tr></table></td></tr></table>'."\n"; |
$lastsubonly.='</td></tr></table></td></tr></table>'."\n"; |
$request->print($lastsubonly); |
$request->print($lastsubonly); |
} else { |
} else { |
Line 496 KEYWORDS
|
Line 545 KEYWORDS
|
'.submission','Apache::grades::keywords_highlight')); |
'.submission','Apache::grades::keywords_highlight')); |
} |
} |
|
|
my $wgt = &Apache::lonnet::EXT('resource.partid.weight',$symb,$udom,$uname); |
$result='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n". |
my $wgtmsg = ($wgt > 0 ? '(problem weight)' : '<font color="red">problem weight assigned by computer</font>'); |
'<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
$wgt = ($wgt > 0 ? $wgt : '1'); |
|
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
|
my $score = ($record{'resource.0.awarded'} eq '' ? '' : $record{'resource.0.awarded'}*$wgt); |
|
|
|
# display grading options |
|
$result='<input type="hidden" name="WGT'.$counter.'" value="'.$wgt.'" />'. |
|
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'.$udom.'" />'."\n"; |
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'.$udom.'" />'."\n"; |
$result.='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n"; |
$result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
$result.='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n"; |
',\''.$fullname.'\')"; TARGET=_self>Compose Message</a><br />'."\n" if ($ENV{'form.handgrade'} eq 'yes'); |
$result.='<table border="0"><tr><td><b>Points</b></td><td>'; |
$request->print($result); |
|
|
my $ctr = 0; |
|
$result.='<table border="0"><tr>'; # display radio buttons in a nice table with 10 across |
|
while ($ctr<=$wgt) { |
|
$result.= '<td><input type="radio" name="RADVAL'.$counter.'" '. |
|
'onclick="javascript:writeBox(this.form.GRADE_BOX'.$counter. |
|
',this.form.GRADE_SEL'.$counter.','.$ctr.','.$wgt.')" '. |
|
($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>'; |
my %seen = (); |
$result.='<td><input type="text" name="GRADE_BOX'.$counter.'"'. |
my @partlist; |
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
for (sort keys(%$handgrade)) { |
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter. |
my ($partid,$respid) = split(/_/); |
',this.form.GRADE_BOX'.$counter. |
next if ($seen{$partid} > 0); |
',this.form.GRADE_SEL'.$counter.',\''.$wgt.'\')" /></td>'."\n"; |
$seen{$partid}++; |
$result.='<td>/'.$wgt.' '.$wgtmsg.' </td><td>'; |
next if ($$handgrade{$_} =~ /:no$/); |
|
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 %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
|
my $score = ($record{'resource.0.awarded'} eq '' ? '' : $record{'resource.0.awarded'}*$wgt); |
|
|
foreach my $part (&getpartlist($url)) { |
# display grading options |
print "parts=$part<br>"; |
$result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'; |
my ($temp,$part,$type)=split(/_/,$part); |
|
if ($type eq 'solved') { |
$result.='<table border="0"><tr><td><b>Part </b>'.$partid.' <b>Points</b></td><td>'; |
my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); |
|
$status = 'partial' if ($foo =~ /partially/); |
my $ctr = 0; |
$status = 'nothing' if ($status eq ''); |
$result.='<table border="0"><tr>'; # display radio buttons in a nice table 10 across |
$result.='<select name="GRADE_SEL'.$counter.'">'."\n"; |
while ($ctr<=$wgt) { |
my $optsel = '<option>correct</option><option>incorrect</option>'. |
$result.= '<td><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. |
'<option>excused</option><option>ungraded</option>'. |
'onclick="javascript:writeBox(this.form.GRADE_BOX'.$counter.'_'.$partid. |
'<option>partial</option><option>nothing</option>'."\n"; |
',this.form.GRADE_SEL'.$counter.'_'.$partid.','.$ctr. |
$optsel =~ s/<option>$status/<option selected="on">$status/; |
',this.form.stores'.$counter.'_'.$partid.')" '. |
$result.=$optsel; |
($score eq $ctr ? 'checked':'').' /> '.$ctr."</td>\n"; |
$result.="</select>  \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="GRADE_BOX'.$counter.'_'.$partid.'"'. |
|
($score ne ''? ' value = "'.$score.'"':'').' size="4" '. |
|
'onChange="javascript:updateRadio(this.form.RADVAL'.$counter.'_'.$partid. |
|
',this.form.GRADE_BOX'.$counter.'_'.$partid. |
|
',this.form.GRADE_SEL'.$counter.'_'.$partid. |
|
',this.form.stores'.$counter.'_'.$partid.')" /></td>'."\n"; |
|
$result.='<td>/'.$wgt.' '.$wgtmsg.' </td><td>'; |
|
|
|
$result.='<select name="GRADE_SEL'.$counter.'_'.$partid.'" '. |
|
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
|
',this.form.GRADE_BOX'.$counter.'_'.$partid. |
|
',this.form.GRADE_SEL'.$counter.'_'.$partid. |
|
',this.form.stores'.$counter.'_'.$partid.')" />'."\n". |
|
'<option selected="on"> </option>'. |
|
'<option>excused</option></select>'."  \n"; |
|
$result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="0" />'; |
|
$result.='</td></tr></table>'; |
|
$request->print($result); |
} |
} |
$result.='<a href="javascript:msgCenter(document.SCORE,'.$counter. |
$request->print('<input type="hidden" name="partlist'.$counter.'" value="'.(join ":",@partlist).'" />'."\n"); |
',\''.$fullname.'\')"; TARGET=_self>Compose Message</a></td></tr></table>'."\n"; |
$request->print('</td></tr></table></td></tr></table>'."\n"); |
# $result.='</table>'; |
|
$result.='</td></tr></table></td></tr></table>'; |
|
$request->print($result); |
|
|
|
# print end of form |
# print end of form |
if ($counter == $total) { |
if ($counter == $total) { |
Line 574 KEYWORDS
|
Line 630 KEYWORDS
|
sub get_last_submission { |
sub get_last_submission { |
my ($symb,$username,$domain,$course)=@_; |
my ($symb,$username,$domain,$course)=@_; |
if ($symb) { |
if ($symb) { |
my (@string,@timestamp); |
my (@string,$timestamp); |
my (%returnhash)=&Apache::lonnet::restore($symb,$course,$domain,$username); |
my (%returnhash)=&Apache::lonnet::restore($symb,$course,$domain,$username); |
if ($returnhash{'version'}) { |
if ($returnhash{'version'}) { |
my %lasthash=(); |
my %lasthash=(); |
my ($version); |
my ($version); |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
|
} |
} |
} |
} |
foreach ((keys %lasthash)) { |
foreach ((keys %lasthash)) { |
if ($_ =~ /\.submission$/) {push @string, (join(':',$_,$lasthash{$_}))} |
print "lasthash key=$_<br>"; |
if ($_ =~ /timestamp/) {$timestamp = scalar(localtime($lasthash{$_}))}; |
if ($_ =~ /\.submission$/) {push @string, $_,$lasthash{$_}} |
} |
if ($_ =~ /timestamp/) {push @timestamp, scalar(localtime($lasthash{$_}))}; |
} |
# if ($_ =~ /\.submission$/) {$string = $lasthash{$_}} |
@string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; |
# if ($_ =~ /timestamp/) {$timestamp=scalar(localtime($lasthash{$_}))}; |
return \@string,\$timestamp; |
} |
|
} |
|
@string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; |
|
return \@string,\@timestamp; |
|
} |
} |
} |
} |
|
|
Line 604 sub keywords_highlight {
|
Line 657 sub keywords_highlight {
|
(my $styleoff = $styleon) =~ s/\</\<\//; |
(my $styleoff = $styleon) =~ s/\</\<\//; |
my @keylist = split(/[,\s+]/,$ENV{'form.keywords'}); |
my @keylist = split(/[,\s+]/,$ENV{'form.keywords'}); |
foreach (@keylist) { |
foreach (@keylist) { |
# next if ($_ eq ''); |
|
$string =~ s/\b$_(\b|\.)/\<font color\=$ENV{'form.kwclr'} $size\>$styleon$_$styleoff\<\/font\>/gi; |
$string =~ s/\b$_(\b|\.)/\<font color\=$ENV{'form.kwclr'} $size\>$styleon$_$styleoff\<\/font\>/gi; |
} |
} |
return $string; |
return $string; |
Line 621 sub processHandGrade {
|
Line 673 sub processHandGrade {
|
my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'}; |
my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'}; |
my %keyhash = (); |
my %keyhash = (); |
$ENV{'form.keywords'} =~ s/,\s{0,}|\s+/ /g; |
$ENV{'form.keywords'} =~ s/,\s{0,}|\s+/ /g; |
$keyhash{$symb.'_handgrade'} = 'activated'; |
$ENV{'form.keywords'} =~ s/^\s+|\s+$//; |
$keyhash{$symb.'_keywords'} = $ENV{'form.keywords'}; |
$keyhash{$symb.'_keywords'} = $ENV{'form.keywords'}; |
$keyhash{$symb.'_subject'} = $ENV{'form.msgsub'}; |
$keyhash{$symb.'_subject'} = $ENV{'form.msgsub'}; |
$keyhash{$loginuser.'_kwclr'} = $ENV{'form.kwclr'}; |
$keyhash{$loginuser.'_kwclr'} = $ENV{'form.kwclr'}; |
Line 652 sub processHandGrade {
|
Line 704 sub processHandGrade {
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
my (@parts) = sort(&getpartlist($url)); |
if ($ENV{'form.refresh'} eq 'on') { |
|
my $ctr = 0; |
|
while ($ctr < $ntstu) { |
|
($ENV{'form.student'},my $udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); |
|
&submission($request,$ctr,$ntstu-1); |
|
$ctr++; |
|
} |
|
return ''; |
|
} |
|
|
if ($button eq 'Save & Next') { |
if ($button eq 'Save & Next') { |
my $ctr = 0; |
my $ctr = 0; |
while ($ctr < $ngrade) { |
while ($ctr < $ngrade) { |
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); |
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); |
&saveHandGrade($url,$symb,$uname,$udom,$ctr,@parts); |
my ($errorflg) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); |
|
return '' if ($errorflg eq 'error'); |
|
|
my $includemsg = $ENV{'form.includemsg'.$ctr}; |
my $includemsg = $ENV{'form.includemsg'.$ctr}; |
my ($subject,$message,$msgstatus) = ('','',''); |
my ($subject,$message,$msgstatus) = ('','',''); |
Line 674 sub processHandGrade {
|
Line 735 sub processHandGrade {
|
if ($ENV{'form.collaborator'.$ctr}) { |
if ($ENV{'form.collaborator'.$ctr}) { |
my (@collaborators) = split(/:/,$ENV{'form.collaborator'.$ctr}); |
my (@collaborators) = split(/:/,$ENV{'form.collaborator'.$ctr}); |
foreach (@collaborators) { |
foreach (@collaborators) { |
&saveHandGrade($url,$symb,$_,$udom,$ctr,@parts); |
&saveHandGrade($request,$url,$symb,$_,$udom,$ctr); |
if ($message ne '') { |
if ($message ne '') { |
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom,$ENV{'form.msgsub'},$message); |
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom,$ENV{'form.msgsub'},$message); |
} |
} |
Line 688 sub processHandGrade {
|
Line 749 sub processHandGrade {
|
|
|
my ($classlist) = &getclasslist($ENV{'form.section'},'0'); |
my ($classlist) = &getclasslist($ENV{'form.section'},'0'); |
my (@nextlist,@prevlist); |
my (@nextlist,@prevlist); |
my ($nextflg,$prevflg,$ctr,$ctprev) = (0,0,0,0); |
my ($nextflg,$ctr,$ctprev) = (0,0,0); |
|
my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); |
foreach my $student ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) { |
foreach my $student ( sort(@{ $$classlist{$ENV{'form.section'}} }) ) { |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
my ($type,$status) = &student_gradeStatus($ENV{'form.url'},$udom,$uname); |
my (%status) = &student_gradeStatus($ENV{'form.url'},$udom,$uname,$partlist); |
next if ($status eq 'nothing' && $ENV{'form.submitonly'} eq 'yes'); |
my $statusflg = ''; |
|
foreach (keys(%status)) { |
|
$statusflg = 1 if ($status{$_} ne 'nothing'); |
|
} |
|
next if ($statusflg eq '' && $ENV{'form.submitonly'} eq 'yes'); |
|
|
if ($nextflg == 1 && $button =~ /Next$/) { |
if ($nextflg == 1 && $button =~ /Next$/) { |
push @nextlist,$uname if ($ctr < $ntstu); |
push @nextlist,$uname if ($ctr < $ntstu); |
$ctr++; |
$ctr++; |
|
last if ($ctr == $ntstu); |
} |
} |
$nextflg = 1 if ($student eq $laststu); |
$nextflg = 1 if ($student eq $laststu); |
$prevflg = 1 if ($student eq $firststu); |
if ($button eq 'Previous') { |
if ($prevflg == 0 && $button eq 'Previous') { |
last if ($student eq $firststu); |
push @prevlist,$uname; |
push @prevlist,$uname; |
$ctprev++; |
$ctprev++; |
} |
} |
} |
} |
|
|
if ($button eq 'Previous') { |
if ($button eq 'Previous') { |
if ($ctprev <= $ntstu) { |
if ($ctprev <= $ntstu) { |
@nextlist = @prevlist; |
@nextlist = @prevlist; |
Line 717 sub processHandGrade {
|
Line 785 sub processHandGrade {
|
} |
} |
} |
} |
} |
} |
|
|
$ctr = 0; |
$ctr = 0; |
my $total = scalar(@nextlist)-1; |
my $total = scalar(@nextlist)-1; |
foreach my $student (@nextlist) { |
foreach my $student (@nextlist) { |
Line 735 sub processHandGrade {
|
Line 804 sub processHandGrade {
|
} |
} |
|
|
sub saveHandGrade { |
sub saveHandGrade { |
my ($url,$symb,$stuname,$domain,$newflg,@parts) = @_; |
my ($request,$url,$symb,$stuname,$domain,$newflg) = @_; |
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 my $part (@parts) { |
if ($ENV{'form.GRADE_SEL'.$newflg.'_'.$_} eq 'excused') { |
my ($temp,$part,$type)=split(/_/,$part); |
$newrecord{'resource.'.$_.'.solved'} = 'excused'; |
my $oldscore=$record{"resource.$part.$type"}; |
} else { |
my $newscore; |
my $pts = ($ENV{'form.GRADE_BOX'.$newflg.'_'.$_} ne '' ? |
if ($type eq 'awarded' && $newflg >= 0) { |
$ENV{'form.GRADE_BOX'.$newflg.'_'.$_} : $ENV{'form.RADVAL'.$newflg.'_'.$_}); |
my $pts = ($ENV{'form.GRADE_BOX'.$newflg} ne '' ? |
if ($pts eq '') { |
$ENV{'form.GRADE_BOX'.$newflg} : $ENV{'form.RADVAL'.$newflg}); |
&userError($request,'No point was assigned for part id '.$_.' and for username '.$stuname.'.'); |
my $wgt = $ENV{'form.WGT'.$newflg}; |
return 'error'; |
# my $sel = $ENV{'form.GRADE_SEL'.$newflg}; |
} |
$newscore = $pts/$wgt if ($wgt != 0); |
my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : $ENV{'form.WGT'.$newflg.'_'.$_}; |
} |
my $partial= $pts/$wgt; |
if ($type eq 'solved') { |
$newrecord{'resource.'.$_.'.awarded'} = $partial; |
$newscore = $ENV{'form.GRADE_SEL'.$newflg} if ($newflg >= 0); |
if ($partial == 0) { |
my $update=0; |
$newrecord{'resource.'.$_.'.solved'} = 'incorrect_by_override'; |
if ($newscore eq 'nothing' ) { |
} else { |
if ($oldscore ne '') { |
$newrecord{'resource.'.$_.'.solved'} = 'correct_by_override'; |
$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 = 'correct_partially_by_override'; } |
|
} |
|
if ($update) { $newrecord{"resource.$part.$type"}=$newscore; } |
|
} else { |
|
if ($oldscore ne $newscore) { |
|
$newrecord{"resource.$part.$type"}=$newscore; |
|
} |
} |
} |
|
} |
} |
|
|
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'}"; |
# while (my ($k,$v) = each %newrecord) { |
while (my ($k,$v) = each %newrecord) { |
# print "k=$k:v=$v:<br>\n"; |
print "k=$k:v=$v:<br>\n"; |
# } |
} |
# print "symb=$symb,courseid=$ENV{'request.course.id'},dom=$domain,name=$stuname<br>"; |
|
# &Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},$domain,$stuname); |
# &Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},$domain,$stuname); |
} |
} |
return ''; |
return ''; |
Line 807 sub gradingmenu {
|
Line 861 sub gradingmenu {
|
my ($request) = @_; |
my ($request) = @_; |
my ($symb,$url)=&get_symb_and_url($request); |
my ($symb,$url)=&get_symb_and_url($request); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $allkeys = &Apache::lonnet::metadata($url,'keys'); |
|
my $handgrade = ($allkeys =~ /parameter_.*?_handgrade/ ? 'yes' : 'no'); |
|
my ($responsetype,$foo) = split(/_/,&Apache::lonnet::metadata($url,'packages')); |
|
$allkeys=~s/,/\<br\>/g; |
|
# print "allkeys=$allkeys<br><br>"; |
|
$Apache::lonxml::debug=1; |
|
&Apache::lonxml::debug(join(':',&Apache::lonnet::metadata($url,'packages'))); |
|
$Apache::lonxml::debug=0; |
|
|
|
my $result='<h2> <font color="#339933">Select a Grading Method</font></h2>'; |
my $result='<h2> <font color="#339933">Select a Grading Method</font></h2>'; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
$result.='<tr><td><font size=+1><b>Resource: </b></font></td>'. |
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
'<td><font size=+1>'.$url.'</font></td></tr>'; |
my ($partlist,$handgrade) = &response_type($url); |
$result.='<tr><td><font size=+1><b>Type: </b></font></td>'. |
my ($resptype,$hdgrade)=('','no'); |
'<td><font size=+1>'.$responsetype.' <b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
for (sort keys(%$handgrade)) { |
|
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
|
$resptype = $responsetype; |
|
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
|
$result.='<tr><td><b>Part id: </b>'.$_.'</td>'. |
|
'<td><b>Type: </b>'.$responsetype.'</td>'. |
|
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
|
} |
$result.='</table>'; |
$result.='</table>'; |
my $t0=&Time::HiRes::time(); |
|
$result.=&view_edit_entire_class_form($symb,$url).'<br />'; |
$result.=&view_edit_entire_class_form($symb,$url).'<br />'; |
my $t1=&Time::HiRes::time(); |
|
print "elapsed10=",$t1-$t0,"<br />"; |
|
$result.=&upcsvScores_form($symb,$url).'<br />'; |
$result.=&upcsvScores_form($symb,$url).'<br />'; |
my $t2=&Time::HiRes::time(); |
$result.=&viewGradeaStu_form($symb,$url,$resptype,$hdgrade).'<br />'; |
print "elapsed21=",$t2-$t1,"<br />"; |
$result.=&verifyReceipt_form($symb,$url).'<br />'; |
$result.=&viewGradeaStu_form($symb,$url,$responsetype,$handgrade).'<br />'; |
$result.=&view_classlist_form($symb,$url); |
my $t3=&Time::HiRes::time(); |
|
print "elapsed32=",$t3-$t2,"<br />"; |
return $result; |
$result.=&verifyReceipt_form($symb,$url); |
} |
my $t4=&Time::HiRes::time(); |
|
print "elapsed43=",$t4-$t3,"<br />"; |
sub view_classlist_form { |
print "Total elapsed time=",$t4-$t0,"<br />"; |
my ($symb,$url)=@_; |
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
|
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
|
$result.=' <b>View Class List</b></td></tr>'."\n"; |
|
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
|
$result.='<form action="/adm/grades" method="post">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="viewclasslist" />'."\n"; |
|
$result.=' <input type="submit" name="submit" value="View Class" /></form>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
|
$result.='</td></tr></table>'."\n"; |
return $result; |
return $result; |
} |
} |
|
|
|
sub viewclasslist { |
|
my ($request) = shift; |
|
my ($coursedomain,$coursenum) = split(/_/,$ENV{'request.course.id'}); |
|
my %classlist=&Apache::lonnet::dump('classlist',$coursedomain,$coursenum); |
|
$request->print('<table border=1>'); |
|
foreach (sort keys(%classlist)) { |
|
# my ($unam,$udom) = split(/:/,$_,2); |
|
# my $section = &Apache::lonnet::usection($udom,$unam,$ENV{'request.course.id'}); |
|
# my $fullname = &get_fullname ($unam,$udom); |
|
# my @uname; |
|
# $uname[0]=$unam; |
|
# my %userid=&Apache::lonnet::idrget($udom,@uname); |
|
# my $value=$classlist{$_}.':'.$userid{$unam}.':'.$section.':'.$fullname; |
|
# $classlist{$_}=$value; |
|
$request->print('<tr><td>'.$_.' </td><td><pre> '.$classlist{$_}.'</pre></td></tr>'); |
|
} |
|
$request->print('</table>'); |
|
# my $putresult = &Apache::lonnet::put |
|
# ('classlist',\%classlist, |
|
# $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
# $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
|
return ''; |
|
} |
|
|
sub view_edit_entire_class_form { |
sub view_edit_entire_class_form { |
my ($symb,$url)=@_; |
my ($symb,$url)=@_; |
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
Line 883 ENDUPFORM
|
Line 968 ENDUPFORM
|
|
|
sub viewGradeaStu_form { |
sub viewGradeaStu_form { |
my ($symb,$url,$response,$handgrade) = @_; |
my ($symb,$url,$response,$handgrade) = @_; |
|
|
|
|
my $t3=&Time::HiRes::time(); |
|
|
|
my ($classlist,$sections) = &getclasslist('all','0'); |
my ($classlist,$sections) = &getclasslist('all','0'); |
|
|
my $t4=&Time::HiRes::time(); |
|
print "elapsed_getclasslist=",$t4-$t3,"<br />"; |
|
|
|
|
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
$result.='<table width=100% border=0><tr bgcolor="#e6ffff"><td>'."\n"; |
$result.=' <b>View/Grade an Individual Student\'s Submission</b></td></tr>'."\n"; |
$result.=' <b>View/Grade an Individual Student\'s Submission</b></td></tr>'."\n"; |
Line 905 sub viewGradeaStu_form {
|
Line 981 sub viewGradeaStu_form {
|
'<input type="hidden" name="command" value="submission" />'."\n"; |
'<input type="hidden" name="command" value="submission" />'."\n"; |
|
|
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
foreach my $section (sort (@$sections)) { |
foreach (sort (@$sections)) { |
$result.= '<option>'.$section.'</option>'."\n"; |
$result.= '<option>'.$_.'</option>'."\n"; |
} |
} |
$result.= '<option selected="on">all</select>'."\n"; |
$result.= '<option selected="on">all</select>'."\n"; |
$result.=' <b>Display students who has: </b>'. |
$result.=' <b>Display students who has: </b>'. |
Line 1027 sub sub_page_js {
|
Line 1103 sub sub_page_js {
|
my $request = shift; |
my $request = shift; |
$request->print(<<SUBJAVASCRIPT); |
$request->print(<<SUBJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function updateRadio(radioButton,formtextbox,formsel,wgt) { |
function updateRadio(radioButton,formtextbox,formsel,scores) { |
var pts = formtextbox.value; |
var pts = formtextbox.value; |
var resetbox =false; |
var resetbox =false; |
if (isNaN(pts) || pts < 0) { |
if (isNaN(pts) || pts < 0) { |
Line 1050 sub sub_page_js {
|
Line 1126 sub sub_page_js {
|
radioButton[i].checked=true; |
radioButton[i].checked=true; |
} |
} |
} |
} |
updateSelect(formsel,pts,wgt); |
updateSelect(formsel); |
|
scores.value = "0"; |
} |
} |
|
|
function writeBox(formrad,formsel,pts,wgt) { |
function writeBox(formrad,formsel,pts,scores) { |
formrad.value = pts; |
formrad.value = pts; |
updateSelect(formsel,pts,wgt); |
scores.value = "0"; |
|
updateSelect(formsel,pts); |
return; |
return; |
} |
} |
|
|
function updateSelect(formsel,pts,wgt) { |
function clearRadBox(radioButton,formbox,formsel,scores) { |
if (pts == 0) { |
for (var i=0; i<formsel.length; i++) { |
formsel[1].selected = true; |
if (formsel[i].selected) { |
} |
var selectx=i; |
if (pts > 0 && pts < wgt) { |
} |
formsel[4].selected = true; |
|
} |
} |
if (pts == wgt) { |
if (selectx == scores.value) { return }; |
formsel[0].selected = true; |
formbox.value = ""; |
|
for (var i=0; i<radioButton.length; i++) { |
|
radioButton[i].checked=false; |
} |
} |
|
scores.value = selectx; |
|
} |
|
|
|
function updateSelect(formsel) { |
|
formsel[0].selected = true; |
return; |
return; |
} |
} |
|
|
|
//===================== Show list of keywords ==================== |
function keywords(keyform) { |
function keywords(keyform) { |
var keywds = keyform.value; |
var keywds = keyform.value; |
var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds); |
var nret = prompt("Keywords list, separated by a space. Add/delete to list if desired.",keywds); |
Line 1202 function displaySavedMsg(ctr,msg,shwsel)
|
Line 1287 function displaySavedMsg(ctr,msg,shwsel)
|
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\">New</td>"); |
pWin.document.write("<td align=\\"center\\">New</td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"newmsgchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td><input name=\\"newmsg\\" type=\\"text\\" value=\\""+newmsg+" \\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pWin.document.write("<td><input name=\\"newmsg\\" type=\\"text\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" value=\\""+newmsg+" \\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
} |
} |
|
|
function msgTail() { |
function msgTail() { |
Line 1252 function displaySavedMsg(ctr,msg,shwsel)
|
Line 1337 function displaySavedMsg(ctr,msg,shwsel)
|
hwdWin.document.write("<title>Highlight Central</title>"); |
hwdWin.document.write("<title>Highlight Central</title>"); |
|
|
hwdWin.document.write("<script language=javascript>"); |
hwdWin.document.write("<script language=javascript>"); |
hwdWin.document.write("function updateChoice() {"); |
hwdWin.document.write("function updateChoice(flag) {"); |
hwdWin.document.write(" opener.document.SCORE.kwclr.value = radioSelection(document.hlCenter.kwdclr);"); |
hwdWin.document.write(" opener.document.SCORE.kwclr.value = radioSelection(document.hlCenter.kwdclr);"); |
hwdWin.document.write(" opener.document.SCORE.kwsize.value = radioSelection(document.hlCenter.kwdsize);"); |
hwdWin.document.write(" opener.document.SCORE.kwsize.value = radioSelection(document.hlCenter.kwdsize);"); |
hwdWin.document.write(" opener.document.SCORE.kwstyle.value = radioSelection(document.hlCenter.kwdstyle);"); |
hwdWin.document.write(" opener.document.SCORE.kwstyle.value = radioSelection(document.hlCenter.kwdstyle);"); |
|
hwdWin.document.write(" if (flag==1){"); |
|
hwdWin.document.write(" opener.document.SCORE.refresh.value = \\"on\\";"); |
|
hwdWin.document.write(" opener.document.SCORE.submit();"); |
|
hwdWin.document.write(" }"); |
hwdWin.document.write(" self.close()"); |
hwdWin.document.write(" self.close()"); |
hwdWin.document.write("}"); |
hwdWin.document.write("}"); |
|
|
Line 1296 function displaySavedMsg(ctr,msg,shwsel)
|
Line 1385 function displaySavedMsg(ctr,msg,shwsel)
|
function highlightend() { |
function highlightend() { |
hwdWin.document.write("</table>"); |
hwdWin.document.write("</table>"); |
hwdWin.document.write("</td></tr></table> "); |
hwdWin.document.write("</td></tr></table> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Set Options\\" onClick=\\"javascript:updateChoice()\\"> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Refresh\\" onClick=\\"javascript:updateChoice(1)\\"> "); |
|
hwdWin.document.write("<input type=\\"button\\" value=\\"Set Options\\" onClick=\\"javascript:updateChoice(0)\\"> "); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
hwdWin.document.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br><br>"); |
hwdWin.document.write("</form>"); |
hwdWin.document.write("</form>"); |
hwdWin.document.write("</body></html>"); |
hwdWin.document.write("</body></html>"); |
Line 1621 sub handler {
|
Line 1711 sub handler {
|
$request->print(&verifyreceipt($request)); |
$request->print(&verifyreceipt($request)); |
} elsif ($command eq 'csvupload') { |
} elsif ($command eq 'csvupload') { |
$request->print(&csvupload($request)); |
$request->print(&csvupload($request)); |
|
} elsif ($command eq 'viewclasslist') { |
|
$request->print(&viewclasslist($request)); |
} elsif ($command eq 'csvuploadmap') { |
} elsif ($command eq 'csvuploadmap') { |
$request->print(&csvuploadmap($request)); |
$request->print(&csvuploadmap($request)); |
# } elsif ($command eq 'receiptInput') { |
# } elsif ($command eq 'receiptInput') { |