[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Tue Aug 6 12:49:02 EDT 2019


raeburn		Tue Aug  6 16:49:02 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - For 2.11
    Backport 1.439, 1.497, 1.498
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.75 loncom/interface/lonmenu.pm:1.369.2.76
--- loncom/interface/lonmenu.pm:1.369.2.75	Sat Jul 27 16:25:41 2019
+++ loncom/interface/lonmenu.pm	Tue Aug  6 16:49:01 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.369.2.75 2019/07/27 16:25:41 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.76 2019/08/06 16:49:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -399,7 +399,8 @@
     my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec);
     my $author        = &getauthor();
 
-    my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv);
+    my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv,$grouptools);
+    $grouptools = 0; 
     if ($env{'request.course.id'}) {
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -422,6 +423,16 @@
                 $showresv = 1;
             }
         }
+        if ($env{'request.course.groups'} ne '') {
+            foreach my $group (split(/:/,$env{'request.course.groups'}) {
+                next unless ($group =~ /^\w+$/);
+                my @privs = split(/:/,$env{"user.priv.$env{'request.role'}./$cdom/$cnum/$group"});
+                shift(@privs);
+                if (@privs) {
+                    $grouptools ++;
+                }
+            }
+        }
     }
 
     my ($canmodifycoauthor);
@@ -433,11 +444,6 @@
         }
     }
 
-    my %groups = &Apache::lonnet::get_active_groups(
-                     $env{'user.domain'}, $env{'user.name'},
-                     $env{'course.' . $env{'request.course.id'} . '.domain'},
-                     $env{'course.' . $env{'request.course.id'} . '.num'});
-
     my ($roleswitcher_js,$roleswitcher_form);
 
     foreach my $menuitem (@secondary_menu) {
@@ -469,7 +475,7 @@
         next if    $$menuitem[4]   eq 'params'
                 && (!$canmodpara && !$canviewpara);
         next if    $$menuitem[4]   eq 'nvcg'
-                && ($canviewgrps || !%groups);
+                && ($canviewgrps || !$grouptools);
         next if    $$menuitem[4]   eq 'showsyllabus'
                 && !$showsyllabus;
         next if    $$menuitem[4]   eq 'showfeeds'




More information about the LON-CAPA-cvs mailing list