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

raeburn raeburn@source.lon-capa.org
Thu, 07 Oct 2010 15:39:27 -0000


raeburn		Thu Oct  7 15:39:27 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	lonmenu.pm 
  Log:
  - Customization for GCI_3.
    - Home link in primary menu only shown to GCI Faculty
    - Roles link in primary menu
    - Skip all but first link in secondary menu unless in course or CSTR.
    - No "Return to Last Location" unless in course.
    - Backport 1.339. 
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.309.2.16 loncom/interface/lonmenu.pm:1.309.2.17
--- loncom/interface/lonmenu.pm:1.309.2.16	Mon Oct  4 23:00:46 2010
+++ loncom/interface/lonmenu.pm	Thu Oct  7 15:39:27 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.309.2.16 2010/10/04 23:00:46 raeburn Exp $
+# $Id: lonmenu.pm,v 1.309.2.17 2010/10/07 15:39:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -183,9 +183,9 @@
         next if    $$menuitem[4]        eq 'gci'
                 && (!$custommenu || $env{'request.role'} =~ m{^st\./gcitest/});
         next if    $$menuitem[4]        eq 'home'
-                && $custommenu;
+                && (($custommenu) || ($env{'user.domain'} eq 'gcitest'));
         next if    $$menuitem[4]        eq 'gcitest'
-                && $env{'user.domain'}  eq 'gci';
+                && (($env{'user.domain'} eq 'gci') || ($env{'request.role'} eq 'cm'));
         next if    $$menuitem[4]        eq 'roles'     # hide links which are
                 && $custommenu;                        # not visible when GCI
         next if    $$menuitem[4]        eq 'courses'   # tabbed interface in use
@@ -224,11 +224,15 @@
                      $env{'course.' . $env{'request.course.id'} . '.num'});
     my $custommenu = &Apache::loncommon::needs_gci_custom();
     my $numdc = &Apache::loncommon::check_for_gci_dc();
+    my $role = $env{'request.role'};
     foreach my $menuitem (@secondary_menu) {
         # evaluate conditions 
         next if    ref($menuitem)  ne 'ARRAY';
         next if    $$menuitem[4]   eq 'showmenu'
-                && ($custommenu || !$numdc);   
+                && ($custommenu || (!$numdc && $role eq 'cm'));
+        next if    $$menuitem[4]   ne 'showmenu'
+                && $$menuitem[4]   ne 'author'
+                && !$env{'request.course.id'};
         next if    $$menuitem[4]   eq 'showreturn'
                 && !$showlink
                 && !($env{'request.state'} eq 'construct');
@@ -250,7 +254,7 @@
                 && !$canviewgrps
                 && !%groups;
         next if   $$menuitem[4]  eq 'showroles'
-                && ($custommenu || !$numdc);
+                && ($custommenu || !$numdc || ($numdc && $env{'request.noversionuri'} eq '/adm/roles'));
         if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'} && !$custommenu) {
             # special treatment for role selector
             my $roles_selector = &roles_selector(
@@ -529,6 +533,7 @@
 }
 
 sub show_return_link {
+    return unless ($env{'request.course.id'});
     if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
         || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
         return if ($env{'form.register'});
@@ -2333,7 +2338,7 @@
             secok = 0;
             var numrolesec = rolesections[selidx].length;
             var msgidx = numsec[selidx] - numrolesec;
-            secchoice = prompt("$lt{'this'} "+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],"");
+            secchoice = prompt("$lt{'this'}\\n"+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],"");
             if (secchoice == '') {
                 if (msgidx > 0) {
                     secok = 1;