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

raeburn raeburn at source.lon-capa.org
Sat Apr 14 20:28:08 EDT 2018


raeburn		Sun Apr 15 00:28:08 2018 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm loncommon.pm 
  Log:
  - Bug 6754 LON-CAPA as LTI Provider
   - If original LTI launch of LON-CAPA specified display in an iframe, display
     Authoring Space directory in same iframe, when accessed via Edit in 
     Functions menu.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.486 loncom/interface/lonmenu.pm:1.487
--- loncom/interface/lonmenu.pm:1.486	Sat Apr 14 17:52:43 2018
+++ loncom/interface/lonmenu.pm	Sun Apr 15 00:28:07 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.486 2018/04/14 17:52:43 raeburn Exp $
+# $Id: lonmenu.pm,v 1.487 2018/04/15 00:28:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2053,6 +2053,11 @@
 
     my $countdown = &countdown_toggle_js();
 
+    my $ltitarget;
+    if ($env{'request.lti.login'}) {
+        $ltitarget = $env{'request.lti.target'};
+    }
+
     my $hostvar = '
 function setLCHost() {
     var lcHostname="";
@@ -2149,7 +2154,12 @@
        currentURL = null;
        currentSymb= null;
        var lcHostname = setLCHost();
-       top.location.href=lcHostname+url;
+       var ltitarget = '$ltitarget';
+       if (ltitarget == 'iframe') {
+           document.location.href=lcHostname+url;
+       } else {
+           top.location.href=lcHostname+url;
+       }
    }
 }
 
@@ -2243,15 +2253,20 @@
 }
 
 sub constspaceform {
+    my ($target,$printtarget);
+    unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+        $target = ' target="_top"';
+        $printtarget = ' target="_parent"';
+    }
     return(<<ENDCONSTSPACEFORM);
-<form name="constspace" action="/adm/logout" method="post" target="_top">
+<form name="constspace" action="/adm/logout" method="post"$target>
 <input type="hidden" name="filename" value="" />
 </form>
-<form name="cstrdelete" action="/adm/cfile" method="post" target="_top">
+<form name="cstrdelete" action="/adm/cfile" method="post"$target>
 <input type="hidden" name="action" value="delete" /> 
 <input type="hidden" name="filename" value="" />
 </form>
-<form name="cstrprint" action="/adm/printout" target="_parent" method="post">
+<form name="cstrprint" action="/adm/printout" method="post"$printtarget>
 <input type="hidden" name="postdata" value="" />
 <input type="hidden" name="curseed" value="" />
 <input type="hidden" name="problemtype" value="" />
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1312 loncom/interface/loncommon.pm:1.1313
--- loncom/interface/loncommon.pm:1.1312	Sat Apr 14 02:29:44 2018
+++ loncom/interface/loncommon.pm	Sun Apr 15 00:28:07 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1312 2018/04/14 02:29:44 raeburn Exp $
+# $Id: loncommon.pm,v 1.1313 2018/04/15 00:28:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5837,12 +5837,16 @@
         $title = &mt('Authoring Space');
     }
 
+    my $target;
+    if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+        $target = ' target="_top"'; #FIXME lonpubdir: target="_parent"
+    }
+
     my $output =
          '<div>'
         .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
         .'<b>'.$title.'</b> '
-        .'<form name="dirs" method="post" action="'.$formaction
-        .'" target="_top">' #FIXME lonpubdir: target="_parent"
+        .'<form name="dirs" method="post" action="'.$formaction.$target.'>'
         .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv/'.$udom,undef,undef);
 
     if ($lastitem) {




More information about the LON-CAPA-cvs mailing list