MDL-47113 lti: Add link to open in new window, when popup blocked
authorBen Kelada <ben.kelada@open.edu.au>
Wed, 4 May 2016 00:29:00 +0000 (10:29 +1000)
committerAdrian Greeve <adrian@moodle.com>
Mon, 20 Jun 2016 06:39:39 +0000 (14:39 +0800)
mod/lti/lang/en/lti.php
mod/lti/lib.php
mod/lti/view.php

index 324931e..10d50cb 100644 (file)
@@ -80,6 +80,7 @@ $string['basiclti'] = 'LTI';
 $string['basiclti_base_string'] = 'LTI OAuth base string';
 $string['basiclti_endpoint'] = 'LTI launch endpoint';
 $string['basiclti_in_new_window'] = 'Your activity has opened in a new window';
+$string['basiclti_in_new_window_open'] = 'Click here if the new window has not opened';
 $string['basiclti_parameters'] = 'LTI launch parameters';
 $string['basicltiactivities'] = 'LTI activities';
 $string['basicltifieldset'] = 'Custom example fieldset';
index ef72313..2df8030 100644 (file)
@@ -303,7 +303,7 @@ function lti_get_coursemodule_info($coursemodule) {
     $launchcontainer = lti_get_launch_container($lti, $toolconfig);
     if ($launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW) {
         $launchurl = new moodle_url('/mod/lti/launch.php', array('id' => $coursemodule->id));
-        $info->onclick = "window.open('" . $launchurl->out(false) . "', 'lti'); return false;";
+        $info->onclick = "window.open('" . $launchurl->out(false) . "', 'lti-".$coursemodule->id."'); return false;";
     }
 
     $info->name = $lti->name;
index e888164..ff1bdd7 100644 (file)
@@ -112,10 +112,11 @@ if ($lti->showdescriptionlaunch && $lti->intro) {
 
 if ( $launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW ) {
     echo "<script language=\"javascript\">//<![CDATA[\n";
-    echo "window.open('launch.php?id=".$cm->id."','lti');";
+    echo "window.open('launch.php?id=".$cm->id."','lti-".$cm->id."');";
     echo "//]]\n";
     echo "</script>\n";
     echo "<p>".get_string("basiclti_in_new_window", "lti")."</p>\n";
+    echo "<p> <a href='launch.php?id=".$cm->id."' target='_blank'>".get_string("basiclti_in_new_window_open", "lti")."</a></p>\n";
 } else {
     // Request the launch content with an iframe tag.
     echo '<iframe id="contentframe" height="600px" width="100%" src="launch.php?id='.$cm->id.'"></iframe>';