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

raeburn raeburn at source.lon-capa.org
Tue Apr 24 09:40:33 EDT 2018


raeburn		Tue Apr 24 13:40:33 2018 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonhtmlcommon.pm 
  Log:
  - Bug 6754 LON-CAPA as LTI Provider
    - If original LTI launch of LON-CAPA was for display in iframe linked  
      LON-CAPA items are displayed within the same iframe.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1313 loncom/interface/loncommon.pm:1.1314
--- loncom/interface/loncommon.pm:1.1313	Sun Apr 15 00:28:07 2018
+++ loncom/interface/loncommon.pm	Tue Apr 24 13:40:32 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1313 2018/04/15 00:28:07 raeburn Exp $
+# $Id: loncommon.pm,v 1.1314 2018/04/24 13:40:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1297,9 +1297,13 @@
     }
 
     # Add the text
+    my $target = ' target="_top"';
+    if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+        $target = '';
+    }
     if ($text ne "") {	
 	$template.='<span class="LC_help_open_topic">'
-                  .'<a target="_top" href="'.$link.'">'
+                  .'<a'.$target.' href="'.$link.'">'
                   .$text.'</a>';
     }
 
@@ -1309,7 +1313,7 @@
     if ($imgid ne '') {
         $imgid = ' id="'.$imgid.'"';
     }
-    $template.=' <a target="_top" href="'.$link.'" title="'.$title.'">'
+    $template.=' <a'.$target.' href="'.$link.'" title="'.$title.'">'
               .'<img src="'.$helpicon.'" border="0"'
               .' alt="'.&mt('Help: [_1]',$topic).'"'
               .' title="'.$title.'" style="vertical-align:middle;"'.$imgid 
@@ -1502,19 +1506,24 @@
     {
 	$link = $url;
     }
+
+    my $target = ' target="_top"';
+    if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+        $target = '';
+    }
     # Add the text
     if ($text ne "")
     {
 	$template .= 
   "<table bgcolor='#AA3333' cellspacing='1' cellpadding='1' border='0'><tr>".
-  "<td bgcolor='#FF5555'><a target=\"_top\" href=\"$link\"><span style=\"color:#FFFFFF;font-size:10pt;\">$text</span></a>";
+  "<td bgcolor='#FF5555'><a".$target." href=\"$link\"><span style=\"color:#FFFFFF;font-size:10pt;\">$text</span></a>";
     }
 
     # Add the graphic
     my $title = &mt('Report a Bug');
     my $bugicon=&lonhttpdurl("/adm/lonMisc/smallBug.gif");
     $template .= <<"ENDTEMPLATE";
- <a target="_top" href="$link" title="$title"><img src="$bugicon" border="0" alt="(Bug: $topic)" /></a>
+ <a$target href="$link" title="$title"><img src="$bugicon" border="0" alt="(Bug: $topic)" /></a>
 ENDTEMPLATE
     if ($text ne '') { $template.='</td></tr></table>' };
     return $template;
@@ -5837,17 +5846,18 @@
         $title = &mt('Authoring Space');
     }
 
-    my $target;
+    my ($target,$crumbtarget) = (' target="_top"','_top'); #FIXME lonpubdir: target="_parent"
     if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
-        $target = ' target="_top"'; #FIXME lonpubdir: target="_parent"
+        $target = '';
+        $crumbtarget = '';
     }
 
     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.'>'
-        .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv/'.$udom,undef,undef);
+        .'<form name="dirs" method="post" action="'.$formaction.'"'.$target.'>'
+        .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,$crumbtarget,'/priv/'.$udom,undef,undef);
 
     if ($lastitem) {
         $output .=
@@ -5861,7 +5871,7 @@
     } else {
         $output .=
              '<br />'
-            #FIXME lonpubdir: &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."</b></tt><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();
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.392 loncom/interface/lonhtmlcommon.pm:1.393
--- loncom/interface/lonhtmlcommon.pm:1.392	Sat Apr 14 02:29:44 2018
+++ loncom/interface/lonhtmlcommon.pm	Tue Apr 24 13:40:32 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.392 2018/04/14 02:29:44 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.393 2018/04/24 13:40:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -105,9 +105,13 @@
     $filter=&entity_encode($filter);
     $part=&entity_encode($part);
     if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) {
-       return "<a target='_top' href='/adm/parmset?symb=$symb&filter=$filter&part=$part'><span class='LC_setting'>$linktext</span></a>";
+        my $target=' target="_top"';
+        if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+            $target='';
+        }
+        return "<a".$target." href=\"/adm/parmset?symb=$symb&filter=$filter&part=$part\"><span class=\"LC_setting\">$linktext</span></a>";
     } else {
-       return $linktext;
+        return $linktext;
     }
 }
 ##############################################
@@ -1929,9 +1933,9 @@
                     }
                 }
             }
-            my $target;
-            unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
-                $target='_top';
+            my $target = '_top';
+            if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+                $target='';
             }
             $menulink =  {  href   =>'/adm/menu',
                             title  =>'Go to main menu',
@@ -1954,7 +1958,10 @@
                             class => 'LC_menubuttons_link',
                           };
             if ($env{'request.noversionuri'} eq '/adm/searchcat') {
-                $hashref->{'target'} = '_top'; 
+                $hashref->{'target'} = '_top';
+                if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+                    $hashref->{'target'} = '';
+                }
             }
             $links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />',
                              $hashref);




More information about the LON-CAPA-cvs mailing list