version 1.43, 2008/10/16 16:35:53
|
version 1.49.6.3, 2017/04/02 13:42:06
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# Created Nov. 14, 2002 by Jeremy Bowers |
|
|
|
package Apache::lonquickgrades; |
package Apache::lonquickgrades; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http REDIRECT); |
use POSIX; |
use POSIX; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::grades; |
use Apache::grades; |
|
use Apache::lonuserstate; |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 58 sub real_handler {
|
Line 58 sub real_handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
unless (&Apache::lonnet::allowed('mgr')) { |
|
# Check for critical messages and redirect if present. |
|
my ($redirect,$url) = &Apache::loncommon::critical_redirect(300); |
|
if ($redirect) { |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->header_out(Location => $url); |
|
return REDIRECT; |
|
} |
|
|
|
# Check if course needs to be re-initialized |
|
my $loncaparev = $r->dir_config('lonVersion'); |
|
my ($result,@reinit) = &Apache::loncommon::needs_coursereinit($loncaparev); |
|
|
|
if ($result eq 'switch') { |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
$r->print(&Apache::loncommon::check_release_result(@reinit)); |
|
return OK; |
|
} elsif ($result eq 'update') { |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum"); |
|
if ($ferr) { |
|
my $requrl = $r->uri; |
|
$env{'user.error.msg'}="$requrl:bre:0:0:Course not initialized"; |
|
$env{'user.reinit'} = 1; |
|
return HTTP_NOT_ACCEPTABLE; |
|
} |
|
} |
|
} |
|
|
# Send header, don't cache this page |
# Send header, don't cache this page |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
Line 65 sub real_handler {
|
Line 96 sub real_handler {
|
my $showPoints = |
my $showPoints = |
$env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard'; |
$env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard'; |
my $notshowSPRSlink = |
my $notshowSPRSlink = |
$env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external'; |
(($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external') |
|
|| ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals')); |
|
my $notshowTotals= |
|
$env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals'; |
|
|
# Create the nav map |
# Create the nav map |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
Line 81 sub real_handler {
|
Line 115 sub real_handler {
|
my $res = $navmap->firstResource(); # temp resource to access constants |
my $res = $navmap->firstResource(); # temp resource to access constants |
|
|
# Header |
# Header |
my $title = $showPoints ? "Points Display" : "Completed Problems Display"; |
my $title = "Grading and Statistics";#$showPoints ? "Points Display" : "Completed Problems Display"; |
$r->print(&Apache::loncommon::start_page($title)); |
my $brcrum = [{href=>"/adm/quickgrades",text => "Points Display"}]; |
|
$r->print(&Apache::loncommon::start_page($title,undef, |
|
{'bread_crumbs' => $brcrum}) |
|
); |
|
|
if (!$showPoints && !$notshowSPRSlink ) { |
if (!$showPoints && !$notshowSPRSlink ) { |
$r->print('<p>' |
$r->print('<p>' |
Line 231 sub real_handler {
|
Line 268 sub real_handler {
|
if ($totalAttempted) { |
if ($totalAttempted) { |
$title .= " / " . &mt("Attempted"); |
$title .= " / " . &mt("Attempted"); |
} |
} |
$r->print("<th>$title / ".&mt('Total').'</td>' |
$r->print("<th>$title".($notshowTotals?'':" / ".&mt('Total')).'</th>' |
.&Apache::loncommon::end_data_table_header_row()); |
.&Apache::loncommon::end_data_table_header_row()); |
while ($depth > 0) { |
while ($depth > 0) { |
if ($curRes == $iterator->BEGIN_MAP()) {$depth++;} |
if ($curRes == $iterator->BEGIN_MAP()) {$depth++;} |
Line 256 sub real_handler {
|
Line 293 sub real_handler {
|
|
|
$r->print("$thisIndent$title</td>"); |
$r->print("$thisIndent$title</td>"); |
if ($totalAttempted) { |
if ($totalAttempted) { |
$r->print("<td valign='top'>$thisIndent<nobr>$correct / $attempted / $total</nobr></td>" |
$r->print('<td valign="top">' |
.&Apache::loncommon::end_data_table_row()); |
.$thisIndent |
|
.'<span class="LC_nobreak">' |
|
.$correct.' / '.$attempted.($notshowTotals?'':' / '.$total) |
|
.'</span></td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
} else { |
} else { |
$r->print("<td valign='top'>$thisIndent<nobr>$correct / $total</nobr></td>" |
$r->print('<td valign="top">' |
|
.$thisIndent |
|
.'<span class="LC_nobreak">' |
|
.$correct.($notshowTotals?'':' / '.$total) |
|
.'</span></td>' |
.&Apache::loncommon::end_data_table_row()); |
.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
Line 285 sub real_handler {
|
Line 331 sub real_handler {
|
$title = $showPoints ? "Points" : "Parts Done"; |
$title = $showPoints ? "Points" : "Parts Done"; |
my $totaltitle = $showPoints ? &mt("Awarded Total Points") : &mt("Total Parts Done"); |
my $totaltitle = $showPoints ? &mt("Awarded Total Points") : &mt("Total Parts Done"); |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print(&Apache::loncommon::start_data_table_row() |
.'<td colspan="2" align="right">'.$totaltitle.': <b>'.$totalRight.'</b><br>'); |
.'<td colspan="2" align="right">'.$totaltitle.': <b>'.$totalRight.'</b><br />'); |
$r->print(&mt("Max Possible To Date")." $maxHelpLink: <b>$totalPossible</b><br>"); |
$r->print(&mt('Max Possible To Date')." $maxHelpLink: <b>$totalPossible</b><br />"); |
$title = $showPoints ? "Points" : "Parts"; |
$title = $showPoints ? "Points" : "Parts"; |
$r->print(&mt("Total $title In Course").': <b>'.$totalParts.'</b></td>' |
$r->print(&mt("Total $title In Course").': <b>'.$totalParts.'</b></td>' |
.&Apache::loncommon::end_data_table_row()); |
.&Apache::loncommon::end_data_table_row()); |