[LON-CAPA-cvs] cvs: rat / lonpageflip.pm loncom/interface londocs.pm lonmenu.pm

raeburn raeburn at source.lon-capa.org
Sun Dec 30 14:47:06 EST 2018


raeburn		Sun Dec 30 19:47:06 2018 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonmenu.pm 
    /rat	lonpageflip.pm 
  Log:
  - Bug 6806 Use of an External Resource URL which includes an anchor will 
    cause page to be loaded in iframe at anchor position.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.658 loncom/interface/londocs.pm:1.659
--- loncom/interface/londocs.pm:1.658	Sat Dec 29 23:24:39 2018
+++ loncom/interface/londocs.pm	Sun Dec 30 19:47:02 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.658 2018/12/29 23:24:39 raeburn Exp $
+# $Id: londocs.pm,v 1.659 2018/12/30 19:47:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4183,9 +4183,8 @@
                     if ($url =~ /^([^#]+)#([^#]+)$/) {
                         $url = $1;
                         $anchor = $2;
-                        if ($symb =~ m{^([^#]+)\Q#$anchor\E$}) {
-                            $shownsymb = $1.&escape('#').$anchor;
-                        }
+                        my $escan = &escape('#');
+                        $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/;
                     }
                 }
                 unless ($env{'request.role.adv'}) {
@@ -4437,8 +4436,7 @@
        } else {
            $link = $url;
        }
-       $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.
-                                               (($anchor ne '')?$anchor:''));
+       $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.$anchor);
        if ($nomodal) {
            $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
                   '<img src="'.$icon.'" alt="" class="LC_icon" border="0" /></a>';
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.494 loncom/interface/lonmenu.pm:1.495
--- loncom/interface/lonmenu.pm:1.494	Sat Dec 29 23:24:40 2018
+++ loncom/interface/lonmenu.pm	Sun Dec 30 19:47:02 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.494 2018/12/29 23:24:40 raeburn Exp $
+# $Id: lonmenu.pm,v 1.495 2018/12/30 19:47:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2094,7 +2094,8 @@
         if ($env{'request.external.querystring'}) {
             $currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};
         }
-        if ($currentsymb =~ /(\#[^\#]+)$/) {
+        my ($anchor) = ($env{'request.symb'} =~ /(\#[^\#]+)$/);
+        if (($anchor) && ($currenturl !~ /\Q$anchor\E$/)) {
             $currenturl .= $1;
         }
     }
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.100 rat/lonpageflip.pm:1.101
--- rat/lonpageflip.pm:1.100	Sat Dec 29 23:24:58 2018
+++ rat/lonpageflip.pm	Sun Dec 30 19:47:06 2018
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.100 2018/12/29 23:24:58 raeburn Exp $
+# $Id: lonpageflip.pm,v 1.101 2018/12/30 19:47:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -472,7 +472,7 @@
 	      return REDIRECT;
           }
       }
-      if ($direction eq 'return') { 
+      if ($direction eq 'return') {
 # -------------------------------------------------------- Return to last known
          my ($newloc,$usehttp);
          if (($last) && (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
@@ -484,10 +484,11 @@
                 $usehttp = &check_http_req(\$newloc);
 		if ($hash{'encrypted_'.$id}) { 
                     $newloc=&Apache::lonenc::encrypted($newloc);
-                } elsif ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)(?:|\#([^\#]+))$}) {
+                }
+                if ($newloc =~ m{^(/adm/wrapper/ext/[^\#]+)(?:|(\#[^\#]+))$}) {
                     my ($url,$anchor) = ($1,$2);
                     if ($anchor) {
-                        $newloc = $url.(($url=~/\?/)?'&':'?').'symb='.&escape($last);
+                        $newloc = $url.(($url=~/\?/)?'&':'?').'symb='.&escape($last).$anchor;
                     }
                 }
 	    } else {




More information about the LON-CAPA-cvs mailing list