[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonquickgrades.pm
raeburn
raeburn at source.lon-capa.org
Mon Dec 13 21:44:05 EST 2021
raeburn Tue Dec 14 02:44:05 2021 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lonquickgrades.pm
Log:
- For 2.11
Backport 1.117, 1.122
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.49.6.7 loncom/interface/lonquickgrades.pm:1.49.6.8
--- loncom/interface/lonquickgrades.pm:1.49.6.7 Thu Mar 4 01:42:20 2021
+++ loncom/interface/lonquickgrades.pm Tue Dec 14 02:44:05 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.49.6.7 2021/03/04 01:42:20 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.49.6.8 2021/12/14 02:44:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -64,6 +64,25 @@
my $reinitresult;
+ if ($env{'request.course.id'}) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $clientip = &Apache::lonnet::get_requestor_ip($r);
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('grades',$clientip,$cnum,$cdom);
+ if ($blocked) {
+ my $checkrole = "cm./$cdom/$cnum";
+ if ($env{'request.course.sec'} ne '') {
+ $checkrole .= "/$env{'request.course.sec'}";
+ }
+ unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) &&
+ ($env{'request.role'} !~ m{^st\./$cdom/$cnum})) {
+ &grades_blocked($r,$blocktext,$showPoints);
+ return OK;
+ }
+ }
+ }
+
unless ($cangrade) {
# Check for critical messages and redirect if present.
my ($redirect,$url) = &Apache::loncommon::critical_redirect(300);
@@ -188,6 +207,29 @@
return OK;
}
+sub grades_blocked {
+ my ($r,$blocktext,$caller) = @_;
+ my $title = 'Points Display';
+ if ($caller eq 'spreadsheet') {
+ $title = 'Spreadsheet';
+ } elsif ($env{'course.'.$env{'request.course.id'}.'.grading'} ne 'standard') {
+ $title = 'Completed Problems Display';
+ }
+ my $brcrum = [{href=>"/adm/quickgrades",text => $title}];
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/quickgrades',
+ text=> $title});
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs($title);
+ &Apache::loncommon::content_type($r,'text/html');
+ &Apache::loncommon::no_cache($r);
+ $r->send_http_header;
+ $r->print(&Apache::loncommon::start_page($title).
+ $breadcrumbs.
+ $blocktext.
+ &Apache::loncommon::end_page());
+ return;
+}
+
#
# Go through the complete course and collect data
#
More information about the LON-CAPA-cvs
mailing list