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

raeburn raeburn at source.lon-capa.org
Sat Aug 17 08:58:01 EDT 2019


raeburn		Sat Aug 17 12:58:01 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - For 2.11
    Backport 1.475, 1.476, 1.477, 1.479
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.77 loncom/interface/lonmenu.pm:1.369.2.78
--- loncom/interface/lonmenu.pm:1.369.2.77	Tue Aug  6 23:18:43 2019
+++ loncom/interface/lonmenu.pm	Sat Aug 17 12:58:00 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.369.2.77 2019/08/06 23:18:43 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.78 2019/08/17 12:58:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -735,7 +735,7 @@
         $newmail= 'swmenu.setstatus("you have","messages");';
     }
 
-    my ($mapurl,$resurl,$crstype);
+    my ($mapurl,$resurl,$crstype,$navmap);
 
     if ($env{'request.course.id'}) {
 #
@@ -743,13 +743,25 @@
 #
         $crstype = &Apache::loncommon::course_type();
         if ($env{'request.symb'}) {
-            ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
+            my $ignorenull;
+            unless ($env{'request.noversionuri'} eq '/adm/navmaps') {
+                $ignorenull = 1;
+            }
+            my $symb = &Apache::lonnet::symbread('','',$ignorenull);
+            ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb($symb);
             my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
 
             my $maptitle = &Apache::lonnet::gettitle($mapurl);
-            my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
+            my $restitle = &Apache::lonnet::gettitle($symb);
 
-            my @crumbs;
+            my (@crumbs, at mapcrumbs);
+            if (($env{'request.noversionuri'} ne '/adm/navmaps') && ($mapurl ne '') &&
+                ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'})) {
+                $navmap = Apache::lonnavmaps::navmap->new();
+                if (ref($navmap)) {
+                    @mapcrumbs = $navmap->recursed_crumbs($mapurl,$restitle);
+                }
+            }
             unless (($forcereg) && 
                     ($env{'request.noversionuri'} eq '/adm/navmaps') &&
                     ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
@@ -757,15 +769,22 @@
                             href  => "Javascript:gopost('/adm/navmaps','')"});
             }
             if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { 
-                push(@crumbs, {text  => '...',
-                               no_mt => 1});
+                if (@mapcrumbs) {
+                    push(@crumbs, at mapcrumbs);
+                } else {
+                    push(@crumbs, {text  => '...',
+                                   no_mt => 1});
+                }
             }
 
-            push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle 
-                                                       && $maptitle ne 'default.sequence' 
-                                                       && $maptitle ne $coursetitle);
-
-            push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
+            unless ((@mapcrumbs) || (!$maptitle) || ($maptitle eq 'default.sequence') ||
+                    ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
+                push @crumbs, {text => $maptitle, no_mt => 1,
+                               href => &Apache::lonnet::clutter($mapurl).'?navmap=1'};
+            }
+            if ($restitle && !@mapcrumbs) {
+                push(@crumbs,{text => $restitle, no_mt => 1});
+            }
             my @tools;
             if ($env{'request.filename'} =~ /\.page$/) {
                 my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
@@ -1537,7 +1556,8 @@
 #
         if (($perms{'mdc'}) &&
             (($resurl =~ m{^/?public/$cdom/$cnum/syllabus}) ||
-            ($resurl =~ m{^/?uploaded/$cdom/$cnum/portfolio/syllabus/}))) {
+            ($resurl =~ m{^/?uploaded/$cdom/$cnum/portfolio/syllabus/}) || 
+            (($resurl =~ m{^/?uploaded/$cdom/$cnum/default_\d+\.sequence$}) && ($env{'form.navmap'})))) {
             if ($resurl =~ m{^/}) {
                 $cfile = $resurl;
             } else {
@@ -1549,9 +1569,17 @@
             } else {
                 $forceedit = 1;
             }
-            $editbutton = &get_editbutton($cfile,$home,$switchserver,
-                                          $forceedit,$forceview,$forcereg,
-                                          $hostname);
+            if ($cfile =~ m{^/uploaded/$cdom/$cnum/default_\d+\.sequence$}) {
+                my $text = 'Edit Folder';
+                &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
+                        "gocmd('/adm/coursedocs','direct')",
+                        'Folder/Page Content');
+                $editbutton = 1;
+            } else {
+                $editbutton = &get_editbutton($cfile,$home,$switchserver,
+                                              $forceedit,$forceview,$forcereg,
+                                              $hostname);
+            }
         } elsif (($resurl eq '/adm/extresedit') &&
                  (($env{'form.symb'}) || ($env{'form.folderpath'}))) {
             ($cfile,$home,$switchserver,$forceedit,$forceview) =




More information about the LON-CAPA-cvs mailing list