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

raeburn raeburn at source.lon-capa.org
Tue Sep 4 15:48:58 EDT 2018


raeburn		Tue Sep  4 19:48:58 2018 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonnavmaps.pm 
  Log:
  - For 2.11
    Backport 1.540
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.509.2.6 loncom/interface/lonnavmaps.pm:1.509.2.7
--- loncom/interface/lonnavmaps.pm:1.509.2.6	Sun Apr 29 15:52:08 2018
+++ loncom/interface/lonnavmaps.pm	Tue Sep  4 19:48:58 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.509.2.6 2018/04/29 15:52:08 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.509.2.7 2018/09/04 19:48:58 raeburn Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -941,7 +941,28 @@
     # links to open and close the folder
 
     my $whitespace = $location.'/whitespace_21.gif';
-    my $linkopen = "<img src='$whitespace' alt='' />"."<a href=\"$link\">";
+    my $linkopen = "<img src='$whitespace' alt='' />";
+    my $nomodal;
+    if (($params->{'modalLink'}) && (!$resource->is_sequence())) {
+        if ($link =~m{^(?:|/adm/wrapper)/ext/([^#]+)}) {
+            my $exturl = $1;
+            if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
+                $nomodal = 1;
+            }
+        } elsif (($link eq "/public/$LONCAPA::match_domain/$LONCAPA::match_courseid/syllabus") &&
+                 ($env{'request.course.id'}) && ($ENV{'SERVER_PORT'} == 443) &&
+                 ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+             $nomodal = 1;
+        }
+        my $esclink = &js_escape($link);
+        if ($nomodal) {
+            $linkopen .= "<a href=\"#\" onclick=\"javascript:window.open('$esclink','resourcepreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1'); return false;\" />";
+        } else {
+            $linkopen .= "<a href=\"$link\" onclick=\"javascript:openMyModal('$esclink',600,500,'yes','true'); return false;\">";
+        }
+    } else {
+        $linkopen .= "<a href=\"$link\">";
+    }
     my $linkclose = "</a>";
 
     # Default icon: unknown page
@@ -1066,10 +1087,19 @@
     }
 
     if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {
-        $result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>";
-    } else {
-        $result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>";
+        $linkclose = '</a>';
+        if ($params->{'modalLink'}) {
+            my $esclink = &js_escape($link);
+            if ($nomodal) {
+                $linkopen = "<a href=\"#\" onclick=\"javascript:window.open('$esclink','resourcepreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1'); return false;\" />";
+            } else {
+                $linkopen = "<a href=\"$link\" onclick=\"javascript:openMyModal('$esclink',600,500,'yes','true'); return false;\">";
+            }
+        } else {
+            $linkopen = "<a href=\"$link\">";
+        }
     }
+    $result .= "$curMarkerBegin$linkopen$title$partLabel$linkclose$curMarkerEnd$editmapLink$nonLinkedText</td>";
 
     return $result;
 }
@@ -1690,6 +1720,11 @@
     }
 
 
+    my $inhibitmenu;
+    if ($args->{'modalLink'}) {
+        $inhibitmenu = '&inhibitmenu=yes';
+    }
+
     while (1) {
 	if ($args->{'sort'}) {
 	    $curRes = shift(@resources);
@@ -1826,7 +1861,7 @@
 	    my $srcHasQuestion = $src =~ /\?/;
 	    $args->{"resourceLink"} = $src.
 		($srcHasQuestion?'&':'?') .
-		'symb=' . &escape($symb).$anchor;
+		'symb=' . &escape($symb).$inhibitmenu.$anchor;
 	}
         # Now, we've decided what parts to show. Loop through them and
         # show them.




More information about the LON-CAPA-cvs mailing list