--- loncom/interface/lonquickgrades.pm 2010/12/03 15:21:35 1.54 +++ loncom/interface/lonquickgrades.pm 2010/12/03 21:33:52 1.55 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Quick Student Grades Display # -# $Id: lonquickgrades.pm,v 1.54 2010/12/03 15:21:35 www Exp $ +# $Id: lonquickgrades.pm,v 1.55 2010/12/03 21:33:52 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,9 +61,9 @@ sub real_handler { &Apache::loncommon::no_cache($r); $r->send_http_header; - my $showPoints = + my $showPoints = $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 'externalnototals')); my $notshowTotals= @@ -72,25 +72,13 @@ sub real_handler { $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'; - # Header 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}) ); - $r->print(&Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading')); - - if (!$showPoints && !$notshowSPRSlink ) { - $r->print('

' - .&mt('This screen shows how many problems (or problem parts) you have completed' - .', and how many you have not yet done.' - .' You can also look at [_1]a detailed score sheet[_2].' - ,'','') - .'

'); - } - - $r->print('

'.&mt('This may take a few moments to display.').'

'); + &startGradeScreen($r,'quick'); $r->rflush(); @@ -110,10 +98,56 @@ sub real_handler { &outputTable($r,$showPoints,$notshowTotals, $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted); } + &endGradeScreen($r); return OK; } +sub startGradeScreen { + my ($r,$mode)=@_; + + my $showPoints = + $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard'; + my $notshowSPRSlink = + (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external') + || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals') + || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories')); + my $notshowTotals= + $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals'; + my $showCategories= + $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'; + + my $allowed_to_view = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); + my $allowed_to_edit = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); + + if ($allowed_to_view) { + $r->print(''); + if ($notshowTotals) { $r->print (''); } + if ($notshowSPRSlink){ $r->print (''); } + if ($showPoints) { $r->print (''); } + if ($showCategories) { $r->print (''); } + $r->print('
'.&mt('Students do not see total points.').''.&mt('Students do not see link to spreadsheet.').''.&mt('Students will see points based on problem weights.').''.&mt('Students will see points based on categories.').''.&Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading').'
'); + } + + + $r->print(''); + $r->print('
'); +} + +sub endGradeScreen { + my ($r)=@_; + $r->print('
'); +} + + sub getData { my ($showPoints,$uname,$udom)=@_;