[LON-CAPA-cvs] cvs: rat / lonratmenu.pm loncom/interface loncommon.pm lonmenu.pm

raeburn raeburn at source.lon-capa.org
Fri May 27 00:35:37 EDT 2022


raeburn		Fri May 27 04:35:37 2022 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonmenu.pm 
    /rat	lonratmenu.pm 
  Log:
  - Bug 6907
    Authoring Space header menu items need target="_parent" when using "Advanced
    Edit" to edit maps, if context is deep-linked, and deeplink parameter
    includes "Embedded " flag. 
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1378 loncom/interface/loncommon.pm:1.1379
--- loncom/interface/loncommon.pm:1.1378	Tue May 24 16:23:03 2022
+++ loncom/interface/loncommon.pm	Fri May 27 04:35:36 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1378 2022/05/24 16:23:03 raeburn Exp $
+# $Id: loncommon.pm,v 1.1379 2022/05/27 04:35:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1310,8 +1310,8 @@
     if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = '';
     }
-    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
-        $target = ' target="'.$env{'request.deeplink.target'}.'"';
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {
+        $target = ''; 
     }
     if ($text ne "") {	
 	$template.='<span class="LC_help_open_topic">'
@@ -6230,6 +6230,10 @@
 Input: (optional) filename from which breadcrumb trail is built.
        In most cases no input as needed, as $env{'request.filename'}
        is appropriate for use in building the breadcrumb trail.
+       frameset flag
+       If page header is being requested for use in a frameset, then
+       the second (option) argument -- frameset will be true, and
+       the target attribute set for links should be target="_parent".
 
 Returns: HTML div with CSTR path and recent box
          To be included on Authoring Space pages
@@ -6237,7 +6241,7 @@
 =cut
 
 sub CSTR_pageheader {
-    my ($trailfile) = @_;
+    my ($trailfile,$frameset) = @_;
     if ($trailfile eq '') {
         $trailfile = $env{'request.filename'};
     }
@@ -6270,12 +6274,14 @@
         $title = &mt('Authoring Space');
     }
 
-    my ($target,$crumbtarget) = (' target="_top"','_top'); #FIXME lonpubdir: target="_parent"
-    if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+    my ($target,$crumbtarget) = (' target="_top"','_top');
+    if ($frameset) {
+        $target = ' target="_parent"';
+        $crumbtarget = '_parent';
+    } elsif (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = '';
         $crumbtarget = '';
-    }
-    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+    } elsif (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
         $target = ' target="'.$env{'request.deeplink.target'}.'"';
         $crumbtarget = $env{'request.deeplink.target'};
     }
@@ -6295,14 +6301,14 @@
     }
 
     if ($crsauthor) {
-        $output .= '</form>'.&Apache::lonmenu::constspaceform();
+        $output .= '</form>'.&Apache::lonmenu::constspaceform($frameset);
     } else {
         $output .=
              '<br />'
             #FIXME lonpubdir: &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/',$crumbtarget,'/priv','','+1',1)."</b></tt><br />"
             .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()')
             .'</form>'
-            .&Apache::lonmenu::constspaceform();
+            .&Apache::lonmenu::constspaceform($frameset);
     }
     $output .= '</div>';
 
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.517 loncom/interface/lonmenu.pm:1.518
--- loncom/interface/lonmenu.pm:1.517	Thu May 26 15:41:38 2022
+++ loncom/interface/lonmenu.pm	Fri May 27 04:35:36 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.517 2022/05/26 15:41:38 raeburn Exp $
+# $Id: lonmenu.pm,v 1.518 2022/05/27 04:35:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2481,11 +2481,17 @@
 }
 
 sub constspaceform {
+    my ($frameset) = @_;
     my ($target,$printtarget);
-    unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
-            (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
-        $target = ' target="_top"';
+    if ($frameset) {
+        $target = ' target="_parent"';
         $printtarget = ' target="_parent"';
+    } else {
+        unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+                (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
+            $target = ' target="_top"';
+            $printtarget = ' target="_parent"';
+        }
     }
     return(<<ENDCONSTSPACEFORM);
 <form name="constspace" action="/adm/logout" method="post"$target>
Index: rat/lonratmenu.pm
diff -u rat/lonratmenu.pm:1.21 rat/lonratmenu.pm:1.22
--- rat/lonratmenu.pm:1.21	Fri Feb  5 17:46:08 2016
+++ rat/lonratmenu.pm	Fri May 27 04:35:37 2022
@@ -2,7 +2,7 @@
 # Build menu bar for Advanced RAT. Uses javascript code originally in
 # static file: rat/client/code.html, now in  rat/client/ratcode.js  
 #
-# $Id: lonratmenu.pm,v 1.21 2016/02/05 17:46:08 damieng Exp $
+# $Id: lonratmenu.pm,v 1.22 2022/05/27 04:35:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,10 +46,16 @@
     my $readfile=$r->uri;
     $readfile=~s/\/loadonly\/adveditmenu$//;
 
+    my $target = '_top';
+    if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+         (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'}))) {
+        $target = '_parent';
+    }
+
     # Breadcrumbs
     my $brcrum = [{'href' => &Apache::loncommon::authorspace($r->uri),
                    'text' => 'Authoring Space',
-                   'target' => '_top'},
+                   'target' => $target},
                   {'href' => '',
                    'text' => 'RAT'},
                   {'href' => '',
@@ -133,6 +139,7 @@
 
     # Print Advanced RAT page header
     $r->send_http_header('text/html');
+    my $frameset = 1;
 
     $r->print(
         &Apache::loncommon::start_page(
@@ -142,7 +149,7 @@
              'bread_crumbs' => $brcrum,})
 
        .&Apache::loncommon::head_subbox(
-            &Apache::loncommon::CSTR_pageheader()
+            &Apache::loncommon::CSTR_pageheader('',$frameset)
            .$functions)
 
        .&Apache::loncommon::end_page()




More information about the LON-CAPA-cvs mailing list