[LON-CAPA-cvs] cvs: loncom /interface lonblockingmenu.pm lonblockingstatus.pm loncommon.pm lonquickgrades.pm /interface/spreadsheet lonspreadsheet.pm /misc releaseslist.xml

raeburn raeburn at source.lon-capa.org
Mon Aug 10 15:28:22 EDT 2020


raeburn		Mon Aug 10 19:28:22 2020 EDT

  Modified files:              
    /loncom/interface	lonblockingmenu.pm lonblockingstatus.pm 
                     	loncommon.pm lonquickgrades.pm 
    /loncom/interface/spreadsheet	lonspreadsheet.pm 
    /loncom/misc	releaseslist.xml 
  Log:
  - Blocking of user actions during an exam can include a student's access to
    course grades via the "Grades" menu item, and to a "detailed score sheet"
    if grading is set to use the Spreadsheet.
  
  
-------------- next part --------------
Index: loncom/interface/lonblockingmenu.pm
diff -u loncom/interface/lonblockingmenu.pm:1.26 loncom/interface/lonblockingmenu.pm:1.27
--- loncom/interface/lonblockingmenu.pm:1.26	Fri Jan 12 13:33:38 2018
+++ loncom/interface/lonblockingmenu.pm	Mon Aug 10 19:28:21 2020
@@ -2,7 +2,7 @@
 # Routines for configuring blocking of access to collaborative functions, 
 # and specific resources during an exam
 #
-# $Id: lonblockingmenu.pm,v 1.26 2018/01/12 13:33:38 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.27 2020/08/10 19:28:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -620,6 +620,7 @@
             '<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n".
             '<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n".
             '<li>'.&mt("generating printouts of $lctype content").'</li>'.
+            '<li>'.&mt("displaying the LON-CAPA gradebook in the $lctype").'</li>'.
             '<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'.
             '<li>'.&mt("changing user's own password").'</li>'.
             '</ul>'.
@@ -1656,10 +1657,11 @@
         'docs' => 'Content',
         'printout' => 'Printouts',
         'passwd' => 'Change Password',
+        'grades' => 'Gradebook',
         'alert'  => 'Critical Alert',
         'reinit' => 'Course Re-init',
     );
-    my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','alert','reinit','passwd'];
+    my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','grades','alert','reinit','passwd'];
     return ($typeorder,\%types);
 }
 
Index: loncom/interface/lonblockingstatus.pm
diff -u loncom/interface/lonblockingstatus.pm:1.14 loncom/interface/lonblockingstatus.pm:1.15
--- loncom/interface/lonblockingstatus.pm:1.14	Thu Jan 23 23:48:12 2020
+++ loncom/interface/lonblockingstatus.pm	Mon Aug 10 19:28:21 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the blocking status table
 #
-# $Id: lonblockingstatus.pm,v 1.14 2020/01/23 23:48:12 raeburn Exp $
+# $Id: lonblockingstatus.pm,v 1.15 2020/08/10 19:28:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,7 +44,7 @@
     return OK if $r->header_only;
 
     my (%activities,$activity,$origurl);
-    map { $activities{$_} = 1; } ('boards','chat','com','blogs','groups','port','printout','docs','passwd');
+    map { $activities{$_} = 1; } ('boards','chat','com','blogs','groups','port','printout','docs','grades','passwd');
 
     # determine what kind of blocking we want details for
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['activity','url']);
@@ -119,13 +119,15 @@
                    printout   => 'Printout generation', 
                    docs       => 'Course Content',
                    passwd     => 'Changing of passwords',
+                   grades     => 'Course Gradebook',
                 );
 
     if ($activity eq 'groups' || $activity eq 'boards') {
         if (&Apache::loncommon::course_type() eq 'Community') {
-            $descs{'boards'} = 'Discussion posts in this community',
-            $descs{'groups'} = 'Groups in this community',
-            $descs{'docs'} = 'Community Content',  
+            $descs{'boards'} = 'Discussion posts in this community';
+            $descs{'groups'} = 'Groups in this community';
+            $descs{'docs'} = 'Community Content';
+            $descs{'grades'} = 'Community Gradebook'; 
         }
     }
 
