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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 21 Feb 2006 20:14:49 -0000


raeburn		Tue Feb 21 15:14:49 2006 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  Adding a "Groups" link in the inline menu to display a user's groups, if the user has any active groups. If the user has the vgr privilege, this will display all course groups to allow selectio of one for viewing.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.164 loncom/interface/lonmenu.pm:1.165
--- loncom/interface/lonmenu.pm:1.164	Thu Dec  1 14:00:46 2005
+++ loncom/interface/lonmenu.pm	Tue Feb 21 15:14:49 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.164 2005/12/01 19:00:46 albertel Exp $
+# $Id: lonmenu.pm,v 1.165 2006/02/21 20:14:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,7 +64,8 @@
                                                     'Roles':'Courses'),
                                        'docs' => 'Course Documents',
                                        'exit' => 'Exit',
-				       'launch' => 'Launch Remote Control');
+				       'launch' => 'Launch Remote Control',
+                                       'groups' => 'Groups');
 }
 
 # ============================= This gets called at the top of the body section
@@ -82,6 +83,8 @@
     my $navmaps='';
     my $reloadlink='';
     my $docs='';
+    my $groups='';
+    my $showgroups=0;
     my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
     my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
     my $face= 'face="Arial,Helvetica,sans-serif"';
@@ -92,6 +95,18 @@
             $escurl = &Apache::lonnet::escape($returnurl);
         }
     }
+    if ($env{'request.course.id'}) {
+        my %coursegroups;
+        my $viewgrps_permission =                                                
+                     &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+        if (!$viewgrps_permission) {
+            %coursegroups = &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'});
+        }
+        if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
+            $showgroups = 1;
+        }
+    }
+
     if ($env{'browser.interface'} eq 'textual') {
 # Textual display only
         $pgbg='#FFFFFF';
@@ -114,6 +129,12 @@
 <a href="/adm/coursedocs" target="_top"><font $face color="$font">$lt{'docs'}</font></a>
 ENDDOCS
             }
+            if ($showgroups) {
+                $groups =(<<ENDGROUPS);
+<td bgcolor="$tabbg">
+<a href="/adm/coursegroups" target="_top"><font $face color="$font">$lt{'groups'}</font></a></td>
+ENDGROUPS
+            }
 	}
         my $form=&serverform();
         my $utility=&utilityfunctions();
@@ -123,7 +144,7 @@
 $utility
 </script>
 <a href="/adm/menu" target="_top">$lt{'main'}</a>
-$reloadlink $navmaps $docs
+$reloadlink $navmaps $docs $groups
 <a href="/adm/roles" target="_top"><font $face color="$font">$lt{'roles'}</font></a>
 <a href="/adm/logout" target="_top"><font $face color="$font">$lt{'exit'}</font></a>
 <br />
@@ -192,6 +213,12 @@
 <a href="/adm/coursedocs" target="_top"><font $face color="$font">$lt{'docs'}</font></a></td>
 ENDDOCS
             }
+            if ($showgroups) {
+                $groups =(<<ENDGROUPS);
+<td bgcolor="$tabbg">
+<a href="/adm/coursegroups" target="_top"><font $face color="$font">$lt{'groups'}</font></a></td>
+ENDGROUPS
+            }
 	    if (
 		($env{'request.noversionuri'}=~m[^/(res|public)/] &&
 		 $env{'request.symb'} eq '')
@@ -239,6 +266,7 @@
 $reloadlink
 $navmaps
 $docs
+$groups
 <td bgcolor="$tabbg">
 <a href="/adm/remote?action=launch&amp;url=$escurl" target="_top">
 <font $face color="$font">$lt{'launch'}</font></a></td>