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

raeburn raeburn at source.lon-capa.org
Mon Jun 7 02:05:49 EDT 2021


raeburn		Mon Jun  7 06:05:49 2021 EDT

  Modified files:              
    /loncom/interface	lonmainmenu.pm 
  Log:
  - Bug 6907
    In course context menu collection use can impact display of Main Menu. 
  
  
Index: loncom/interface/lonmainmenu.pm
diff -u loncom/interface/lonmainmenu.pm:1.12 loncom/interface/lonmainmenu.pm:1.13
--- loncom/interface/lonmainmenu.pm:1.12	Mon Jun 26 01:56:58 2017
+++ loncom/interface/lonmainmenu.pm	Mon Jun  7 06:05:49 2021
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the main menu
 #
-# $Id: lonmainmenu.pm,v 1.12 2017/06/26 01:56:58 raeburn Exp $
+# $Id: lonmainmenu.pm,v 1.13 2021/06/07 06:05:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,6 +39,7 @@
 use Apache::loncommon();
 use Apache::lonnet;
 use Apache::lonmenu();
+use Apache::lonlocal;
 
 sub handler {
     my $r = shift;
@@ -64,6 +65,27 @@
     $r->print(&Apache::loncommon::start_page( 'Main Menu',
                                                undef,
                                               {'bread_crumbs' => 1}));
+#
+# If menu collection is in effect in course context, and Main Menu is 
+# not included, display message in place of usual menu items.
+#
+    if ($env{'request.course.id'}) {
+        my ($menucoll,$deeplinkmenu,$menuref) =
+            &Apache::loncommon::menucoll_in_effect();
+        if ($menucoll) {
+            if (ref($menuref) eq 'HASH') {
+                if ($menuref->{'main'} eq 'n') {
+                    $r->print('<h3>'.&mt('Main Menu unavailable').'</h3>');
+                    unless ($deeplinkmenu) {
+                        my $crstype = &Apache::loncommon::course_type();
+                        $r->print('<p>'.&mt("Main Menu page is unavailable in this $crstype").'</p>');
+                    }
+                    $r->print(&Apache::loncommon::end_page());
+                    return OK;
+                }
+            }
+        }
+    }
     $r->print(&Apache::lonmenu::inlinemenu());
     $r->print(&Apache::loncommon::end_page());
     return OK;




More information about the LON-CAPA-cvs mailing list