--- loncom/interface/lonquickgrades.pm 2002/11/26 14:45:25 1.7
+++ loncom/interface/lonquickgrades.pm 2003/09/22 20:05:20 1.26
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-#
+# $Id: lonquickgrades.pm,v 1.26 2003/09/22 20:05:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,6 +32,8 @@ package Apache::lonquickgrades;
use strict;
use Apache::Constants qw(:common :http);
use POSIX;
+use Apache::loncommon;
+use Apache::lonlocal;
sub handler {
my $r = shift;
@@ -46,9 +48,9 @@ sub real_handler {
# Handle header-only request
if ($r->header_only) {
if ($ENV{'browser.mathml'}) {
- $r->content_type('text/xml');
+ &Apache::loncommon::content_type($r,'text/xml');
} else {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
}
$r->send_http_header;
return OK;
@@ -56,17 +58,18 @@ sub real_handler {
# Send header, don't cache this page
if ($ENV{'browser.mathml'}) {
- $r->content_type('text/xml');
+ &Apache::loncommon::content_type($r,'text/xml');
} else {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
}
&Apache::loncommon::no_cache($r);
$r->send_http_header;
+ my $showPoints =
+ $ENV{'course.'.$ENV{'request.course.id'}.'.grading'} eq 'standard';
+
# Create the nav map
- my $navmap = Apache::lonnavmaps::navmap->new(
- $ENV{"request.course.fn"}.".db",
- $ENV{"request.course.fn"}."_parms.db", 1, 0);
+ my $navmap = Apache::lonnavmaps::navmap->new();
if (!defined($navmap)) {
my $requrl = $r->uri;
@@ -77,24 +80,22 @@ sub real_handler {
# Keep this hash in sync with %statusIconMap in lonnavmaps; they
# should match color/icon
my $res = $navmap->firstResource(); # temp resource to access constants
-
- if (!defined($navmap)) {
- my $requrl = $r->uri;
- $ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized";
- return HTTP_NOT_ACCEPTABLE;
- }
# Header
- $r->print(&Apache::loncommon::bodytag('Quick Score Display','',
- ''));
+ my $title = $showPoints ? "Quick Points Display" : "Quick Completed Problems Display";
+ $r->print(&Apache::loncommon::bodytag($title, '', ''));
- $r->print(<
Sequence | '); - $r->print('Correct / Total | ||||||||||
Folder | '); + $title =&mt($showPoints ? "Points Scored" : "Done"); + $r->print("$title / Total |
"); - for (my $i = 1; $i < $depth; $i++) { $r->print($indentString); } + my $thisIndent = ''; + for (my $i = 1; $i < $depth; $i++) { $thisIndent .= $indentString; } - $r->print("$title | "); - $r->print("$correct / $total | $thisIndent | \n");
}
}
@@ -211,19 +230,22 @@ HEADER
}
# If there were any problems at the top level, print an extra "catchall"
- if ($unaccountedTotal > 0) {
- my $ratio = $unaccountedCorrect / $unaccountedTotal;
+ if ($topLevelParts > 0) {
+ my $ratio = $topLevelRight / $topLevelParts;
my $color = mixColors(\@start, \@end, $ratio);
$r->print("
"); - $r->print("Problems Not Contained In Sequences | "); - $r->print("$unaccountedCorrect / $unaccountedTotal | "); + $r->print("$topLevelRight / $topLevelParts | "); } my $maxHelpLink = Apache::loncommon::help_open_topic("Quick_Grades_Possibly_Correct"); - $r->print("
Total Parts Correct: $totalRight "); - $r->print("Max Possible To Date $maxHelpLink: $totalPossible "); - $r->print("Total Parts In Course: $totalParts | |
Total $title: $totalRight "); + $r->print(&mt("Max Possible To Date")." $maxHelpLink: $totalPossible "); + $title = $showPoints ? "Points" : "Parts"; + $r->print(&mt("Total $title In Course").": $totalParts |