version 1.146, 2003/11/04 19:38:09
|
version 1.147, 2003/11/06 15:22:33
|
Line 133 sub response_type {
|
Line 133 sub response_type {
|
$symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))) if ($symb eq ''); |
$symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))) if ($symb eq ''); |
my $allkeys = &Apache::lonnet::metadata($url,'keys'); |
my $allkeys = &Apache::lonnet::metadata($url,'keys'); |
my %seen = (); |
my %seen = (); |
my (@partlist,%handgrade); |
my (@partlist,%handgrade,%responseType); |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { |
if (/^\w+response_\w+.*/) { |
if (/^\w+response_.*/) { |
my ($responsetype,$part) = split(/_/,$_,2); |
my ($responsetype,$part) = split(/_/,$_,2); |
my ($partid,$respid) = split(/_/,$part); |
my ($partid,$respid) = split(/_/,$part); |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) { |
Line 143 sub response_type {
|
Line 143 sub response_type {
|
} |
} |
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!! |
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!! |
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); |
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); |
$handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no'); |
$handgrade{$part} = ($value eq 'yes' ? 'yes' : 'no'); |
|
if (!exists($responseType{$partid})) { $responseType{$partid}={}; } |
|
$responseType{$partid}->{$respid}=$responsetype; |
next if ($seen{$partid} > 0); |
next if ($seen{$partid} > 0); |
$seen{$partid}++; |
$seen{$partid}++; |
push @partlist,$partid; |
push @partlist,$partid; |
} |
} |
} |
} |
return \@partlist,\%handgrade; |
return \@partlist,\%handgrade,\%responseType; |
} |
} |
|
|
#--- Show resource title |
#--- Show resource title |
Line 158 sub showResourceInfo {
|
Line 160 sub showResourceInfo {
|
my ($url,$probTitle) = @_; |
my ($url,$probTitle) = @_; |
my $result ='<table border="0">'. |
my $result ='<table border="0">'. |
'<tr><td colspan=3><font size=+1><b>Current Resource: </b>'.$probTitle.'</font></td></tr>'."\n"; |
'<tr><td colspan=3><font size=+1><b>Current Resource: </b>'.$probTitle.'</font></td></tr>'."\n"; |
my ($partlist,$handgrade) = &response_type($url); |
my ($partlist,$handgrade,$responseType) = &response_type($url); |
my %resptype = (); |
my %resptype = (); |
my $hdgrade='no'; |
my $hdgrade='no'; |
for (sort keys(%$handgrade)) { |
for my $part_resID (sort keys(%$handgrade)) { |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
my $handgrade=$$handgrade{$part_resID}; |
my $partID = (split(/_/))[0]; |
my ($partID,$resID) = split(/_/,$part_resID); |
$resptype{$partID} = $responsetype; |
my $responsetype = $responseType->{$partID}->{$resID}; |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$hdgrade = $handgrade if ($handgrade eq 'yes'); |
$result.='<tr><td><b>Part </b>'.$partID.'</td>'. |
$result.='<tr><td><b>Part </b>'.$partID.' <font color="#999999">'. |
|
$resID.'</font></td>'. |
'<td><b>Type: </b>'.$responsetype.'</td></tr>'; |
'<td><b>Type: </b>'.$responsetype.'</td></tr>'; |
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>'; |
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>'; |
} |
} |
$result.='</table>'."\n"; |
$result.='</table>'."\n"; |
return $result,\%resptype,$hdgrade,$partlist,$handgrade; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
} |
} |
|
|
#--- Clean response type for display |
#--- Clean response type for display |
Line 1421 KEYWORDS
|
Line 1424 KEYWORDS
|
|
|
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,$symb); |
my ($partlist,$handgrade,$responseType) = &response_type($url,$symb); |
|
|
# Display student info |
# Display student info |
$request->print(($counter == 0 ? '' : '<br />')); |
$request->print(($counter == 0 ? '' : '<br />')); |
Line 1504 KEYWORDS
|
Line 1507 KEYWORDS
|
$$fullname{$ENV{'form.'.$uname.':'.$udom.':submitted_by'}}.'</a>'; |
$$fullname{$ENV{'form.'.$uname.':'.$udom.':submitted_by'}}.'</a>'; |
$request->print($submitby); |
$request->print($submitby); |
} else { |
} else { |
my ($string,$timestamp)= &get_last_submission (\%record); |
my ($string,$timestamp)= &get_last_submission(\%record); |
my $lastsubonly=''. |
my $lastsubonly=''. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '. |
$$timestamp)."</td></tr>\n"; |
$$timestamp)."</td></tr>\n"; |
Line 1512 KEYWORDS
|
Line 1515 KEYWORDS
|
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
$lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; |
} else { |
} else { |
for my $part (sort keys(%$handgrade)) { |
for my $part (sort keys(%$handgrade)) { |
my ($responsetype,$foo) = split(/:/,$$handgrade{$part}); |
|
my ($partid,$respid) = split(/_/,$part); |
my ($partid,$respid) = split(/_/,$part); |
|
my $responsetype = $responseType->{$partid}->{$respid}; |
if (!exists($record{'resource.'.$partid.'.'.$respid.'.submission'})) { |
if (!exists($record{'resource.'.$partid.'.'.$respid.'.submission'})) { |
$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. |
Line 2172 sub viewgrades {
|
Line 2175 sub viewgrades {
|
my ($partid,$respid) = split (/_/,$_,2); |
my ($partid,$respid) = split (/_/,$_,2); |
next if $seen{$partid}; |
next if $seen{$partid}; |
$seen{$partid}++; |
$seen{$partid}++; |
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); |
my $handgrade=$$handgrade{$_}; |
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 2991 sub displayPage {
|
Line 2994 sub displayPage {
|
} else { |
} else { |
my %responseType = (); |
my %responseType = (); |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
$responseType{$partid} = $curRes->responseType($partid); |
my @responseIds =$curRes->responseIds($partid); |
|
my @responseType =$curRes->responseType($partid); |
|
my %responseIds; |
|
for (my $i=0;$i<=$#responseIds;$i++) { |
|
$responseIds{$responseIds[$i]}=$responseType[$i]; |
|
} |
|
$responseType{$partid} = \%responseIds; |
} |
} |
$studentTable.= &displaySubByDates(\$symbx,\%record,$parts,\%responseType,$checkIcon); |
$studentTable.= &displaySubByDates(\$symbx,\%record,$parts,\%responseType,$checkIcon); |
|
|
} |
} |
} elsif ($ENV{'form.lastSub'} eq 'all') { |
} elsif ($ENV{'form.lastSub'} eq 'all') { |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); |
Line 3037 sub displaySubByDates {
|
Line 3047 sub displaySubByDates {
|
my ($version); |
my ($version); |
my %mark; |
my %mark; |
$mark{'correct_by_student'} = $checkIcon; |
$mark{'correct_by_student'} = $checkIcon; |
return '<br /> <font color="red">Nothing submitted - no attempts</font><br />' |
if (!exists($$record{'1:timestamp'})) { |
if (!exists($$record{'1:timestamp'})); |
return '<br /> <font color="red">Nothing submitted - no attempts</font><br />'; |
|
} |
for ($version=1;$version<=$$record{'version'};$version++) { |
for ($version=1;$version<=$$record{'version'};$version++) { |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
my $timestamp = scalar(localtime($$record{$version.':timestamp'})); |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
$studentTable.='<tr bgcolor="#ffffff" valign="top"><td>'.$timestamp.'</td>'; |
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @versionKeys = split(/\:/,$$record{$version.':keys'}); |
my @displaySub = (); |
my @displaySub = (); |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys; |
my @matchKey = sort(grep /^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys); |
# next if ($$record{"$version:resource.$partid.solved"} eq ''); |
# next if ($$record{"$version:resource.$partid.solved"} eq ''); |
$displaySub[0].=(exists $$record{$version.':'.$matchKey[0]}) ? |
foreach my $matchKey (@matchKey) { |
'<b>Part '.$partid.' '. |
if (exists $$record{$version.':'.$matchKey}) { |
($$record{"$version:resource.$partid.tries"} eq '' ? 'Trial not counted' : |
my ($responseId)=($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/); |
'Trial '.$$record{"$version:resource.$partid.tries"}).'</b> '. |
$displaySub[0].='<b>Part '.$partid.' '; |
&cleanRecord($$record{$version.':'.$matchKey[0]},$$responseType{$partid},$$symbx).'<br />' : ''; |
$displaySub[0].='<font color="#999999">(ID '. |
$displaySub[1].=(exists $$record{"$version:resource.$partid.award"}) ? |
$responseId.')</font> '; |
'<b>Part '.$partid.'</b> '. |
if ($$record{"$version:resource.$partid.tries"} eq '') { |
lc($$record{"$version:resource.$partid.award"}).' '. |
$displaySub[0].='Trial not counted'; |
$mark{$$record{"$version:resource.$partid.solved"}}.'<br />' : ''; |
} else { |
$displaySub[2].=(exists $$record{"$version:resource.$partid.regrader"}) ? |
$displaySub[0].='Trial '. |
$$record{"$version:resource.$partid.regrader"}.' (<b>Part:</b> '.$partid.')' : ''; |
$$record{"$version:resource.$partid.tries"}; |
} |
} |
$displaySub[2].=(exists $$record{"$version:resource.regrader"}) ? |
&Apache::lonnet::logthis("Part is $partid responseType is ".join(':',%$responseType)); |
$$record{"$version:resource.regrader"} : ''; # needed because old essay regrader has not parts info |
my $responseType=$responseType->{$partid}->{$responseId}; |
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1]. |
$displaySub[0].='</b> '. |
($displaySub[2] eq '' ? '' : 'Manually graded by '.$displaySub[2]).' </td></tr>'; |
&cleanRecord($$record{$version.':'.$matchKey},$responseType,$$symbx).'<br />'; |
|
} |
|
} |
|
if (exists $$record{"$version:resource.$partid.award"}) { |
|
$displaySub[1].='<b>Part '.$partid.'</b> '. |
|
lc($$record{"$version:resource.$partid.award"}).' '. |
|
$mark{$$record{"$version:resource.$partid.solved"}}. |
|
'<br />'; |
|
} |
|
if (exists $$record{"$version:resource.$partid.regrader"}) { |
|
$displaySub[2].=$$record{"$version:resource.$partid.regrader"}. |
|
' (<b>Part:</b> '.$partid.')'; |
|
} |
|
} |
|
# needed because old essay regrader has not parts info |
|
if (exists $$record{"$version:resource.regrader"}) { |
|
$displaySub[2].=$$record{"$version:resource.regrader"}; |
|
} |
|
$studentTable.='<td>'.$displaySub[0].' </td><td>'.$displaySub[1]; |
|
if ($displaySub[2]) { |
|
$studentTable.='Manually graded by '.$displaySub[2]; |
|
} |
|
$studentTable.=' </td></tr>'; |
|
|
} |
} |
$studentTable.='</table></td></tr></table>'; |
$studentTable.='</table></td></tr></table>'; |
return $studentTable; |
return $studentTable; |