[LON-CAPA-cvs] cvs: rat(version_2_11_X) / lonsequence.pm

raeburn raeburn at source.lon-capa.org
Wed Feb 6 18:45:14 EST 2019


raeburn		Wed Feb  6 23:45:14 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /rat	lonsequence.pm 
  Log:
  - For 2.11
    Backport 1.51
  
  
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.48 rat/lonsequence.pm:1.48.2.1
--- rat/lonsequence.pm:1.48	Mon Sep  4 23:47:17 2017
+++ rat/lonsequence.pm	Wed Feb  6 23:45:14 2019
@@ -2,7 +2,7 @@
 #
 # Sequence Handler
 #
-# $Id: lonsequence.pm,v 1.48 2017/09/04 23:47:17 raeburn Exp $
+# $Id: lonsequence.pm,v 1.48.2.1 2019/02/06 23:45:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -245,15 +245,23 @@
                }
            }
 
+           &Apache::loncommon::content_type($r,'text/html');
+           $r->send_http_header;
+
+           my $mapurl = &Apache::lonnet::declutter($requrl);
+           my $maptitle = &Apache::lonnet::gettitle($mapurl);
+           my @crumbs = ({text => $maptitle, no_mt => 1});
+           my $args = {'bread_crumbs' => \@crumbs,
+                       'bread_crumbs_nomenu' => 1};
+
            # Create the nav map
            my $navmap = Apache::lonnavmaps::navmap->new();
 
            if (ref($navmap)) {
                # renderer call
                if (&Apache::lonnet::is_on_map($requrl)) {
-                   my $mapurl = &Apache::lonnet::declutter($requrl);
-                   my @crumbs = ({text  => $crstype.' Contents',
-                                  href  => "javascript:gopost('/adm/navmaps','')"});
+                   @crumbs = ({text  => $crstype.' Contents',
+                               href  => "javascript:gopost('/adm/navmaps','')"});
                    my $res = $navmap->getResourceByUrl($mapurl);
                    if (ref($res)) {
                        my $symb = $res->symb();
@@ -268,13 +276,9 @@
                            $env{'request.symb'} = $symb;
                        }
                    }
-                   my $maptitle = &Apache::lonnet::gettitle($mapurl);
                    push(@crumbs,{text => $maptitle, no_mt => 1});
-                   my $args = {'bread_crumbs' => \@crumbs,
-                               'bread_crumbs_nomenu' => 1};
-                   &Apache::loncommon::content_type($r,'text/html');
-                   $r->send_http_header;
-
+                   $args = {'bread_crumbs' => \@crumbs,
+                            'bread_crumbs_nomenu' => 1};
                    $r->print(&Apache::loncommon::start_page($maptitle,undef,$args));
 
                    my $renderArgs = { 'cols'                    => [0,1,2,3],
@@ -294,14 +298,27 @@
 
                    # If no resources were found let the user know.
                    if ($renderArgs->{'counter'} == 0) {
-                       $r->print("<p><span class=\"LC_info\">".
-                                 &mt("This folder is empty.")."</span></p>");
+                       $r->print('<p class="LC_info">'.
+                                 &mt('No items found in folder').
+                                 '</p>');
                    }
                    $r->print(&Apache::loncommon::end_page());
-                   $r->rflush();
-                   return OK;
+               } else {
+                   $r->print(&Apache::loncommon::start_page($maptitle,undef,$args).
+                             '<p class="LC_info">'.
+                             &mt('Folder no longer appears to be a part of the course').
+                             '</p>'.
+                             &Apache::loncommon::end_page());
                }
+           } else {
+               $r->print(&Apache::loncommon::start_page($maptitle,undef,$args).
+                         '<p class="LC_warning">'.
+                         &mt('Error: could not determine contents of folder').
+                         '</p>'.
+                         &Apache::loncommon::end_page());
            }
+           $r->rflush();
+           return OK;
        }
    }
 




More information about the LON-CAPA-cvs mailing list