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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 27 Jun 2006 18:16:06 -0000


albertel		Tue Jun 27 14:16:06 2006 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  - some changes to use the course_type accessor
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.185 loncom/interface/lonmenu.pm:1.186
--- loncom/interface/lonmenu.pm:1.185	Mon Jun 12 14:10:37 2006
+++ loncom/interface/lonmenu.pm	Tue Jun 27 14:16:03 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.185 2006/06/12 18:10:37 albertel Exp $
+# $Id: lonmenu.pm,v 1.186 2006/06/27 18:16:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -194,22 +194,15 @@
 	    $navmaps=(<<ENDNAV);
 <td><a href="$link" target="_top">$lt{'nav'}</a></td>
 ENDNAV
+my $is_group = (&Apache::loncommon::course_type() eq 'Group');
 	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-                my $text = $lt{'docs'};
-                if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 
-                    'Group') {
-                    $text = $lt{'gdoc'};
-                } 
+                my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
 		$docs=(<<ENDDOCS);
 <td><a href="/adm/coursedocs" target="_top">$text</a></td>
 ENDDOCS
             }
             if ($showgroups) {
-                my $text = $lt{'groups'};
-                if ($env{'course.'.$env{'request.course.id'}.'.type'} eq
-                    'Group') {
-                    $text = $lt{'teams'};
-                }
+                my $text = ($is_group) ? $lt{'groups'} : $lt{'teams'};
                 $groups =(<<ENDGROUPS);
 <td><a href="/adm/coursegroups" target="_top">$text</a></td>
 ENDGROUPS
@@ -940,7 +933,7 @@
         $prt=~s/\$udom/$udom/g;
         $prt=~s/\$crs/$crs/g; 
         $prt=~s/\$requested_domain/$requested_domain/g;
-        my $type = $env{'course.'.$env{'request.course.id'}.'.type'};
+        my $type = &Apache::loncommon::course_type();
         if ($type eq 'Group') {
             $desc = &convert_menu_function($desc,$type);
         }
@@ -1272,6 +1265,8 @@
     return $navstatus;
 }
 
+#FIXME this needs to move into mydesktab and the other locations 
+# the text is generated
 sub convert_menu_function {
     my ($rolename,$type) = @_;
     if ($type eq 'Group') {