version 1.44, 2002/08/02 21:10:03
|
version 1.62, 2002/11/27 16:39:37
|
Line 40 use Apache::lonxml;
|
Line 40 use Apache::lonxml;
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonhomework; |
use Apache::lonhomework; |
|
use Apache::loncoursedata; |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::lonmsg qw(:user_normal_msg); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
|
Line 51 sub getpartlist {
|
Line 52 sub getpartlist {
|
my @parts =(); |
my @parts =(); |
my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys')); |
my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys')); |
foreach my $key (@metakeys) { |
foreach my $key (@metakeys) { |
if ( $key =~ m/stores_([0-9]+)_.*/) { |
if ( $key =~ m/stores_(\w+)_.*/) { |
push(@parts,$key); |
push(@parts,$key); |
} |
} |
} |
} |
Line 72 sub get_symb_and_url {
|
Line 73 sub get_symb_and_url {
|
sub get_fullname { |
sub get_fullname { |
my ($uname,$udom) = @_; |
my ($uname,$udom) = @_; |
my %name=&Apache::lonnet::get('environment', ['lastname','generation', |
my %name=&Apache::lonnet::get('environment', ['lastname','generation', |
'firstname','middlename'],$udom,$uname); |
'firstname','middlename'], |
|
$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) { |
$fullname=$name{'lastname'}.$name{'generation'}; |
$fullname = &Apache::loncoursedata::ProcessFullName |
if ($fullname =~ /[^\s]+/) { $fullname.=', '; } |
(@name{qw/lastname generation firstname middlename/}); |
$fullname.=$name{'firstname'}.' '.$name{'middlename'}; |
} else { |
|
&Apache::lonnet::logthis('grades.pm: no name data for '.$uname. |
|
'@'.$udom.':'.$tmp); |
} |
} |
return $fullname; |
return $fullname; |
} |
} |
Line 91 sub response_type {
|
Line 95 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+.*/) { |
if (/^\w+response_\w+.*/) { |
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 103 sub response_type {
|
Line 107 sub response_type {
|
return \@partlist,\%handgrade; |
return \@partlist,\%handgrade; |
} |
} |
|
|
#--- Prints a message on screen if a user did something wrong |
|
#--- Operator error --- |
|
sub userError { |
|
my ($request, $reason, $step) = @_; |
|
$request->print('<h3><font color="red">LON-CAPA User Error</font></h3><br />'."\n"); |
|
$request->print('<b>Reason: </b>'.$reason.'<br /><br />'."\n"); |
|
$request->print('<b>Step: </b>'.($step ne '' ? $step : 'Use your browser back button to correct') |
|
.'<br /><br />'."\n"); |
|
return ''; |
|
} |
|
|
|
#--- Dumps the class list with usernames,list of sections, |
#--- Dumps the class list with usernames,list of sections, |
#--- section, ids and fullnames for each user. |
#--- section, ids and fullnames for each user. |
sub getclasslist { |
sub getclasslist { |
my ($getsec,$hideexpired) = @_; |
my ($getsec,$hideexpired) = @_; |
my $now = time; |
my $classlist=&Apache::loncoursedata::get_classlist(); |
my %classlist=&Apache::lonnet::dump('classlist', |
# Bail out if we were unable to get the classlist |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
return if (! defined($classlist)); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
# |
# codes to check for fields in the classlist |
my %sections; |
# should contain end:start:id:section:fullname |
my %fullnames; |
for (keys %classlist) { |
foreach (keys(%$classlist)) { |
my (@fields) = split(/:/,$classlist{$_}); |
# the following undefs are for 'domain', and 'username' respectively. |
%classlist = &reformat_classlist(\%classlist) if (scalar(@fields) <= 2); |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
last; |
@{$classlist->{$_}}; |
} |
|
|
|
my (@holdsec,@sections,%allids,%stusec,%fullname); |
|
foreach (keys(%classlist)) { |
|
my ($end,$start,$id,$section,$fullname)=split(/:/,$classlist{$_}); |
|
# still a student? |
# still a student? |
if (($hideexpired) && ($end) && ($end < $now)) { |
if (($hideexpired) && ($status ne 'Active')) { |
next; |
delete ($classlist->{$_}); |
} |
next; |
|
} |
$section = ($section ne '' ? $section : 'no'); |
$section = ($section ne '' ? $section : 'no'); |
push @holdsec,$section; |
|
if ($getsec eq 'all' || $getsec eq $section) { |
if ($getsec eq 'all' || $getsec eq $section) { |
push (@{ $classlist{$getsec} }, $_); |
$sections{$section}++; |
$allids{$_} =$id; |
$fullnames{$_}=$fullname; |
$stusec{$_} =$section; |
} else { |
$fullname{$_}=$fullname; |
delete($classlist->{$_}); |
} |
} |
} |
} |
my %seen = (); |
my %seen = (); |
foreach my $item (@holdsec) { |
my @sections = sort(keys(%sections)); |
push (@sections, $item) unless $seen{$item}++; |
return ($classlist,\@sections,\%fullnames); |
} |
|
return (\%classlist,\@sections,\%allids,\%stusec,\%fullname); |
|
} |
|
|
|
# add id, section and fullname to the classlist.db |
|
# done to maintain backward compatibility with older versions |
|
sub reformat_classlist { |
|
my ($classlist) = shift; |
|
foreach (sort keys(%$classlist)) { |
|
my ($unam,$udom) = split(/:/); |
|
my $section = &Apache::lonnet::usection($udom,$unam,$ENV{'request.course.id'}); |
|
my $fullname = &get_fullname ($unam,$udom); |
|
my %userid = &Apache::lonnet::idrget($udom,($unam)); |
|
$$classlist{$_} = $$classlist{$_}.':'.$userid{$unam}.':'.$section.':'.$fullname; |
|
} |
|
my $putresult = &Apache::lonnet::put |
|
('classlist',\%$classlist, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
|
|
return %$classlist; |
|
} |
} |
|
|
#find user domain |
#find user domain |
Line 224 sub student_gradeStatus {
|
Line 191 sub student_gradeStatus {
|
return %partstatus; |
return %partstatus; |
} |
} |
|
|
|
# hidden form and javascript that calls the form |
|
# Use by verifyscript and viewgrades |
|
# Shows a student's view of problem and submission |
|
sub jscriptNform { |
|
my ($url,$symb) = @_; |
|
my $jscript='<script type="text/javascript" language="javascript">'."\n". |
|
' function viewOneStudent(user,domain) {'."\n". |
|
' document.onestudent.student.value = user;'."\n". |
|
' document.onestudent.userdom.value = domain;'."\n". |
|
' document.onestudent.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n". |
|
'<input type="hidden" name="student" value="" />'."\n". |
|
'<input type="hidden" name="userdom" value="" />'."\n". |
|
'</form>'."\n"; |
|
return $jscript; |
|
} |
|
|
#------------------ End of general use routines -------------------- |
#------------------ End of general use routines -------------------- |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
|
|
#------------------------------------ Receipt Verification Routines |
#------------------------------------ Receipt Verification Routines |
|
# |
#--- Check whether a receipt number is valid.--- |
#--- Check whether a receipt number is valid.--- |
sub verifyreceipt { |
sub verifyreceipt { |
my $request = shift; |
my $request = shift; |
Line 243 sub verifyreceipt {
|
Line 232 sub verifyreceipt {
|
$symb = &Apache::lonnet::symbread($url); |
$symb = &Apache::lonnet::symbread($url); |
} |
} |
|
|
my $jscript='<script type="text/javascript" language="javascript">'."\n". |
my $title.='<h3><font color="#339933">Verifying Submission Receipt '. |
' function viewOneStudent(user,domain) {'."\n". |
$receipt.'</h3></font>'."\n". |
' document.onestudent.student.value = user;'."\n". |
|
' document.onestudent.userdom.value = domain;'."\n". |
|
' document.onestudent.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
$jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n". |
|
'<input type="hidden" name="student" value="" />'."\n". |
|
'<input type="hidden" name="userdom" value="" />'."\n". |
|
'</form>'."\n"; |
|
|
|
my $title.='<h2><font color="#339933">Verifying Submission Receipt '. |
|
$receipt.'</h2></font>'."\n". |
|
'<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br><br>'."\n"; |
'<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br><br>'."\n"; |
|
|
my ($string,$contents,$matches) = ('','',0); |
my ($string,$contents,$matches) = ('','',0); |
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0'); |
my (undef,undef,$fullname) = &getclasslist('all','0'); |
|
|
foreach (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom)=split(/\:/); |
my ($uname,$udom)=split(/\:/); |
if ($receipt eq |
if ($receipt eq |
&Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb)) { |
&Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb)) { |
Line 281 sub verifyreceipt {
|
Line 255 sub verifyreceipt {
|
if ($matches == 0) { |
if ($matches == 0) { |
$string = $title.'No match found for the above receipt.'; |
$string = $title.'No match found for the above receipt.'; |
} else { |
} else { |
$string = $jscript.$title. |
$string = &jscriptNform($url,$symb).$title. |
'The above receipt matches the following student'. |
'The above receipt matches the following student'. |
($matches <= 1 ? '.' : 's.')."\n". |
($matches <= 1 ? '.' : 's.')."\n". |
'<table border="0"><tr><td bgcolor="#777777">'."\n". |
'<table border="0"><tr><td bgcolor="#777777">'."\n". |
Line 292 sub verifyreceipt {
|
Line 266 sub verifyreceipt {
|
$contents. |
$contents. |
'</table></td></tr></table>'."\n"; |
'</table></td></tr></table>'."\n"; |
} |
} |
return $string.&show_grading_menu_form ($symb,$url); |
return $string.&show_grading_menu_form($symb,$url); |
} |
} |
|
|
#--- This is called by a number of programs. |
#--- This is called by a number of programs. |
Line 301 sub verifyreceipt {
|
Line 275 sub verifyreceipt {
|
# on the problem page. |
# on the problem page. |
sub listStudents { |
sub listStudents { |
my ($request) = shift; |
my ($request) = shift; |
|
|
|
my ($symb,$url) = &get_symb_and_url(); |
my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'}; |
my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'}; |
|
|
my $result='<h2><font color="#339933"> '. |
my $result; |
'View Submissions for a Student or a Group of Students</font></h2>'; |
my ($partlist,$handgrade) = &response_type($url); |
$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)) { |
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'); |
Line 320 sub listStudents {
|
Line 292 sub listStudents {
|
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
} |
} |
$result.='</table>'; |
$result.='</table>'; |
$request->print($result); |
|
|
|
$request->print(<<ENDTABLEST); |
my $viewgrade; |
<form action="/adm/grades" method="post"> |
if ($ENV{'form.handgrade'} eq 'yes') { |
<b>View Problem: </b><input type="radio" name="vProb" value="no" checked> no |
$viewgrade = 'View/Grade'; |
<input type="radio" name="vProb" value="yes"> yes <br /> |
} else { |
<b>Submissions: </b> |
$viewgrade = 'View'; |
<input type="radio" name="lastSub" value="hdgrade" checked /> handgrade only |
|
<input type="radio" name="lastSub" value="lastonly" /> last sub only |
|
<input type="radio" name="lastSub" value="last" /> last sub & parts info |
|
<input type="radio" name="lastSub" value="all" /> all details |
|
<input type="hidden" name="section" value="$getsec" /> |
|
<input type="hidden" name="submitonly" value="$submitonly" /> |
|
<input type="hidden" name="response" value="$ENV{'form.response'}" /> |
|
<input type="hidden" name="handgrade" value="$ENV{'form.handgrade'}" /><br /> |
|
<input type="hidden" name="showgrading" value="$ENV{'form.showgrading'}" /><br /> |
|
<input type="submit" name="submit" value="View/Grade" /> |
|
ENDTABLEST |
|
if ($ENV{'form.url'}) { |
|
$request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n"); |
|
} |
} |
if ($ENV{'form.symb'}) { |
|
$request->print('<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'."\n"); |
$result='<h3><font color="#339933"> '. |
|
$viewgrade. |
|
' Submissions for a Student or a Group of Students</font></h3>'. |
|
'<table border="0"><tr><td colspan=3><font size=+1>'. |
|
'<b>Resource: </b>'.$url.'</font></td></tr>'.$result; |
|
|
|
$request->print(<<LISTJAVASCRIPT); |
|
<script type="text/javascript" language="javascript"> |
|
function checkSelect(checkBox) { |
|
var ctr=0; |
|
var sense=""; |
|
if (checkBox.length > 1) { |
|
for (var i=0; i<checkBox.length; i++) { |
|
if (checkBox[i].checked) { |
|
ctr++; |
|
} |
|
} |
|
sense = "a student or group of students"; |
|
} else { |
|
if (checkBox.checked) { |
|
ctr = 1; |
|
} |
|
sense = "the student"; |
|
} |
|
if (ctr == 0) { |
|
alert("Please select "+sense+" before clicking on the $viewgrade button."); |
|
return false; |
} |
} |
$request->print('<input type="hidden" name="command" value="processGroup" />'."\n"); |
document.gradesub.submit(); |
|
} |
|
</script> |
|
LISTJAVASCRIPT |
|
|
|
$request->print($result); |
|
|
|
my $checkhdgrade = $ENV{'form.handgrade'} eq 'yes' ? 'checked' : ''; |
|
my $checklastsub = $ENV{'form.handgrade'} eq 'yes' ? '' : 'checked'; |
|
|
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0'); |
my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'."\n". |
|
' <b>View Problem: </b><input type="radio" name="vProb" value="no" /> no '."\n". |
|
'<input type="radio" name="vProb" value="yes" checked /> one student '."\n". |
|
'<input type="radio" name="vProb" value="all" /> all students <br />'."\n". |
|
' <b>Submissions: </b>'."\n"; |
|
if ($ENV{'form.handgrade'} eq 'yes') { |
|
$gradeTable.='<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> handgrade only'."\n"; |
|
} |
|
$gradeTable.='<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last sub only'."\n". |
|
'<input type="radio" name="lastSub" value="last" /> last sub & parts info'."\n". |
|
'<input type="radio" name="lastSub" value="all" /> all details'."\n". |
|
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
|
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
|
'<input type="hidden" name="response" value="'.$ENV{'form.response'}.'" />'."\n". |
|
'<input type="hidden" name="handgrade": #falue="'.$ENV{'form.handgrade'}.'" /><br />'."\n". |
|
'<input type="hidden" name="showgrading" value="'.$ENV{'form.showgrading'}.'" /><br />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n". |
|
'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n". |
|
' on the check boxes for the group of students.<br />'."\n". |
|
'<input type="hidden" name="command" value="processGroup" />'."\n". |
|
'<input type="button" '."\n". |
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". |
|
'value="'.$viewgrade.'" />'."\n"; |
|
|
|
my (undef,undef,$fullname) = &getclasslist($getsec,'0'); |
|
|
$result='<table border="0"><tr><td bgcolor="#777777">'. |
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<table border="0"><tr bgcolor="#e6ffff">'. |
'<td><b> Select </b></td><td><b> Fullname </b></td>'. |
'<td><b> Select </b></td><td><b> Fullname </b></td>'. |
'<td><b> Username </b></td><td><b> Domain </b></td>'; |
'<td><b> Username </b></td><td><b> Domain </b></td>'; |
foreach (sort(@$partlist)) { |
foreach (sort(@$partlist)) { |
$result.='<td><b> Part '.(split(/_/))[0].' Status </b></td>'; |
$gradeTable.='<td><b> Part '.(split(/_/))[0].' Status </b></td>'; |
} |
} |
$request->print($result.'</tr>'."\n"); |
$gradeTable.='</tr>'."\n"; |
|
|
foreach my $student (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { |
my $ctr = 0; |
|
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom) = split(/:/,$student); |
my ($uname,$udom) = split(/:/,$student); |
my (%status) = &student_gradeStatus($ENV{'form.url'}, |
my (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist); |
$ENV{'form.symb'},$udom,$uname,$partlist); |
|
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,$foo1) = 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="'. |
$gradeTable.='<input type="hidden" name="'. |
$student.':submitted_by" value="'. |
$student.':submitted_by" value="'. |
$status{'resource.'.$partid.'.submitted_by'}.'" />'); |
$status{'resource.'.$partid.'.submitted_by'}.'" />'; |
} |
} |
} |
} |
next if ($statusflg eq '' && $submitonly eq 'yes'); |
next if ($statusflg eq '' && $submitonly eq 'yes'); |
|
|
|
$ctr++; |
if ( $Apache::grades::viewgrades eq 'F' ) { |
if ( $Apache::grades::viewgrades eq 'F' ) { |
$result='<tr bgcolor="#ffffe6">'. |
$gradeTable.='<tr bgcolor="#ffffe6">'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
'<td align="center"><input type=checkbox name="stuinfo" value="'. |
$student.':'.$$fullname{$student}.'"></td>'."\n". |
$student.':'.$$fullname{$student}.'"></td>'."\n". |
'<td> '.$$fullname{$student}.' </td>'."\n". |
'<td> '.$$fullname{$student}.' </td>'."\n". |
Line 384 ENDTABLEST
|
Line 403 ENDTABLEST
|
|
|
foreach (sort keys(%status)) { |
foreach (sort keys(%status)) { |
next if (/^resource.*?submitted_by$/); |
next if (/^resource.*?submitted_by$/); |
$result.='<td align="middle"> '.$status{$_}.' </td>'."\n"; |
$gradeTable.='<td align="middle"> '.$status{$_}.' </td>'."\n"; |
} |
} |
$request->print($result.'</tr>'."\n"); |
$gradeTable.='</tr>'."\n"; |
} |
} |
} |
} |
$request->print('</table></td></tr></table>'); |
$gradeTable.='</table></td></tr></table>'. |
$request->print('<input type="submit" name="submit" value="View/Grade" /><form />'); |
'<input type="button" '. |
|
'onClick="javascript:checkSelect(this.form.stuinfo);" '. |
|
'value="'.$viewgrade.'" /></form>'."\n"; |
|
if ($ctr == 0) { |
|
$gradeTable='<br /> <font color="red">'. |
|
'No submission found for this resource.</font><br />'; |
|
} elsif ($ctr == 1) { |
|
$gradeTable =~ s/type=checkbox/type=checkbox checked/; |
|
} |
|
$gradeTable.=&show_grading_menu_form($symb,$url); |
|
$request->print($gradeTable); |
return ''; |
return ''; |
} |
} |
|
|
Line 402 sub processGroup {
|
Line 431 sub processGroup {
|
my @stuchecked = (ref($ENV{'form.stuinfo'}) ? @{$ENV{'form.stuinfo'}} |
my @stuchecked = (ref($ENV{'form.stuinfo'}) ? @{$ENV{'form.stuinfo'}} |
: ($ENV{'form.stuinfo'})); |
: ($ENV{'form.stuinfo'})); |
my $total = scalar(@stuchecked)-1; |
my $total = scalar(@stuchecked)-1; |
if ($stuchecked[0] eq '') { |
|
&userError($request,'No student was selected for viewing/grading.'); |
|
return; |
|
} |
|
foreach (@stuchecked) { |
foreach (@stuchecked) { |
my ($uname,$udom,$fullname) = split(/:/); |
my ($uname,$udom,$fullname) = split(/:/); |
$ENV{'form.student'} = $uname; |
$ENV{'form.student'} = $uname; |
Line 489 sub sub_page_js {
|
Line 515 sub sub_page_js {
|
return; |
return; |
} |
} |
|
|
|
//=================== Check that a point is assigned for all the parts ============== |
|
function checksubmit(val,total,parttot) { |
|
document.SCORE.gradeOpt.value = val; |
|
if (val == "Save & Next") { |
|
for (i=0;i<=total;i++) { |
|
for (j=0;j<parttot;j++) { |
|
var partid = eval("document.SCORE.partid"+i+"_"+j+".value"); |
|
var selopt = eval("document.SCORE.GD_SEL"+i+"_"+partid); |
|
if (selopt[0].selected) { |
|
var points = eval("document.SCORE.GD_BOX"+i+"_"+partid+".value"); |
|
if (points == "") { |
|
var name = eval("document.SCORE.name"+i+".value"); |
|
alert("Please assign a score for "+name+", part "+partid+"."); |
|
return false; |
|
} |
|
} |
|
|
|
} |
|
} |
|
|
|
} |
|
document.SCORE.submit(); |
|
} |
|
|
//===================== Show list of keywords ==================== |
//===================== Show list of keywords ==================== |
function keywords(keyform) { |
function keywords(keyform) { |
var keywds = keyform.value; |
var keywds = keyform.value; |
Line 519 sub sub_page_js {
|
Line 569 sub sub_page_js {
|
else return; |
else return; |
var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," "); |
var cleantxt = txt.replace(new RegExp('([\\f\\n\\r\\t\\v ])+', 'g')," "); |
if (cleantxt=="") { |
if (cleantxt=="") { |
alert("Select a word or group of words from document and then click this link."); |
alert("Please select a word or group of words from document and then click this link."); |
return; |
return; |
} |
} |
var nret = prompt("Add selection to keyword list? Edit if desired.",cleantxt); |
var nret = prompt("Add selection to keyword list? Edit if desired.",cleantxt); |
Line 622 sub sub_page_js {
|
Line 672 sub sub_page_js {
|
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td>Subject</td>"); |
pWin.document.write("<td>Subject</td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"subchk\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+" \\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pWin.document.write("<td><input name=\\"msgsub\\" type=\\"text\\" value=\\""+msg+"\\"size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
} |
} |
|
|
function displaySavedMsg(ctr,msg,shwsel) { |
function displaySavedMsg(ctr,msg,shwsel) { |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<tr bgcolor=\\"#ffffdd\\">"); |
pWin.document.write("<td align=\\"center\\">"+ctr+"</td>"); |
pWin.document.write("<td align=\\"center\\">"+ctr+"</td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td align=\\"center\\"><input name=\\"msgn"+ctr+"\\" type=\\"checkbox\\"" +shwsel+"></td>"); |
pWin.document.write("<td><input name=\\"msg"+ctr+"\\" type=\\"text\\" value=\\""+msg+" \\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
pWin.document.write("<td><input name=\\"msg"+ctr+"\\" type=\\"text\\" value=\\""+msg+"\\" size=\\"60\\" maxlength=\\"80\\"></td></tr>"); |
} |
} |
|
|
function newMsg(newmsg,shwsel) { |
function newMsg(newmsg,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\\" onchange=\\"javascript:this.form.newmsgchk.checked=true\\" 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 746 SUBJAVASCRIPT
|
Line 796 SUBJAVASCRIPT
|
} |
} |
|
|
|
|
|
sub show_problem { |
|
my ($request,$symb,$uname,$udom,$removeform) = @_; |
|
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
|
$ENV{'request.course.id'}); |
|
if ($removeform) { |
|
$rendered=~s|<form(.*?)>||g; |
|
$rendered=~s|</form>||g; |
|
$rendered=~s|name="submit"|name="would_have_been_submit"|g; |
|
} |
|
my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
|
$ENV{'request.course.id'}); |
|
if ($removeform) { |
|
$companswer=~s|<form(.*?)>||g; |
|
$companswer=~s|</form>||g; |
|
$rendered=~s|name="submit"|name="would_have_been_submit"|g; |
|
} |
|
my $result.='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
|
$result.='<table border="0" width="100%"><tr><td bgcolor="#e6ffff">'; |
|
$result.='<b> View of the problem - '.$ENV{'form.fullname'}. |
|
'</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
|
$result.='<b>Correct answer:</b><br />'.$companswer; |
|
$result.='</td></tr></table>'; |
|
$result.='</td></tr></table><br />'; |
|
$request->print($result); |
|
} |
|
|
# --------------------------- show submissions of a student, option to grade |
# --------------------------- show submissions of a student, option to grade |
sub submission { |
sub submission { |
my ($request,$counter,$total) = @_; |
my ($request,$counter,$total) = @_; |
Line 760 sub submission {
|
Line 836 sub submission {
|
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))); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
$ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes'; |
# $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes'; |
my ($classlist,$seclist,$ids,$stusec,$fullname); |
|
|
|
# header info |
# header info |
if ($counter == 0) { |
if ($counter == 0) { |
&sub_page_js($request); |
&sub_page_js($request); |
$request->print('<h2> <font color="#339933">Submission Record</font></h2>'. |
$request->print('<h3> <font color="#339933">Submission Record</font></h3>'."\n". |
'<font size=+1> <b>Resource: </b>'.$url.'</font>'); |
'<font size=+1> <b>Resource: </b>'.$url.'</font>'."\n"); |
|
|
# option to display problem, only once else it cause problems |
# option to display problem, only once else it cause problems |
# with the form later since the problem has a form. |
# with the form later since the problem has a form. |
if ($ENV{'form.vProb'} eq 'yes') { |
if ($ENV{'form.vProb'} eq 'yes') { |
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, |
&show_problem($request,$symb,$uname,$udom,0); |
$ENV{'request.course.id'}); |
|
my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, |
|
$ENV{'request.course.id'}); |
|
my $result.='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
|
$result.='<table border="0" width="100%"><tr><td bgcolor="#e6ffff">'; |
|
$result.='<b> View of the problem for '.$ENV{'form.fullname'}. |
|
'</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />'; |
|
$result.='<b>Correct answer:</b><br />'.$companswer; |
|
$result.='</td></tr></table>'; |
|
$result.='</td></tr></table><br />'; |
|
$request->print($result); |
|
} |
} |
|
|
# kwclr is the only variable that is guaranteed to be non blank |
# kwclr is the only variable that is guaranteed to be non blank |
Line 846 KEYWORDS
|
Line 910 KEYWORDS
|
} |
} |
} |
} |
|
|
|
if ($ENV{'form.vProb'} eq 'all') { |
|
$request->print('<br /><br /><br />'); |
|
&show_problem($request,$symb,$uname,$udom,1); |
|
} |
|
|
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); |
my ($partlist,$handgrade) = &response_type($url); |
my ($partlist,$handgrade) = &response_type($url); |
|
|
# Display student info |
# Display student info |
$request->print(($counter == 0 ? '' : '<br />')); |
$request->print(($counter == 0 ? '' : '<br />')); |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'. |
my $result='<table border="0" width=100%><tr><td bgcolor="#777777">'."\n". |
'<table border="0" width=100%><tr bgcolor="#edffff"><td>'; |
'<table border="0" width=100%><tr bgcolor="#edffff"><td>'."\n"; |
|
|
# $result.='<table border="0"><tr bgcolor="#ffffff"><td><b>Fullname: </b>'.$ENV{'form.fullname'}. |
|
$result.='<b>Fullname: </b>'.$ENV{'form.fullname'}. |
$result.='<b>Fullname: </b>'.$ENV{'form.fullname'}. |
'<font color="#999999"> Username: '.$uname.'</font>'. |
'<font color="#999999"> Username: '.$uname.'</font>'. |
'<font color="#999999"> Domain: '.$udom.'</font><br />'; |
'<font color="#999999"> Domain: '.$udom.'</font><br />'."\n"; |
|
$result.='<input type="hidden" name="name'.$counter. |
|
'" value="'.$ENV{'form.fullname'}.'" />'."\n"; |
|
|
# If this is handgraded, then check for collaborators |
# If this is handgraded, then check for collaborators |
my $col_flag = 0; |
my @col_fullnames; |
|
my ($classlist,$fullname); |
if ($ENV{'form.handgrade'} eq 'yes') { |
if ($ENV{'form.handgrade'} eq 'yes') { |
my @col_list; |
my @col_list; |
($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0'); |
($classlist,undef,$fullname) = &getclasslist('all','0'); |
for (keys (%$handgrade)) { |
for (keys (%$handgrade)) { |
my $ncol = &Apache::lonnet::EXT('resource.'.$_. |
my $ncol = &Apache::lonnet::EXT('resource.'.$_. |
'.maxcollaborators',$symb,$udom,$uname); |
'.maxcollaborators', |
if ($ncol > 0) { |
$symb,$udom,$uname); |
s/\_/\./g; |
next if ($ncol <= 0); |
if ($record{'resource.'.$_.'.collaborators'} ne '') { |
s/\_/\./g; |
my (@collaborators) = split(/,?\s+/, |
next if ($record{'resource.'.$_.'.collaborators'} eq ''); |
$record{'resource.'.$_.'.collaborators'}); |
my (@collaborators) = split(/,?\s+/, |
my (@badcollaborators); |
$record{'resource.'.$_.'.collaborators'}); |
if (scalar(@collaborators) != 0) { |
my (@badcollaborators); |
$result.='<b>Collaborators: </b>'; |
if (scalar(@collaborators) != 0) { |
foreach my $collaborator (@collaborators) { |
$result.='<b>Collaborators: </b>'; |
$collaborator = $collaborator =~ /\@|:/ ? |
foreach my $collaborator (@collaborators) { |
(split(/@|:/,$collaborator))[0] : $collaborator; |
my ($co_name,$co_dom) = split /\@|:/,$collaborator; |
next if ($collaborator eq $uname); |
$co_dom = $udom if (! defined($co_dom)); |
if (!grep /^$collaborator:/i,keys %$classlist) { |
next if ($co_name eq $uname && $co_dom eq $udom); |
push @badcollaborators,$collaborator; |
# Doing this grep allows 'fuzzy' specification |
next; |
my @Matches = grep /^$co_name:$co_dom/i, |
} |
keys %$classlist; |
$col_flag++; |
if (! scalar(@Matches)) { |
push @col_list, $collaborator; |
push @badcollaborators,$collaborator; |
$result.=$$fullname{$collaborator.':'.$udom}.' '; |
next; |
} |
} |
$result.='<br />'."\n"; |
push @col_list, @Matches; |
$result.='<table border="0"><tr bgcolor="#ffbbbb"><td>'. |
foreach (@Matches) { |
'This student has submitted '. |
my ($lastname,$givenn) = split(/,/,$$fullname{$_}); |
(scalar (@badcollaborators) > 1 ? '' : 'an'). |
push @col_fullnames, $givenn.' '.$lastname; |
' invalid collaborator'.(scalar (@badcollaborators) > 1 ? 's. ' : '. '). |
$result.=$$fullname{$_}.' '; |
(join ', ',@badcollaborators).'</td></tr></table>' |
} |
if (scalar(@badcollaborators) > 0); |
} |
|
$result.='<br />'."\n"; |
$result.='<table border="0"><tr bgcolor="#ffbbbb"><td>'. |
if (scalar(@badcollaborators) > 0) { |
'This student has submitted too many collaborators. Maximum is '. |
$result.='<table border="0"><tr bgcolor="#ffbbbb"><td>'; |
$ncol.'.</td></tr></table>' if (scalar(@collaborators) > $ncol); |
$result.='This student has submitted '; |
$result.='<input type="hidden" name="collaborator'.$counter. |
if (scalar(@badcollaborators) == 1) { |
'" value="'.(join ':',@col_list).'" />'."\n"; |
$result .= 'an invalid collaborator'; |
} |
} else { |
} |
$result .= 'invalid collaborators'; |
} |
} |
|
$result .= ': '.join(', ',@badcollaborators); |
|
|
|
} |
|
if (scalar(@collaborators > $ncol)) { |
|
$result .= '<table border="0"><tr bgcolor="#ffbbbb"><td>'; |
|
$result .= 'This student has sumbitted too many '. |
|
'collaborators. Maximum is '.$ncol; |
|
$result .= '</td></tr></table>'; |
|
} |
|
$result.='<input type="hidden" name="collaborator'.$counter. |
|
'" value="'.(join ':',@col_list).'" />'."\n"; |
|
} |
} |
} |
} |
} |
$request->print($result."\n"); |
$request->print($result."\n"); |
Line 924 KEYWORDS
|
Line 1007 KEYWORDS
|
$request->print($submitby); |
$request->print($submitby); |
} else { |
} else { |
my ($string,$timestamp)= |
my ($string,$timestamp)= |
&get_last_submission ($symb,$uname,$udom,$ENV{'request.course.id'}); |
&get_last_submission (%record); |
my $lastsubonly.=''. |
my $lastsubonly.=''. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
$$timestamp).''; |
$$timestamp).''; |
if ($$timestamp eq '') { |
if ($$timestamp eq '') { |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0].'</td></tr>'; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0].'</td></tr>'."\n"; |
} else { |
} else { |
for my $part (sort keys(%$handgrade)) { |
for my $part (sort keys(%$handgrade)) { |
foreach (@$string) { |
foreach (@$string) { |
Line 939 KEYWORDS
|
Line 1022 KEYWORDS
|
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part '. |
$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part '. |
$partid.'</b> <font color="#999999">( ID '.$respid. |
$partid.'</b> <font color="#999999">( ID '.$respid. |
' )</font> <b>Answer: </b>'. |
' )</font> <b>Answer: </b>'. |
&keywords_highlight($subval).'</td></tr>' |
&keywords_highlight($subval).'</td></tr>'."\n" |
if ($ENV{'form.lastSub'} eq 'lastonly' || |
if ($ENV{'form.lastSub'} eq 'lastonly' || |
($ENV{'form.lastSub'} eq 'hdgrade' && |
($ENV{'form.lastSub'} eq 'hdgrade' && |
$$handgrade{$part} =~ /:yes$/)); |
$$handgrade{$part} =~ /:yes$/)); |
Line 947 KEYWORDS
|
Line 1030 KEYWORDS
|
} |
} |
} |
} |
} |
} |
$lastsubonly.='</td></tr><tr><td bgcolor="#ffffff">'."\n"; |
$lastsubonly.='</td></tr>'."\n"; |
$request->print($lastsubonly); |
$request->print($lastsubonly); |
} |
} |
} else { |
} else { |
Line 959 KEYWORDS
|
Line 1042 KEYWORDS
|
|
|
# return if view submission with no grading option |
# return if view submission with no grading option |
if ($ENV{'form.showgrading'} eq '') { |
if ($ENV{'form.showgrading'} eq '') { |
$request->print('</td></tr></table></td></tr></table></form>'); |
$request->print('</td></tr></table></td></tr></table></form>'."\n"); |
return; |
return; |
} |
} |
|
|
# Grading options |
# Grading options |
$result='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n". |
$result='<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n". |
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'.$udom.'" />'."\n"; |
'<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':' |
$result.=' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
.$udom.'" />'."\n"; |
',\''.$ENV{'form.fullname'}.'\')"; TARGET=_self>'. |
my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'}); |
'Compose Message to student'.($col_flag > 1 ? 's' : '').'</a>'. |
my $msgfor = $givenn.' '.$lastname; |
|
if (scalar(@col_fullnames) > 0) { |
|
my $lastone = pop @col_fullnames; |
|
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.'; |
|
} |
|
$result.='<tr><td bgcolor="#ffffff">'."\n". |
|
' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
|
',\''.$msgfor.'\')"; TARGET=_self>'. |
|
'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').'</a>'. |
'<br /> (Message will be sent when you click on Save & Next below.)'."\n" |
'<br /> (Message will be sent when you click on Save & Next below.)'."\n" |
if ($ENV{'form.handgrade'} eq 'yes'); |
if ($ENV{'form.handgrade'} eq 'yes'); |
$request->print($result); |
$request->print($result); |
Line 1018 KEYWORDS
|
Line 1109 KEYWORDS
|
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. |
',this.form.GD_BOX'.$counter.'_'.$partid. |
',this.form.GD_BOX'.$counter.'_'.$partid. |
',this.form.GD_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>'. |
if ($record{'resource.'.$partid.'.solved'} eq 'excused') { |
'<option>excused</option></select>'."  \n"; |
$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.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="0" />'; |
$result.='</td></tr></table>'; |
$result.='</td></tr></table>'."\n"; |
$request->print($result); |
$request->print($result); |
} |
} |
$request->print('<input type="hidden" name="partlist'.$counter.'" value="'.(join ":",@partlist).'" />'."\n"); |
$result='<input type="hidden" name="partlist'.$counter. |
$request->print('</td></tr></table></td></tr></table>'."\n"); |
'" value="'.(join ":",@partlist).'" />'."\n"; |
|
my $ctr = 0; |
|
while ($ctr < scalar(@partlist)) { |
|
$result.='<input type="hidden" name="partid'.$counter.'_'.$ctr.'" value="'. |
|
$partlist[$ctr].'" />'."\n"; |
|
$ctr++; |
|
} |
|
$request->print($result.'</td></tr></table></td></tr></table>'."\n"); |
|
|
# print end of form |
# print end of form |
if ($counter == $total) { |
if ($counter == $total) { |
my $endform.='<table border="0"><tr><td><input type="submit" name="gradeOpt" value="Save & Next" />'; |
my $endform='<table border="0"><tr><td>'. |
my $ntstu ='<select name="NTSTU">'. |
'<input type="hidden" name="gradeOpt" value="" />'."\n"; |
'<option>1</option><option>2</option>'. |
if ($ENV{'form.handgrade'} eq 'yes') { |
'<option>3</option><option>5</option>'. |
$endform.='<input type="button" value="Save & Next" '. |
'<option>7</option><option>10</option></select>'."\n"; |
'onClick="javascript:checksubmit(\'Save & Next\','. |
my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); |
$total.','.scalar(@partlist).');" TARGET=_self> '."\n"; |
$ntstu =~ s/<option>$nsel</<option selected="on">$nsel</; |
my $ntstu ='<select name="NTSTU">'. |
$endform.=$ntstu.'student(s) '. |
'<option>1</option><option>2</option>'. |
'<input type="submit" name="gradeOpt" value="Next" /> '. |
'<option>3</option><option>5</option>'. |
'<input type="submit" name="gradeOpt" value="Previous" /> '. |
'<option>7</option><option>10</option></select>'."\n"; |
'(Next and Previous do not save the scores.)'. |
my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); |
'</td><tr></table></form>'; |
$ntstu =~ s/<option>$nsel</<option selected="on">$nsel</; |
|
$endform.=$ntstu.'student(s) '; |
|
} else { |
|
$endform.='<input type="hidden" name="NTSTU" value="1" />'."\n"; |
|
} |
|
$endform.='<input type="button" value="Next" '. |
|
'onClick="javascript:checksubmit(\'Next\');" TARGET=_self> '."\n". |
|
'<input type="button" value="Previous" '. |
|
'onClick="javascript:checksubmit(\'Previous\');" TARGET=_self> '; |
|
$endform.='(Next and Previous do not save the scores.)'."\n" |
|
if ($ENV{'form.handgrade'} eq 'yes'); |
|
$endform.='</td><tr></table></form>'; |
|
$endform.=&show_grading_menu_form($symb,$url); |
$request->print($endform); |
$request->print($endform); |
} |
} |
return ''; |
return ''; |
Line 1049 KEYWORDS
|
Line 1165 KEYWORDS
|
|
|
#--- Retrieve the last submission for all the parts |
#--- Retrieve the last submission for all the parts |
sub get_last_submission { |
sub get_last_submission { |
my ($symb,$username,$domain,$course)=@_; |
my (%returnhash)=@_; |
if ($symb) { |
my (@string,$timestamp); |
my (@string,$timestamp); |
if ($returnhash{'version'}) { |
my (%returnhash)=&Apache::lonnet::restore($symb,$course,$domain,$username); |
my %lasthash=(); |
if ($returnhash{'version'}) { |
my ($version); |
my %lasthash=(); |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
my ($version); |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
# if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$timestamp = scalar(localtime($returnhash{$version.':timestamp'})); |
} |
# } |
} |
} |
foreach ((keys %lasthash)) { |
} |
if ($_ =~ /\.submission$/) { |
foreach ((keys %lasthash)) { |
my ($partid,$foo) = split(/submission$/,$_); |
if ($_ =~ /\.submission$/) { |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
my ($partid,$foo) = split(/submission$/,$_); |
'<font color="red">Draft Copy</font> ' : ''; |
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? |
push @string, (join(':',$_,$draft.$lasthash{$_})); |
'<font color="red">Draft Copy</font> ' : ''; |
} |
push @string, (join(':',$_,$draft.$lasthash{$_})); |
if ($_ =~ /timestamp/) {$timestamp = scalar(localtime($lasthash{$_}))}; |
|
} |
} |
} |
} |
@string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; |
|
return \@string,\$timestamp; |
|
} |
} |
|
@string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; |
|
return \@string,\$timestamp; |
} |
} |
|
|
#--- High light keywords, with style choosen by user. |
#--- High light keywords, with style choosen by user. |
Line 1084 sub keywords_highlight {
|
Line 1199 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) { |
$string =~ s/\b$_(\b|\.)/\<font color\=$ENV{'form.kwclr'} $size\>$styleon$_$styleoff\<\/font\>/gi; |
$string =~ s/\b\Q$_\E(\b|\.)/\<font color\=$ENV{'form.kwclr'} $size\>$styleon$_$styleoff\<\/font\>/gi; |
} |
} |
|
# This is not really the right place to do this, but I cannot find a |
|
# better one at this time. So here we go - the m in the s:::mg causes |
|
# ^ to match the beginning of a new line. So we replace(???) the beginning |
|
# of the line with <br /> to make things formatted a little better. |
|
$string =~ s:^:<br />:mg; |
return $string; |
return $string; |
} |
} |
|
|
Line 1102 sub processHandGrade {
|
Line 1222 sub processHandGrade {
|
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}); |
my ($errorflg) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); |
my ($errorflag) = &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) = ('','',''); |
if ($includemsg =~ /savemsg|new$ctr/) { |
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) { |
$subject = $ENV{'form.msgsub'} if ($includemsg =~ /^msgsub/); |
$subject = $ENV{'form.msgsub'} if ($includemsg =~ /^msgsub/); |
my (@msgnum) = split(/,/,$includemsg); |
my (@msgnum) = split(/,/,$includemsg); |
foreach (@msgnum) { |
foreach (@msgnum) { |
Line 1195 sub processHandGrade {
|
Line 1314 sub processHandGrade {
|
$laststu = $firststu if ($ctr > $ngrade); |
$laststu = $firststu if ($ctr > $ngrade); |
} |
} |
|
|
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
my (@parsedlist,@nextlist); |
my (@parsedlist,@nextlist); |
my ($nextflg) = 0; |
my ($nextflg) = 0; |
foreach (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
if ($nextflg == 1 && $button =~ /Next$/) { |
if ($nextflg == 1 && $button =~ /Next$/) { |
push @parsedlist,$_; |
push @parsedlist,$_; |
} |
} |
Line 1257 sub saveHandGrade {
|
Line 1376 sub saveHandGrade {
|
my %newrecord; |
my %newrecord; |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { |
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') { |
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') { |
$newrecord{'resource.'.$_.'.solved'} = 'excused' |
if ($record{'resource.'.$_.'.solved'} ne 'excused') { |
if ($record{'resource.'.$_.'.solved'} ne 'excused'); |
$newrecord{'resource.'.$_.'.solved'} = 'excused'; |
|
if (exists($record{'resource.'.$_.'.awarded'})) { |
|
$newrecord{'resource.'.$_.'.awarded'} = ''; |
|
} |
|
} |
} else { |
} else { |
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? |
$ENV{'form.GD_BOX'.$newflg.'_'.$_} : |
$ENV{'form.GD_BOX'.$newflg.'_'.$_} : |
$ENV{'form.RADVAL'.$newflg.'_'.$_}); |
$ENV{'form.RADVAL'.$newflg.'_'.$_}); |
if ($pts eq '') { |
|
&userError($request,'No point was assigned for part '.$_. |
|
' and for username '.$stuname.'.'); |
|
return 'error'; |
|
} |
|
my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : |
$ENV{'form.WGT'.$newflg.'_'.$_}; |
$ENV{'form.WGT'.$newflg.'_'.$_}; |
my $partial= $pts/$wgt; |
my $partial= $pts/$wgt; |
Line 1304 sub viewgrades_js {
|
Line 1422 sub viewgrades_js {
|
|
|
$request->print(<<VIEWJAVASCRIPT); |
$request->print(<<VIEWJAVASCRIPT); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function viewOneStudent(user,domain) { |
function writePoint(partid,weight,point) { |
document.onestudent.student.value = user; |
|
document.onestudent.userdom.value = domain; |
|
document.onestudent.submit(); |
|
} |
|
|
|
function writePoint(partid,weight,point) { |
|
var radioButton = eval("document.classgrade.RADVAL_"+partid); |
var radioButton = eval("document.classgrade.RADVAL_"+partid); |
var textbox = eval("document.classgrade.TEXTVAL_"+partid); |
var textbox = eval("document.classgrade.TEXTVAL_"+partid); |
if (point == "textval") { |
if (point == "textval") { |
Line 1350 sub viewgrades_js {
|
Line 1462 sub viewgrades_js {
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.ctr"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var scorename = eval("document.classgrade.GD_"+user+ |
var scorename = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_aw"); |
"_"+partid+"_awarded"); |
var saveval = eval("document.classgrade.GD_"+user+ |
var saveval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_sv_s.value"); |
"_"+partid+"_solved_s.value"); |
var selname = eval("document.classgrade.GD_"+user+"_"+partid+"_sv"); |
var selname = eval("document.classgrade.GD_"+user+"_"+partid+"_solved"); |
if (saveval != "correct") { |
if (saveval != "correct") { |
scorename.value = point; |
scorename.value = point; |
if (selname[0].selected != true) { |
if (selname[0].selected != true) { |
Line 1379 sub viewgrades_js {
|
Line 1491 sub viewgrades_js {
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.ctr"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var scorename = eval("document.classgrade.GD_"+user+ |
var scorename = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_aw"); |
"_"+partid+"_awarded"); |
var saveval = eval("document.classgrade.GD_"+user+ |
var saveval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_sv_s.value"); |
"_"+partid+"_solved_s.value"); |
var selname = eval("document.classgrade.GD_"+user+ |
var selname = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_sv"); |
"_"+partid+"_solved"); |
if (saveval != "correct") { |
if (saveval != "correct") { |
scorename.value = ""; |
scorename.value = ""; |
selname[1].selected = true; |
selname[1].selected = true; |
Line 1393 sub viewgrades_js {
|
Line 1505 sub viewgrades_js {
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.ctr"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var scorename = eval("document.classgrade.GD_"+user+ |
var scorename = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_aw"); |
"_"+partid+"_awarded"); |
var saveval = eval("document.classgrade.GD_"+user+ |
var saveval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_sv_s.value"); |
"_"+partid+"_solved_s.value"); |
var selname = eval("document.classgrade.GD_"+user+ |
var selname = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_sv"); |
"_"+partid+"_solved"); |
if (saveval != "correct") { |
if (saveval != "correct") { |
scorename.value = eval("document.classgrade.GD_"+user+ |
scorename.value = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_aw_s.value");; |
"_"+partid+"_awarded_s.value");; |
selname[0].selected = true; |
selname[0].selected = true; |
} |
} |
} |
} |
Line 1408 sub viewgrades_js {
|
Line 1520 sub viewgrades_js {
|
} |
} |
|
|
function changeSelect(partid,user) { |
function changeSelect(partid,user) { |
var selval = eval("document.classgrade.GD_"+user+'_'+partid+"_sv"); |
var selval = eval("document.classgrade.GD_"+user+'_'+partid+"_solved"); |
var textbox = eval("document.classgrade.GD_"+user+'_'+partid+"_aw"); |
var textbox = eval("document.classgrade.GD_"+user+'_'+partid+"_awarded"); |
var point = textbox.value; |
var point = textbox.value; |
var weight = eval("document.classgrade.weight_"+partid+".value"); |
var weight = eval("document.classgrade.weight_"+partid+".value"); |
|
|
Line 1430 sub viewgrades_js {
|
Line 1542 sub viewgrades_js {
|
} |
} |
|
|
function changeOneScore(partid,user) { |
function changeOneScore(partid,user) { |
var selval = eval("document.classgrade.GD_"+user+'_'+partid+"_sv"); |
var selval = eval("document.classgrade.GD_"+user+'_'+partid+"_solved"); |
if (selval[1].selected) { |
if (selval[1].selected) { |
var boxval = eval("document.classgrade.GD_"+user+'_'+partid+"_aw"); |
var boxval = eval("document.classgrade.GD_"+user+'_'+partid+"_awarded"); |
boxval.value = ""; |
boxval.value = ""; |
} |
} |
} |
} |
Line 1453 sub viewgrades_js {
|
Line 1565 sub viewgrades_js {
|
for (i=0;i<document.classgrade.total.value;i++) { |
for (i=0;i<document.classgrade.total.value;i++) { |
var user = eval("document.classgrade.ctr"+i+".value"); |
var user = eval("document.classgrade.ctr"+i+".value"); |
var resetscore = eval("document.classgrade.GD_"+user+ |
var resetscore = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_aw"); |
"_"+partid+"_awarded"); |
resetscore.value = eval("document.classgrade.GD_"+user+ |
resetscore.value = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_aw_s.value"); |
"_"+partid+"_awarded_s.value"); |
|
|
var saveselval = eval("document.classgrade.GD_"+user+ |
var saveselval = eval("document.classgrade.GD_"+user+ |
"_"+partid+"_sv_s.value"); |
"_"+partid+"_solved_s.value"); |
|
|
var selname = eval("document.classgrade.GD_"+user+"_"+partid+"_sv"); |
var selname = eval("document.classgrade.GD_"+user+"_"+partid+"_solved"); |
if (saveselval == "excused") { |
if (saveselval == "excused") { |
if (selname[1].selected == false) { selname[1].selected = true;} |
if (selname[1].selected == false) { selname[1].selected = true;} |
} else { |
} else { |
Line 1480 sub viewgrades {
|
Line 1592 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'}); |
my $result='<h2><font color="#339933">Manual Grading</font></h2>'; |
my $result='<h3><font color="#339933">Manual Grading</font></h3>'; |
|
|
$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.=&jscriptNform($url,$symb); |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
|
'<input type="hidden" name="command" value="submission" />'."\n". |
|
'<input type="hidden" name="student" value="" />'."\n". |
|
'<input type="hidden" name="userdom" value="" />'."\n". |
|
'</form>'."\n"; |
|
|
|
#beginning of class grading form |
#beginning of class grading form |
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n". |
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n". |
Line 1499 sub viewgrades {
|
Line 1605 sub viewgrades {
|
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n"; |
'<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n"; |
|
$result.='<h3>Assign Common Grade To '; |
$result.='To assign the same score for all the students use the radio buttons or '. |
if ($ENV{'form.section'} eq 'all') { |
'text box below. To assign scores individually fill in the score boxes for '. |
$result.='Class </h3>'; |
'each student in the table below. <font color="red">A part that has already '. |
} elsif ($ENV{'form.section'} eq 'no') { |
'been graded does not get changed using the radio buttons or text box. '. |
$result.='Students in no Section </h3>'; |
'If needed, it has to be changed individually.</font>'; |
} else { |
|
$result.='Students in Section '.$ENV{'form.section'}.'</h3>'; |
|
} |
|
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
|
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
|
# $result.='To assign the same score for all the students use the radio buttons or '. |
|
# 'text box below. To assign scores individually fill in the score boxes for '. |
|
# 'each student in the table below. <font color="red">A part that has already '. |
|
# 'been graded does not get changed using the radio buttons or text box. '. |
|
# 'If needed, it has to be changed individually.</font>'; |
|
# $result.='</td></tr><tr><td>'; |
#radio buttons/text box for assigning points for a section or class. |
#radio buttons/text box for assigning points for a section or class. |
#handles different parts of a problem |
#handles different parts of a problem |
my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); |
my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); |
my %weight = (); |
my %weight = (); |
my $ctsparts = 0; |
my $ctsparts = 0; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
|
my %seen = (); |
for (sort keys(%$handgrade)) { |
for (sort keys(%$handgrade)) { |
|
my ($partid,$respid) = split (/_/,$_,2); |
|
next if $seen{$partid}; |
|
$seen{$partid}++; |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
my ($partid,$respid) = split (/_/); |
|
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
$weight{$partid} = $wgt eq '' ? '1' : $wgt; |
|
|
Line 1527 sub viewgrades {
|
Line 1645 sub viewgrades {
|
my $ctr = 0; |
my $ctr = 0; |
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across |
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across |
$result.= '<td><input type="radio" name="RADVAL_'.$partid.'" '. |
$result.= '<td><input type="radio" name="RADVAL_'.$partid.'" '. |
'onclick="javascript:writePoint('.$partid.','.$weight{$partid}. |
'onclick="javascript:writePoint(\''.$partid.'\','.$weight{$partid}. |
','.$ctr.')" />'.$ctr."</td>\n"; |
','.$ctr.')" />'.$ctr."</td>\n"; |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); |
$ctr++; |
$ctr++; |
} |
} |
$result.='</tr></table>'; |
$result.='</tr></table>'; |
$result.= '</td><td><b> or </b><input type="text" name="TEXTVAL_'. |
$result.= '</td><td><b> or </b><input type="text" name="TEXTVAL_'. |
$partid.'" size="4" '. |
$partid.'" size="4" '.'onChange="javascript:writePoint(\''. |
'onChange="javascript:writePoint('.$partid.','.$weight{$partid}. |
$partid.'\','.$weight{$partid}.',\'textval\')" /> /'. |
',\'textval\')" /> /'. |
|
$weight{$partid}.' (problem weight)</td>'."\n"; |
$weight{$partid}.' (problem weight)</td>'."\n"; |
$result.= '</td><td><select name="SELVAL_'.$partid.'"'. |
$result.= '</td><td><select name="SELVAL_'.$partid.'"'. |
'onChange="javascript:writeRadText('.$partid.','.$weight{$partid}.')" /> '. |
'onChange="javascript:writeRadText(\''.$partid.'\','. |
|
$weight{$partid}.')"> '. |
'<option selected="on"> </option>'. |
'<option selected="on"> </option>'. |
'<option>excused</option></select></td></tr>'."\n"; |
'<option>excused</option></select></td></tr>'."\n"; |
$ctsparts++; |
$ctsparts++; |
} |
} |
$result.='</table><input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; |
$result.='</table>'.'</td></tr></table>'.'</td></tr></table>'."\n". |
|
'<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" '. |
$result.='<input type="button" value="Submit Changes" '. |
# 'onClick="submit();" TARGET=_self />'."\n"; |
'onClick="javascript:submit();" TARGET=_self />'."\n"; |
$result.= '<input type="submit" name="submit" value="Submit Changes" />'."\n"; |
|
|
|
#table listing all the students in a section/class |
#table listing all the students in a section/class |
#header of table |
#header of table |
|
$result.= '<h3>Assign Grade to Specific Students in '; |
|
if ($ENV{'form.section'} eq 'all') { |
|
$result.='the Class </h3>'; |
|
} elsif ($ENV{'form.section'} eq 'no') { |
|
$result.='no Section </h3>'; |
|
} else { |
|
$result.='Section '.$ENV{'form.section'}.'</h3>'; |
|
} |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
'<table border=0><tr bgcolor="#deffff">'. |
'<table border=0><tr bgcolor="#deffff">'. |
'<td><b>Fullname</b></td><td><b>Username</b></td><td><b>Domain</b></td>'."\n"; |
'<td><b>Fullname</b></td><td><b>Username</b></td><td><b>Domain</b></td>'."\n"; |
my (@parts) = sort(&getpartlist($url)); |
my (@parts) = sort(&getpartlist($url)); |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
next if ($display =~ /^Number of Attempts/); |
|
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
if ($display =~ /^Partial Credit Factor/) { |
if ($display =~ /^Partial Credit Factor/) { |
$_ = $display; |
my ($partid) = &split_part_type($part); |
my ($partid) = /.*?(\d+).*/; |
$result.='<td><b>Score Part '.$partid.'<br />(weight = '. |
$result.='<td><b>Score Part '.$partid.'<br>(weight = '. |
|
$weight{$partid}.')</b></td>'."\n"; |
$weight{$partid}.')</b></td>'."\n"; |
next; |
next; |
} |
} |
$display =~ s/Problem Status/Grade Status<br>/; |
$display =~ s|Problem Status|Grade Status<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 |
#list all the students - with points and grade status |
#list all the students - with points and grade status |
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
my $ctr = 0; |
my $ctr = 0; |
foreach (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { |
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { |
my ($uname,$udom) = split(/:/); |
my ($uname,$udom) = split(/:/); |
$result.='<input type="hidden" name="ctr'.$ctr.'" value="'.$uname.'" />'."\n"; |
$result.='<input type="hidden" name="ctr'.$ctr.'" value="'.$uname.'" />'."\n"; |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'}, |
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'}, |
Line 1586 sub viewgrades {
|
Line 1710 sub viewgrades {
|
} |
} |
$result.='</table></td></tr></table>'; |
$result.='</table></td></tr></table>'; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; |
$result.='<input type="submit" name="submit" value="Submit Changes" /></form>'; |
$result.='<input type="button" value="Submit Changes" '. |
|
'onClick="javascript:submit();" TARGET=_self /></form>'."\n"; |
$result.=&show_grading_menu_form($symb,$url); |
$result.=&show_grading_menu_form($symb,$url); |
return $result; |
return $result; |
} |
} |
Line 1601 sub viewstudentgrade {
|
Line 1726 sub viewstudentgrade {
|
'\')"; TARGET=_self>'.$fullname.'</a>'. |
'\')"; TARGET=_self>'.$fullname.'</a>'. |
'</td><td>'.$uname.'</td><td align="middle">'.$udom.'</td>'."\n"; |
'</td><td>'.$uname.'</td><td align="middle">'.$udom.'</td>'."\n"; |
foreach my $part (@$parts) { |
foreach my $part (@$parts) { |
my ($temp,$part,$type)=split(/_/,$part); |
my ($part,$type) = &split_part_type($part); |
my $score=$record{"resource.$part.$type"}; |
my $score=$record{"resource.$part.$type"}; |
next if $type eq 'tries'; |
|
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="'. |
'GD_'.$uname.'_'.$part.'_aw_s" value="'.$pts.'" />'."\n"; |
'GD_'.$uname.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n"; |
$result.='<td align="middle"><input type="text" name="'. |
$result.='<td align="middle"><input type="text" name="'. |
'GD_'.$uname.'_'.$part.'_aw" '. |
'GD_'.$uname.'_'.$part.'_awarded" '. |
'onChange="javascript:changeSelect('.$part.',\''.$uname. |
'onChange="javascript:changeSelect(\''.$part.'\',\''.$uname. |
'\')" value="'.$pts.'" size="4" /></td>'."\n"; |
'\')" value="'.$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="'.'GD_'.$uname.'_'. |
'GD_'.$uname.'_'.$part.'_sv_s" value="'.$status.'" />'."\n"; |
$part.'_solved_s" value="'.$status.'" />'."\n"; |
$result.='<td align="middle"><select name="'. |
$result.='<td align="middle"><select name="'. |
'GD_'.$uname.'_'.$part.'_sv" '. |
'GD_'.$uname.'_'.$part.'_solved" '. |
'onChange="javascript:changeOneScore('.$part.',\''.$uname.'\')" >'."\n"; |
'onChange="javascript:changeOneScore(\''.$part.'\',\''.$uname.'\')" >'."\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" |
if ($status eq 'excused'); |
if ($status eq 'excused'); |
$result.=$optsel; |
$result.=$optsel; |
$result.="</select></td>\n"; |
$result.="</select></td>\n"; |
|
} else { |
|
$result.='<input type="hidden" name="'. |
|
'GD_'.$uname.'_'.$part.'_'.$type.'_s" value="'.$score.'" />'. |
|
"\n"; |
|
$result.='<td align="middle"><input type="text" name="'. |
|
'GD_'.$uname.'_'.$part.'_'.$type.'" '. |
|
'value="'.$score.'" size="4" /></td>'."\n"; |
} |
} |
} |
} |
$result.='</tr>'; |
$result.='</tr>'; |
Line 1638 sub editgrades {
|
Line 1769 sub editgrades {
|
|
|
my $symb=$ENV{'form.symb'}; |
my $symb=$ENV{'form.symb'}; |
my $url =$ENV{'form.url'}; |
my $url =$ENV{'form.url'}; |
my $title='<h2><font color="#339933">Current Grade Status</font></h2>'; |
my $title='<h3><font color="#339933">Current Grade Status</font></h3>'; |
$title.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br />'."\n"; |
$title.='<font size=+1><b>Resource: </b>'.$ENV{'form.url'}.'</font><br />'."\n"; |
$title.='<font size=+1><b>Section: </b>'.$ENV{'form.section'}.'</font>'."\n"; |
$title.='<font size=+1><b>Section: </b>'.$ENV{'form.section'}.'</font>'."\n"; |
$title.= &show_grading_menu_form ($symb,$url); |
$title.= &show_grading_menu_form ($symb,$url); |
Line 1653 sub editgrades {
|
Line 1784 sub editgrades {
|
'ungraded' =>'ungraded_attempted', |
'ungraded' =>'ungraded_attempted', |
'nothing' => '', |
'nothing' => '', |
); |
); |
my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
my ($classlist,undef,$fullname) = &getclasslist($ENV{'form.section'},'0'); |
|
|
my (@partid); |
my (@partid); |
my %weight = (); |
my %weight = (); |
|
my %columns = (); |
my ($i,$ctr,$count,$rec_update) = (0,0,0,0); |
my ($i,$ctr,$count,$rec_update) = (0,0,0,0); |
|
|
|
my (@parts) = sort(&getpartlist($url)); |
|
my $header; |
while ($ctr < $ENV{'form.totalparts'}) { |
while ($ctr < $ENV{'form.totalparts'}) { |
my $partid = $ENV{'form.partid_'.$ctr}; |
my $partid = $ENV{'form.partid_'.$ctr}; |
push @partid,$partid; |
push @partid,$partid; |
$weight{$partid} = $ENV{'form.weight_'.$partid}; |
$weight{$partid} = $ENV{'form.weight_'.$partid}; |
$ctr++; |
$ctr++; |
$result .= '<td colspan = 2 align="center"><b>Part '.$partid. |
|
'</b> (Weight = '.$weight{$partid}.')</td>'; |
|
} |
} |
$result .= '</tr><tr bgcolor="#deffff">'; |
foreach my $partid (@partid) { |
foreach (@partid) { |
$header .= '<td align="center"> <b>Old Score</b> </td>'. |
$result .= '<td align="center"> <b>Old Score</b> </td>'. |
|
'<td align="center"> <b>New Score</b> </td>'; |
'<td align="center"> <b>New Score</b> </td>'; |
|
$columns{$partid}=2; |
|
foreach my $stores (@parts) { |
|
my ($part,$type) = &split_part_type($stores); |
|
if ($part !~ m/^\Q$partid\E/) { next;} |
|
if ($type eq 'awarded' || $type eq 'solved') { next; } |
|
my $display=&Apache::lonnet::metadata($url,$stores.'.display'); |
|
$display =~ s/\[Part: (\w)+\]//; |
|
$header .= '<td align="center"> <b>Old</b> '.$display.' </td>'. |
|
'<td align="center"> <b>New</b> '.$display.' </td>'; |
|
$columns{$partid}+=2; |
|
} |
} |
} |
|
foreach my $partid (@partid) { |
|
$result .= '<td colspan="'.$columns{$partid}. |
|
'" align="center"><b>Part '.$partid. |
|
'</b> (Weight = '.$weight{$partid}.')</td>'; |
|
|
|
} |
|
$result .= '</tr><tr bgcolor="#deffff">'; |
|
$result .= $header; |
$result .= '</tr>'."\n"; |
$result .= '</tr>'."\n"; |
|
|
for ($i=0; $i<$ENV{'form.total'}; $i++) { |
for ($i=0; $i<$ENV{'form.total'}; $i++) { |
Line 1678 sub editgrades {
|
Line 1829 sub editgrades {
|
my %newrecord; |
my %newrecord; |
my $updateflag = 0; |
my $updateflag = 0; |
my @userdom = grep /^$user:/,keys %$classlist; |
my @userdom = grep /^$user:/,keys %$classlist; |
my ($foo,$udom) = split(/:/,$userdom[0]); |
my (undef,$udom) = split(/:/,$userdom[0]); |
|
|
$result .= '<tr bgcolor="#ffffde"><td>'.$user.' </td><td>'. |
$result .= '<tr bgcolor="#ffffde"><td>'.$user.' </td><td>'. |
$$fullname{$userdom[0]}.' </td>'; |
$$fullname{$userdom[0]}.' </td>'; |
|
|
foreach (@partid) { |
foreach (@partid) { |
my $old_aw = $ENV{'form.GD_'.$user.'_'.$_.'_aw_s'}; |
my $old_aw = $ENV{'form.GD_'.$user.'_'.$_.'_awarded_s'}; |
my $old_part = $old_aw eq '' ? '' : $old_aw/$weight{$_}; |
my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1); |
my $old_score = $scoreptr{$ENV{'form.GD_'.$user.'_'.$_.'_sv_s'}}; |
my $old_part = $old_aw eq '' ? '' : $old_part_pcr; |
|
my $old_score = $scoreptr{$ENV{'form.GD_'.$user.'_'.$_.'_solved_s'}}; |
my $awarded = $ENV{'form.GD_'.$user.'_'.$_.'_aw'}; |
|
my $partial = $awarded eq '' ? '' : $awarded/$weight{$_}; |
my $awarded = $ENV{'form.GD_'.$user.'_'.$_.'_awarded'}; |
|
my $pcr = $awarded/($weight{$_} ne '0' ? $weight{$_} : 1); |
|
my $partial = $awarded eq '' ? '' : $pcr; |
my $score; |
my $score; |
if ($partial eq '') { |
if ($partial eq '') { |
$score = $scoreptr{$ENV{'form.GD_'.$user.'_'.$_.'_sv_s'}}; |
$score = $scoreptr{$ENV{'form.GD_'.$user.'_'.$_.'_solved_s'}}; |
} elsif ($partial > 0) { |
} elsif ($partial > 0) { |
$score = 'correct_by_override'; |
$score = 'correct_by_override'; |
} elsif ($partial == 0) { |
} elsif ($partial == 0) { |
$score = 'incorrect_by_override'; |
$score = 'incorrect_by_override'; |
} |
} |
$score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_sv'} eq 'excused') && |
$score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_solved'} eq 'excused') && |
($score ne 'excused')); |
($score ne 'excused')); |
$result .= '<td align="center">'.$old_aw.' </td>'. |
$result .= '<td align="center">'.$old_aw.' </td>'. |
'<td align="center">'.$awarded. |
'<td align="center">'.$awarded. |
($score eq 'excused' ? $score : '').' </td>'; |
($score eq 'excused' ? $score : '').' </td>'; |
|
|
next if ($old_part eq $partial && $old_score eq $score); |
if (!($old_part eq $partial && $old_score eq $score)) { |
|
$updateflag = 1; |
$updateflag = 1; |
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne ''; |
$newrecord{'resource.'.$_.'.solved'} = $score; |
$newrecord{'resource.'.$_.'.solved'} = $score; |
$rec_update++; |
$rec_update++; |
} |
|
|
|
my $partid=$_; |
|
foreach my $stores (@parts) { |
|
my ($part,$type) = &split_part_type($stores); |
|
if ($part !~ m/^\Q$partid\E/) { next;} |
|
if ($type eq 'awarded' || $type eq 'solved') { next; } |
|
my $old_aw = $ENV{'form.GD_'.$user.'_'.$part.'_'.$type.'_s'}; |
|
my $awarded = $ENV{'form.GD_'.$user.'_'.$part.'_'.$type}; |
|
if ($awarded ne '' && $awarded ne $old_aw) { |
|
$newrecord{'resource.'.$part.'.'.$type}= $awarded; |
|
$updateflag=1; |
|
} |
|
$result .= '<td align="center">'.$old_aw.' </td>'. |
|
'<td align="center">'.$awarded.' </td>'; |
|
} |
} |
} |
$result .= '</tr>'."\n"; |
$result .= '</tr>'."\n"; |
if ($updateflag) { |
if ($updateflag) { |
Line 1725 sub editgrades {
|
Line 1892 sub editgrades {
|
'<b>Total number of students = '.$ENV{'form.total'}.'</b><br />'; |
'<b>Total number of students = '.$ENV{'form.total'}.'</b><br />'; |
return $title.$msg.$result; |
return $title.$msg.$result; |
} |
} |
|
|
|
sub split_part_type { |
|
my ($partstr) = @_; |
|
my ($temp,@allparts)=split(/_/,$partstr); |
|
my $type=pop(@allparts); |
|
my $part=join('.',@allparts); |
|
return ($part,$type); |
|
} |
|
|
#------------- end of section for handling grading by section/class --------- |
#------------- end of section for handling grading by section/class --------- |
# |
# |
#---------------------------------------------------------------------------- |
#---------------------------------------------------------------------------- |
Line 1810 ENDPICK
|
Line 1986 ENDPICK
|
|
|
sub csvuploadmap_header { |
sub csvuploadmap_header { |
my ($request,$symb,$url,$datatoken,$distotal)= @_; |
my ($request,$symb,$url,$datatoken,$distotal)= @_; |
my $result; |
|
my $javascript; |
my $javascript; |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
$javascript=&csvupload_javascript_reverse_associate(); |
$javascript=&csvupload_javascript_reverse_associate(); |
} else { |
} else { |
$javascript=&csvupload_javascript_forward_associate(); |
$javascript=&csvupload_javascript_forward_associate(); |
} |
} |
|
|
|
my $result='<table border="0">'; |
|
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
|
my ($partlist,$handgrade) = &response_type($url); |
|
my ($resptype,$hdgrade)=('','no'); |
|
for (sort keys(%$handgrade)) { |
|
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
|
$resptype = $responsetype; |
|
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
|
$result.='<tr><td><b>Part </b>'.(split(/_/))[0].'</td>'. |
|
'<td><b>Type: </b>'.$responsetype.'</td>'. |
|
'<td><b>Handgrade: </b>'.$handgrade.'</font></td></tr>'; |
|
} |
|
$result.='</table>'; |
$request->print(<<ENDPICK); |
$request->print(<<ENDPICK); |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<h3>Uploading Class Grades for resource $url</h3> |
<h3><font color="#339933">Uploading Class Grades</font></h3> |
|
$result |
<hr> |
<hr> |
<h3>Identify fields</h3> |
<h3>Identify fields</h3> |
Total number of records found in file: $distotal <hr /> |
Total number of records found in file: $distotal <hr /> |
Line 1887 sub csvuploadmap {
|
Line 2077 sub csvuploadmap {
|
my ($i,$keyfields); |
my ($i,$keyfields); |
if (@records) { |
if (@records) { |
my @fields=&csvupload_fields($url); |
my @fields=&csvupload_fields($url); |
|
|
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
&Apache::loncommon::csv_print_samples($request,\@records); |
&Apache::loncommon::csv_print_samples($request,\@records); |
$i=&Apache::loncommon::csv_print_select_table($request,\@records, |
$i=&Apache::loncommon::csv_print_select_table($request,\@records, |
Line 1926 sub csvuploadassign {
|
Line 2117 sub csvuploadassign {
|
} |
} |
$request->print('<h3>Assigning Grades</h3>'); |
$request->print('<h3>Assigning Grades</h3>'); |
my $courseid=$ENV{'request.course.id'}; |
my $courseid=$ENV{'request.course.id'}; |
# my $cdom=$ENV{"course.$courseid.domain"}; |
|
# my $cnum=$ENV{"course.$courseid.num"}; |
|
my ($classlist) = &getclasslist('all','1'); |
my ($classlist) = &getclasslist('all','1'); |
my @skipped; |
my @skipped; |
my $countdone=0; |
my $countdone=0; |
Line 1987 sub gradingmenu {
|
Line 2176 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 $result='<h2> <font color="#339933">Select a Grading Method</font></h2>'; |
my $result='<h3> <font color="#339933">Select a Grading Method</font></h3>'; |
$result.='<table border="0">'; |
$result.='<table border="0">'; |
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
$result.='<tr><td colspan=3><font size=+1><b>Resource: </b>'.$url.'</font></td></tr>'; |
my ($partlist,$handgrade) = &response_type($url); |
my ($partlist,$handgrade) = &response_type($url); |
Line 2013 sub gradingmenu {
|
Line 2202 sub gradingmenu {
|
#--- Menu for grading a section or the whole class --- |
#--- Menu for grading a section or the whole class --- |
sub view_edit_entire_class_form { |
sub view_edit_entire_class_form { |
my ($symb,$url)=@_; |
my ($symb,$url)=@_; |
my ($classlist,$sections) = &getclasslist('all','0'); |
my ($classlist,$sections,undef) = &getclasslist('all','0'); |
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 Entire Section/Class</b></td></tr>'."\n"; |
$result.=' <b>Grade Entire Section or Class</b></td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<form action="/adm/grades" method="post">'."\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="viewgrades" />'."\n"; |
'<input type="hidden" name="command" value="viewgrades" />'."\n"; |
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
$result.=' <b>Select section:</b> <select name="section">'."\n"; |
foreach (sort (@$sections)) { |
if (ref($sections)) { |
$result.= '<option>'.$_.'</option>'."\n"; |
foreach (sort (@$sections)) { |
|
$result.= '<option>'.$_.'</option>'."\n"; |
|
} |
} |
} |
$result.='<option selected="on">all</select>'."<br />\n"; |
$result.='<option selected="on">all</select>'."<br />\n"; |
$result.=' <input type="submit" name="submit" value="View/Grade" /></form>'."\n"; |
$result.=' <input type="button" onClick="submit();" value="Grade" /></form>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
return $result; |
return $result; |
Line 2037 sub view_edit_entire_class_form {
|
Line 2228 sub view_edit_entire_class_form {
|
sub upcsvScores_form { |
sub upcsvScores_form { |
my ($symb,$url) = @_; |
my ($symb,$url) = @_; |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
my $result = '<script type="text/javascript" language="javascript">'."\n". |
|
' function checkUpload(formname) {'."\n". |
|
' if (formname.upfile.value == "") {'."\n". |
|
' alert("Please use the browse button to select a file from your local directory.");'."\n". |
|
' return false;'."\n". |
|
' }'."\n". |
|
' formname.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
|
|
$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>Specify a file containing the class scores for above resource</b></td></tr>'."\n"; |
$result.=' <b>Specify a file containing the class scores for above resource</b></td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
Line 2048 sub upcsvScores_form {
|
Line 2249 sub upcsvScores_form {
|
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="command" value="csvuploadmap" /> |
<input type="hidden" name="command" value="csvuploadmap" /> |
$upfile_select |
$upfile_select |
<br /> <input type="submit" name="submit" value="Upload Grades" /> |
<br /> <input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Grades" /> |
</form> |
</form> |
ENDUPFORM |
ENDUPFORM |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
Line 2062 sub viewGradeaStu_form {
|
Line 2263 sub viewGradeaStu_form {
|
my ($classlist,$sections) = &getclasslist('all','0'); |
my ($classlist,$sections) = &getclasslist('all','0'); |
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>'; |
|
if ($handgrade eq 'yes') { |
|
$result.="View/Grade "; |
|
} else { |
|
$result.="View "; |
|
} |
|
$result.='an Individual Student\'s Submission</b></td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<form action="/adm/grades" method="post">'."\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". |
Line 2073 sub viewGradeaStu_form {
|
Line 2280 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 (sort (@$sections)) { |
if (ref($sections)) { |
$result.= '<option>'.$_.'</option>'."\n"; |
foreach (sort (@$sections)) {$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>'. |
'<input type="radio" name="submitonly" value="yes" checked> submitted'. |
'<input type="radio" name="submitonly" value="yes" checked> submitted'. |
'<input type="radio" name="submitonly" value="all"> everybody <br />'; |
'<input type="radio" name="submitonly" value="all"> everybody <br />'; |
$result.=' (Section "no" implies the students were not assigned a section.)<br />' |
if (ref($sections)) { |
if (grep /no/,@$sections); |
$result.=' (Section "no" implies the students were not assigned a section.)<br />' |
|
if (grep /no/,@$sections); |
$result.='<br /> <input type="submit" name="submit" value="View/Grade" />'."\n". |
} |
'</form>'."\n"; |
|
|
|
|
$result.='<br /> <input type="button" onClick="submit();" value="'; |
|
if ($handgrade eq 'yes') { |
|
$result.="View/Grade"; |
|
} else { |
|
$result.="View"; |
|
} |
|
$result.='" />'."\n".'</form>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
return $result; |
return $result; |
Line 2093 sub viewGradeaStu_form {
|
Line 2308 sub viewGradeaStu_form {
|
#--- Form to input a receipt number --- |
#--- Form to input a receipt number --- |
sub verifyReceipt_form { |
sub verifyReceipt_form { |
my ($symb,$url) = @_; |
my ($symb,$url) = @_; |
my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"}; |
my $result = '<script type="text/javascript" language="javascript">'."\n". |
my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"}; |
' function checkEntry(formname) {'."\n". |
|
' var receipt = formname.receipt.value;'."\n". |
|
' if (isNaN(receipt) || receipt == "") {'."\n". |
|
' alert("Please enter a receipt number given by a student in the box.");'."\n". |
|
' return false;'."\n". |
|
' }'."\n". |
|
' formname.submit();'."\n". |
|
' }'."\n". |
|
'</script>'."\n"; |
|
|
my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); |
my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); |
|
|
my $result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#777777>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
$result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n"; |
$result.=' <b>Verify a Submission Receipt Issued by this Server</td></tr>'."\n"; |
$result.=' <b>Verify a Submission Receipt Issued by this Server</td></tr>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<tr bgcolor=#ffffe6><td>'."\n"; |
$result.='<form action="/adm/grades" method="post">'."\n"; |
$result.='<form action="/adm/grades" method="post" name="verifyform">'."\n"; |
$result.=' <tt>'.$hostver.'-<input type="text" name="receipt" size="4"></tt><br />'."\n"; |
$result.=' <tt>'.$hostver.'-<input type="text" name="receipt" size="4"></tt><br />'."\n"; |
$result.=' <input type="submit" name="submit" value="Verify Receipt">'."\n"; |
$result.=' <input type="button" onClick="javascript:checkEntry(this.form);"'. |
|
' value="Verify Receipt">'."\n"; |
$result.='<input type="hidden" name="command" value="verify">'."\n"; |
$result.='<input type="hidden" name="command" value="verify">'."\n"; |
if ($ENV{'form.url'}) { |
if ($ENV{'form.url'}) { |
$result.='<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'; |
$result.='<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'; |
Line 2155 sub handler {
|
Line 2380 sub handler {
|
'grade_courseid' => $tcrsid, |
'grade_courseid' => $tcrsid, |
'grade_symb' => $tsymb))); |
'grade_symb' => $tsymb))); |
} else { |
} else { |
$request->print('<h2>Not authorized: '.$token.'</h2>'); |
$request->print('<h3>Not authorized: '.$token.'</h3>'); |
} |
} |
} else { |
} else { |
$request->print('<h2>Not a valid DocID: '.$token.'</h2>'); |
$request->print('<h3>Not a valid DocID: '.$token.'</h3>'); |
} |
} |
} else { |
} else { |
$request->print(&Apache::lonxml::tokeninputfield()); |
$request->print(&Apache::lonxml::tokeninputfield()); |
} |
} |
} |
} |
} else { |
} else { |
#&Apache::lonhomework::showhashsubset(\%ENV,'^form'); |
|
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); |
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); |
if ($command eq 'submission') { |
if ($command eq 'submission') { |
&listStudents($request) if ($ENV{'form.student'} eq ''); |
&listStudents($request) if ($ENV{'form.student'} eq ''); |
Line 2215 sub send_header {
|
Line 2439 sub send_header {
|
#remotewindow=open('','homeworkremote'); |
#remotewindow=open('','homeworkremote'); |
#remotewindow.close(); |
#remotewindow.close(); |
#</script>"); |
#</script>"); |
$request->print('<body bgcolor="#FFFFFF">'); |
$request->print(&Apache::loncommon::bodytag('Grading')); |
} |
} |
|
|
sub send_footer { |
sub send_footer { |