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

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


raeburn		Thu Oct  7 15:25:08 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	lonmainmenu.pm 
  Log:
  - Customization for GCI_3.
    - Don't redirect to Course Contents unless in course.
    - Expired roles excluded from role count.
  
  
Index: loncom/interface/lonmainmenu.pm
diff -u loncom/interface/lonmainmenu.pm:1.8.4.8 loncom/interface/lonmainmenu.pm:1.8.4.9
--- loncom/interface/lonmainmenu.pm:1.8.4.8	Mon Oct  4 18:54:46 2010
+++ loncom/interface/lonmainmenu.pm	Thu Oct  7 15:25:08 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the main menu
 #
-# $Id: lonmainmenu.pm,v 1.8.4.8 2010/10/04 18:54:46 raeburn Exp $
+# $Id: lonmainmenu.pm,v 1.8.4.9 2010/10/07 15:25:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,7 +61,7 @@
                        gci_5422913620b814c90gcil1 => 'tutorial',
                      );
     if (($custommenu && $cid ne '' && ($gcicourses{$cid} || $env{'request.role'} !~ m{^cc\./gcitest/})) || 
-        ($env{'user.domain'} eq 'gcitest')) {
+        ($cid ne '' && $env{'user.domain'} eq 'gcitest')) {
         $r->internal_redirect('/adm/navmaps');
         return OK;
     }
@@ -95,10 +95,14 @@
     $r->print(&Apache::loncommon::start_page('Main Menu',$script_tag,$args));
 
     my ($rolecount,$numcourses) = (0,0);
+    my $now = time;
     unless (($custommenu) || ($env{'user.domain'} eq 'gcitest')) {
        foreach my $envkey (keys(%env)) {
           next unless ($envkey =~ /^user\.role\./);
-          $rolecount ++;
+          my ($start,$end) = split(/\./,$env{$envkey});
+          if (($start eq '' || $start <= $now) && ($end eq '' || $end > $now)) { 
+              $rolecount ++;
+          }
        }
     }
     if ($custommenu) {