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

raeburn raeburn at source.lon-capa.org
Sun Feb 2 22:04:24 EST 2025


raeburn		Mon Feb  3 03:04:24 2025 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - xhtml validation. Omit <table></table> when course is empty.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.569 loncom/interface/lonnavmaps.pm:1.570
--- loncom/interface/lonnavmaps.pm:1.569	Mon Feb  3 00:08:31 2025
+++ loncom/interface/lonnavmaps.pm	Mon Feb  3 03:04:24 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.569 2025/02/03 00:08:31 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.570 2025/02/03 03:04:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -48,7 +48,8 @@
 
 =head1 OVERVIEW
 
-X<lonnavmaps, overview> When a user enters a course, LON-CAPA examines the
+X<lonnavmaps, overview>
+When a user enters a course, LON-CAPA examines the
 course structure and caches it in what is often referred to as the
 "big hash" X<big hash>. You can see it if you are logged into
 LON-CAPA, in a course, by going to /adm/test. The content of 
@@ -1575,7 +1576,12 @@
     
     while (($curRes = $mapIterator->next()) && !$foundJump) {
         if (ref($curRes)) { $counter++; }
-        
+        # Speed up display after course initialization
+        # when $jump is empty. Note: we still need
+        # $counter to be 1 in that case if there is at
+        # least one resource.
+        last if (($jump eq '') && ($counter));
+
         if (ref($curRes) && $jump eq $curRes->symb()) {
             
             # This is why we have to use the main iterator instead of the
@@ -1702,7 +1708,9 @@
     $result .= "<br />\n";
 
     # Data
-    $result.=&Apache::loncommon::start_data_table("LC_tableOfContent");    
+    if ($counter) {
+        $result.=&Apache::loncommon::start_data_table("LC_tableOfContent");
+    }
 
     my $res = "Apache::lonnavmaps::resource";
     my %condenseStatuses =
@@ -2100,7 +2108,9 @@
 	}
     }
 
-    $result.=&Apache::loncommon::end_data_table();
+    if ($counter) { 
+        $result.=&Apache::loncommon::end_data_table();
+    }
     
     # Print out the part that jumps to #curloc if it exists
     # delay needed because the browser is processing the jump before




More information about the LON-CAPA-cvs mailing list