@@ -149,7 +151,7 @@
                          . ' view will be unavailable between [_1] and [_2] because'
                          . ' access to selected '.$description.' is being blocked.'
                          ,$showstart, $showend);
-        } elsif (($activity eq 'printout') || ($activity eq 'passwd')) {
+        } elsif (($activity eq 'printout') || ($activity eq 'passwd') || ($activity eq 'grades')) {
             $output = mt( $description
                           . ' will be unavailable between [_1] and [_2] because'
                           . ' this functionality is being blocked.'
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1344 loncom/interface/loncommon.pm:1.1345
--- loncom/interface/loncommon.pm:1.1344	Wed Jul  1 20:08:54 2020
+++ loncom/interface/loncommon.pm	Mon Aug 10 19:28:21 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1344 2020/07/01 20:08:54 raeburn Exp $
+# $Id: loncommon.pm,v 1.1345 2020/08/10 19:28:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5489,6 +5489,8 @@
         $text = &mt('Printing Blocked');
     } elsif ($activity eq 'passwd') {
         $text = &mt('Password Changing Blocked');
+    } elsif ($activity eq 'grades') {
+        $text = &mt('Gradebook Blocked');
     } elsif ($activity eq 'alert') {
         $text = &mt('Checking Critical Messages Blocked');
     } elsif ($activity eq 'reinit') {
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.116 loncom/interface/lonquickgrades.pm:1.117
--- loncom/interface/lonquickgrades.pm:1.116	Mon May 25 04:17:47 2020
+++ loncom/interface/lonquickgrades.pm	Mon Aug 10 19:28:21 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.116 2020/05/25 04:17:47 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.117 2020/08/10 19:28:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -83,6 +83,24 @@
 
     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 ($blocked,$blocktext) =
+            &Apache::loncommon::blocking_status('grades',$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,'grades');
@@ -243,6 +261,29 @@
 
 }
 
+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;
+}
+
 sub getStudentCatGrade {
     my ($uname,$udom,%categories)=@_;
     my ($navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.65 loncom/interface/spreadsheet/lonspreadsheet.pm:1.66
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.65	Mon Jul 15 16:13:26 2013
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Mon Aug 10 19:28:21 2020
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.65 2013/07/15 16:13:26 bisitz Exp $
+# $Id: lonspreadsheet.pm,v 1.66 2020/08/10 19:28:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -241,6 +241,28 @@
     }
 
     #
+    # Check if display of course gradebook is blocked
+    #
+
+    if ($env{'request.course.id'}) {
+        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        my ($blocked,$blocktext) =
+            &Apache::loncommon::blocking_status('grades',$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})) {
+                &Apache::lonquickgrades::grades_blocked($r,$blocktext,'spreadsheet');
+                return OK;
+            }
+        }
+    }
+
+    #
     # Do not allow users without vgr or mgr priv to continue unless 
     # grading type is set to spreadsheet. 
     #
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.19 loncom/misc/releaseslist.xml:1.20
--- loncom/misc/releaseslist.xml:1.19	Sun Jan  6 15:27:53 2019
+++ loncom/misc/releaseslist.xml	Mon Aug 10 19:28:22 2020
@@ -6,6 +6,7 @@
 <course name="commblock" value="passwd">2.12</course>
 <course name="commblock" value="reinit">2.12</course>
 <course name="commblock" value="alert">2.12</course>
+<course name="commblock" value="grades">2.12</course>
 <course name="courserestype" value="exttool">2.12</course>
 <parameter name="type" value="anonsurvey">2.10</parameter>
 <parameter name="type" value="anonsurveycred">2.10</parameter>


More information about the LON-CAPA-cvs mailing list