version 1.3, 2002/11/15 20:08:18
|
version 1.4, 2002/11/19 21:11:25
|
Line 62 sub handler {
|
Line 62 sub handler {
|
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}."_parms.db", 1, 0); |
$ENV{"request.course.fn"}."_parms.db", 1, 0); |
|
|
|
# Keep this hash in sync with %statusIconMap in lonnavmaps; they |
|
# should match color/icon |
|
my $res = $navmap->firstResource(); # temp resource to access constants |
|
|
|
my $green = "#AAFFAA"; |
|
my $red = "#FFAAAA"; |
|
my $yellow = "#FFFFAA"; |
|
my $orange = "#FFBB88"; |
|
my $neutral = ""; |
|
my %statusColorMap = |
|
( $res->NETWORK_FAILURE => $neutral, |
|
$res->NOTHING_SET => $neutral, |
|
$res->CORRECT => $green, |
|
$res->EXCUSED => $green, |
|
$res->PAST_DUE_NO_ANSWER => $orange, |
|
$res->PAST_DUE_ANSWER_LATER => $orange, |
|
$res->ANSWER_OPEN => $orange, |
|
$res->OPEN_LATER => $neutral, |
|
$res->TRIES_LEFT => $neutral, |
|
$res->INCORRECT => $orange, |
|
$res->OPEN => $yellow, |
|
$res->ATTEMPTED => $yellow ); |
|
|
if (!defined($navmap)) { |
if (!defined($navmap)) { |
my $requrl = $r->uri; |
my $requrl = $r->uri; |
$ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized"; |
$ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized"; |
Line 76 sub handler {
|
Line 99 sub handler {
|
|
|
# End navmap using boilerplate |
# End navmap using boilerplate |
|
|
# Col labels |
|
$r->print(<<TABLETOP); |
|
<table border="1" cellpadding="3" cellspacing="0"> |
|
<tr> |
|
<td align="center"><b>Problem</b></td> |
|
<td align="center"><b>Score</b></td> |
|
</tr> |
|
TABLETOP |
|
|
|
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $depth = 1; |
my $depth = 1; |
$iterator->next(); # ignore first BEGIN_MAP |
$iterator->next(); # ignore first BEGIN_MAP |
my $curRes = $iterator->next(); |
my $curRes = $iterator->next(); |
my $totalAvailable = 0; |
my $totalParts = 0; |
my $total = 0; |
my $totalRight = 0; |
|
my $totalCurrentlyPossible = 0; |
|
|
|
$r->print("<div width=\"50%\">\n"); # use this to format the col |
|
|
while ( $depth > 0 ) { |
while ( $depth > 0 ) { |
if ($curRes == $iterator->BEGIN_MAP()) {$depth++;} |
if ($curRes == $iterator->BEGIN_MAP()) {$depth++;} |
Line 98 TABLETOP
|
Line 115 TABLETOP
|
|
|
if (ref($curRes) && $curRes->is_problem()) { |
if (ref($curRes) && $curRes->is_problem()) { |
my $title = $curRes->compTitle(); |
my $title = $curRes->compTitle(); |
$r->print(' <tr>'); |
|
my $stack = $iterator->getStack(); |
my $stack = $iterator->getStack(); |
my $src = Apache::lonnavmaps::getLinkForResource($stack); |
my $src = Apache::lonnavmaps::getLinkForResource($stack); |
my $srcHasQuestion = $src =~ /\?/; |
my $srcHasQuestion = $src =~ /\?/; |
Line 106 TABLETOP
|
Line 122 TABLETOP
|
($srcHasQuestion?'&':'?') . |
($srcHasQuestion?'&':'?') . |
'symb='.&Apache::lonnet::escape($curRes->symb()). |
'symb='.&Apache::lonnet::escape($curRes->symb()). |
'"'; |
'"'; |
$r->print("<td><a href=\"$link\">$title</td>"); |
|
|
|
my $avail = 0; |
|
my $score = 0; |
|
my $parts = $curRes->parts(); |
my $parts = $curRes->parts(); |
|
my $multipart = scalar(@{$parts}) > 1; |
|
|
for my $part (@{$parts}) { |
for my $part (@{$parts}) { |
my $partAvail = $curRes->weight($part); |
if ($multipart && $part eq '0') { next; } |
my $partScore = $curRes->awarded($part) * $partAvail; |
$totalParts++; |
$avail += $partAvail; |
|
$score += $partScore; |
my $status = $curRes->status($part); |
|
my $color = $statusColorMap{$status}; |
|
if ($color eq $green) { # I'm being bad here... ;-) |
|
$totalRight++; $totalCurrentlyPossible++; |
|
} |
|
if ($color eq $yellow || $color eq $orange) { |
|
$totalCurrentlyPossible++; |
|
} |
|
|
|
$r->print("<div style=\"background-color: $color\" width=\"100%\">" . |
|
"<nobr><a href=\"$link\">$title" . |
|
($multipart ? ', ' . $part : '') . '</a></nobr></div>' |
|
."\n"); |
|
|
|
if (!($totalParts % 20)) { $r->rflush(); } |
} |
} |
|
|
$r->print("<td align=\"right\">$score / $avail</td></tr>\n"); |
|
$totalAvailable += $avail; |
|
$total += $score; |
|
} |
} |
|
|
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
|
|
$r->print("<td colspan=\"2\" align=\"right\">Total Points Scored: <b>$total</b>"); |
$r->print("<br><hr>\n"); |
$r->print("<br />Total Points Available: <b>$totalAvailable</b>"); |
$r->print("<div width=\"100%\" align=\"right\">"); |
$r->print("</td></tr></table>\n\n"); |
$r->print("Total Parts Correct: <b>$totalRight</b><br>"); |
|
$r->print("Number Of Parts Possibly Correct: <b>$totalCurrentlyPossible</b><br>"); |
|
$r->print("Total Parts In Course: <b>$totalParts</b></div></div>\n\n"); |
|
|
$r->print("</body></html>"); |
$r->print("</body></html>"); |
|
|