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

raeburn raeburn at source.lon-capa.org
Tue Jul 2 23:07:58 EDT 2024


raeburn		Wed Jul  3 03:07:58 2024 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonnavmaps.pm 
  Log:
  - For 2.11
    Backport 1.561, 1.562
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.509.2.16 loncom/interface/lonnavmaps.pm:1.509.2.17
--- loncom/interface/lonnavmaps.pm:1.509.2.16	Tue Jul  2 15:53:16 2024
+++ loncom/interface/lonnavmaps.pm	Wed Jul  3 03:07:58 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.509.2.16 2024/07/02 15:53:16 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.509.2.17 2024/07/03 03:07:58 raeburn Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -999,8 +999,12 @@
         if ($it->{CONDITION}) {
             $nowOpen = !$nowOpen;
         }
-	
-	my $folderType = $resource->is_sequence() ? 'folder' : 'page';
+	my $folderType;
+	if (&advancedUser() && $resource->is_missing_map()) {
+	    $folderType = 'none';
+	} else {
+	    $folderType = $resource->is_sequence() ? 'folder' : 'page';
+	}
         my $title=$resource->title;
 		$title=~s/\"/\&qout;/g;
         if (!$params->{'resource_no_folder_link'}) {
@@ -2868,8 +2872,12 @@
         my $pc = $map->map_pc();
         next if ((!$pc) || ($pc == 1));
         push(@links,$map);
-        push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,});
-        $totallength += length($map->title());
+        my $text = $map->title();
+        if ($text eq '') {
+            $text = '...';
+        }
+        push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $text,'no_mt' => 1,});
+        $totallength += length($text);
     }
     my $numlinks = scalar(@links);
     if ($numlinks) {
@@ -2881,7 +2889,11 @@
             }
             @revmapinfo = ();
             foreach my $map (@links) {
-                my $showntitle = &truncate_crumb_text($map->title(),$avg);
+                my $title = $map->title();
+                if ($title eq '') {
+                    $title = '...';
+                }
+                my $showntitle = &truncate_crumb_text($title,$avg);
                 if ($showntitle ne '') {
                     push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,});
                 }
@@ -4471,6 +4483,11 @@
     return $self->navHash("is_map_", 1) && 
     $self->navHash("map_type_" . $self->map_pc()) eq 'sequence';
 }
+sub is_missing_map {
+    my $self=shift;
+    return $self->navHash("is_map_", 1) &&
+    $self->navHash("map_type_" . $self->map_pc()) eq 'none';
+}
 sub is_survey {
     my $self = shift();
     my $part = shift();




More information about the LON-CAPA-cvs mailing list