MDL-47113 lti: Add link to open in new window, when popup blocked

This commit is contained in:
Ben Kelada
2016-06-20 14:39:39 +08:00
committed by Adrian Greeve
parent 49619ce243
commit b346737e75
3 changed files with 4 additions and 2 deletions
+1
View 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';
+1 -1
View 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;
+2 -1
View 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>';