Skip to content

Commit

Permalink
MDL-79675 enrol_lti: fix deep linking return after library removals
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed Mar 6, 2024
1 parent 2a783ec commit 73ce114
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions enrol/lti/configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
use enrol_lti\local\ltiadvantage\repository\application_registration_repository;
use enrol_lti\local\ltiadvantage\repository\deployment_repository;
use enrol_lti\local\ltiadvantage\repository\published_resource_repository;
use Packback\Lti1p3\LtiDeepLinkResource;
use Packback\Lti1p3\DeepLinkResources\Resource;
use Packback\Lti1p3\LtiConstants;
use Packback\Lti1p3\LtiLineitem;
use Packback\Lti1p3\LtiMessageLaunch;
use Packback\Lti1p3\LtiServiceConnector;
Expand Down Expand Up @@ -64,7 +65,7 @@
$contentitems = [];
foreach ($resources as $resource) {

$contentitem = LtiDeepLinkResource::new()
$contentitem = Resource::new()
->setUrl($CFG->wwwroot . '/enrol/lti/launch.php')
->setCustomParams(['id' => $resource->get_uuid()])
->setTitle($resource->get_name());
Expand All @@ -91,5 +92,13 @@
$PAGE->set_pagelayout('popup');
echo $OUTPUT->header();
$dl = $messagelaunch->getDeepLink();
$dl->outputResponseForm($contentitems);

$formactionurl = $messagelaunch->getLaunchData()[LtiConstants::DL_DEEP_LINK_SETTINGS]['deep_link_return_url'];
echo <<<HTML
<form id="auto_submit" action="{$formactionurl}" method="POST">
<input type="hidden" name="JWT" value="{$messagelaunch->getDeepLink()->getResponseJwt($contentitems)}" />
<input type="submit" name="Go" />
</form>
<script>document.getElementById('auto_submit').submit();</script>
HTML;

0 comments on commit 73ce114

Please sign in to comment.