[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface loncommon.pm

raeburn raeburn@source.lon-capa.org
Mon, 14 Dec 2009 22:40:45 -0000


raeburn		Mon Dec 14 22:40:45 2009 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	loncommon.pm 
  Log:
  - Customization for GCI_3
    CCs in Concept Test courses:
    - Role information blank if role is cm
    - Course role switcher below Name and Role
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.925.2.3 loncom/interface/loncommon.pm:1.925.2.4
--- loncom/interface/loncommon.pm:1.925.2.3	Tue Dec  8 05:00:15 2009
+++ loncom/interface/loncommon.pm	Mon Dec 14 22:40:45 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.925.2.3 2009/12/08 05:00:15 raeburn Exp $
+# $Id: loncommon.pm,v 1.925.2.4 2009/12/14 22:40:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4467,6 +4467,10 @@
 		   'link'    => &designparm($function.'.link',$domain),);
     @design{keys(%$addentries)} = @$addentries{keys(%$addentries)}; 
 
+    my $custommenu;
+    if ($env{'environment.remote'} eq 'off') {
+        $custommenu = &needs_gci_custom();
+    }
  # role and realm
     my ($role,$realm) = split(/\./,$env{'request.role'},2);
     if ($role  eq 'ca') {
@@ -4476,14 +4480,22 @@
 # realm
     if ($env{'request.course.id'}) {
         if ($env{'request.role'} !~ /^cr/) {
-            $role = &Apache::lonnet::plaintext($role,&course_type());
+            if (($custommenu) && ($role eq 'cm')) {
+                undef($role);
+            } else {
+                $role = &Apache::lonnet::plaintext($role,&course_type());
+            }
         }
         if ($env{'request.course.sec'}) {
             $role .= (' 'x2).'- '.&mt('section:').' '.$env{'request.course.sec'};
         }   
 	$realm = $env{'course.'.$env{'request.course.id'}.'.description'};
     } else {
-        $role = &Apache::lonnet::plaintext($role);
+        if (($custommenu) && ($role eq 'cm')) {
+            undef($role);
+        } else {
+            $role = &Apache::lonnet::plaintext($role);
+        }
     }
 
     if (!$realm) { $realm=' '; }
@@ -4527,7 +4539,6 @@
         if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') { 
             return $bodytag; 
         } 
-        my $custommenu = &needs_gci_custom(); 
 
         if ($env{'request.state'} eq 'construct') { $forcereg=1; }
 
@@ -4535,7 +4546,16 @@
         #        $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
         #    }
 
-
+        my $role_selector;
+        if (($custommenu) && ($env{'request.course.id'}) && 
+            ($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gcitest')) {
+            $role_selector = &Apache::lonmenu::roles_selector(
+                        $env{'course.' . $env{'request.course.id'} . '.domain'},
+                        $env{'course.' . $env{'request.course.id'} . '.num'}  );
+            if ($role_selector) {
+                $role_selector = '<br />'.$role_selector;
+            }
+        }
 
         if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
              if ($dc_info) {
@@ -4546,7 +4566,7 @@
             return $bodytag;
         }
 
-        $bodytag .= qq|<div id="LC_nav_bar">$name $role</div>|;
+        $bodytag .= qq|<div id="LC_nav_bar">$name $role $role_selector</div>|;
 
         $bodytag .= Apache::lonhtmlcommon::scripttag(
             Apache::lonmenu::utilityfunctions('',$custommenu), 'start');