--- loncom/interface/lonquickgrades.pm 2017/06/26 01:56:58 1.110
+++ loncom/interface/lonquickgrades.pm 2017/12/18 23:51:14 1.112
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.110 2017/06/26 01:56:58 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.112 2017/12/18 23:51:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -77,6 +77,11 @@ sub real_handler {
}
my $cangrade=&Apache::lonnet::allowed('mgr');
+ my $showPoints =
+ (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard')
+ || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));
+
+ my $reinitresult;
unless ($cangrade) {
# Check for critical messages and redirect if present.
@@ -89,22 +94,46 @@ sub real_handler {
# Check if course needs to be re-initialized
my $loncaparev = $r->dir_config('lonVersion');
- my ($result,@reinit) = &Apache::loncommon::needs_coursereinit($loncaparev);
+ ($reinitresult,my @reinit) = &Apache::loncommon::needs_coursereinit($loncaparev);
- if ($result eq 'switch') {
+ if ($reinitresult 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'};
+ } elsif ($reinitresult eq 'update') {
+ my $cid = $env{'request.course.id'};
+ my $cnum = $env{'course.'.$cid.'.num'};
+ my $cdom = $env{'course.'.$cid.'.domain'};
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ &startpage($r,$showPoints);
+ my $preamble = '
'.
+ '
'.
+ &mt('Your course session is being updated because of recent changes by course personnel.').
+ ' '.&mt('Please be patient.').'
'.
+ '';
+ %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble);
+ &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Updating course'));
+ $r->rflush();
my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
+ &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Finished'));
+ &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+ my $closure = <
+//
+
+ENDCLOSE
if ($ferr) {
+ $r->print($closure.&Apache::loncommon::end_page());
my $requrl = $r->uri;
$env{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
$env{'user.reinit'} = 1;
return HTTP_NOT_ACCEPTABLE;
+ } else {
+ $r->print($closure);
}
} elsif ((&Apache::loncommon::course_type() eq 'Placement') &&
(!$env{'request.role.adv'})) {
@@ -115,27 +144,13 @@ sub real_handler {
}
}
- # Send header, don't cache this page
- &Apache::loncommon::no_cache($r);
- $r->send_http_header;
-
- my $showPoints =
- (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard')
- || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));
- my $notshowSPRSlink =
- (($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';
- my $showCategories=
- $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
-
-
- my $title = "Grading and Statistics";#$showPoints ? "Points Display" : "Completed Problems Display";
- my $brcrum = [{href=>"/adm/quickgrades",text => "Points Display"}];
- $r->print(&Apache::loncommon::start_page($title,undef,
- {'bread_crumbs' => $brcrum})
- );
+ unless ($reinitresult eq 'update') {
+ # Send header, don't cache this page
+ &Apache::loncommon::no_cache($r);
+ $r->send_http_header;
+ &startpage($r,$showPoints);
+ }
+ $r->rflush();
&startGradeScreen($r,'quick');
@@ -204,6 +219,14 @@ sub real_handler {
}
$r->rflush();
+ my $notshowSPRSlink =
+ (($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';
+ my $showCategories=
+ $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
+
my ($navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=
&getData($showPoints,$uname,$udom);
@@ -248,6 +271,14 @@ sub getAllStudentData {
}
}
+sub startpage {
+ my ($r,$showPoints) = @_;
+ my $title = "Grading and Statistics";#$showPoints ? "Points Display" : "Completed Problems Display";
+ my $brcrum = [{href=>"/adm/quickgrades",text => "Points Display"}];
+ $r->print(&Apache::loncommon::start_page($title,undef,
+ {'bread_crumbs' => $brcrum})
+ );
+}
sub startGradeScreen {
my ($r,$mode)=@_;
@@ -413,7 +444,7 @@ sub getData {
if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
if ($curRes == $iterator->END_MAP()) { $depth--; }
- if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout)
+ if (ref($curRes) && $curRes->is_gradable() && !$curRes->randomout)
{
# Get number of correct, incorrect parts
my $parts = $curRes->parts();