diff --git a/fuel/app/classes/controller/lti/test.php b/fuel/app/classes/controller/lti/test.php index d07df518a..cabff8473 100644 --- a/fuel/app/classes/controller/lti/test.php +++ b/fuel/app/classes/controller/lti/test.php @@ -11,16 +11,70 @@ public function before() { if (\Fuel::$env == \Fuel::PRODUCTION) { - trace('these tests are not availible in production mode'); + trace('These tests are not available in production mode'); throw new \HttpNotFoundException; } \Js::push_group('jquery'); parent::before(); } - public function get_redirect() + // This will print out any get params it receives + public function get_dump_launch_presentation_return() { - var_dump(\Input::get()); + echo 'These GET vars were sent back to the launch_presentation_return_url'; + echo '
';
+		print_r(\Input::get());
+		echo '
'; + } + + public function get_sign_and_launch() + { + + $params = \Input::get(); + + $use_bad_signature = isset($params['use_bad_signature']); + unset($params['use_bad_signature']); + + if(isset($params['use_random_user'])) + { + unset($params['use_random_user']); + $role = 'LEARNER'; + if(isset($params['roles']) && strpos($params['roles'], 'Instructor') !== false) + { + $role = 'INSTRUCTOR'; + } + $random_number = rand(0, 100000); + $name = "_LTI_{$role}_{$random_number}"; + $params['user_id'] = $random_number; + $params['lis_person_sourcedid'] = $name; + $params['lis_person_contact_email_primary'] = "{$name}@mailinator.com"; + $params['lis_person_name_given'] = $name; + $params['lis_person_name_family'] = $name; + } + + if(isset($params['use_no_email'])) + { + unset($params['lis_person_contact_email_primary']); + unset($params['use_no_email']); + } + + $endpoint = $params['endpoint']; + $secret = \Config::get('lti.consumers.default.secret'); + $hmcsha1 = new \Eher\OAuth\HmacSha1(); + $consumer = new \Eher\OAuth\Consumer('', $secret); + $request = \Eher\OAuth\Request::from_consumer_and_token($consumer, null, 'POST', $endpoint, $params); + $request->sign_request($hmcsha1, $consumer, ''); + $signed_params = $request->get_parameters(); + if($use_bad_signature) + { + $signed_params['oauth_signature'] = 'THIS_IS_A_BAD_SIGNATURE'; + } + + $this->theme = \Theme::instance(); + $this->theme->set_template('layouts/lti_sign_and_launch') + ->set_safe(['post' => json_encode($signed_params)]); + + return \Response::forge(\Theme::instance()->render()); } public function get_embed() @@ -60,236 +114,238 @@ public function get_embed() return \Response::redirect("/lti/success/{$parts[0]}?embed_type={$embed_type}&url={$url}"); } + // Generate a bunch of sample lti launch examples to test public function get_provider() { $assignment_url = \Uri::create('lti/assignment'); $picker_url = \Uri::create('lti/picker'); $validate_url = \Uri::create('lti/test/validate'); $login_url = \Uri::create('lti/login'); + $play_launch_url_modern_embed = \Uri::create('embed') . '/HASH_ID/HUMAN-FRIENDLY-NAME'; + $play_launch_url_modern_play = \Uri::create('play') . '/HASH_ID/HUMAN-FRIENDLY-NAME'; + $play_launch_url_legacy = \Uri::create('lti/assignment') . '?widget=HASH_ID'; + + $base_params = [ + 'resource_link_id' => 'test-resource', + 'context_id' => 'test-context', + 'lis_result_sourcedid' => 'test-source-id', + 'roles' => 'Learner', + 'oauth_consumer_key' => \Config::get('lti.consumers.default.key'), + 'lti_message_type' => 'basic-lti-launch-request', + 'tool_consumer_instance_guid' => 999999, + 'tool_consumer_info_product_family_code' => 'materia_test', + 'tool_consumer_instance_contact_email' => 'SYSTEM@mailinator.com', + 'launch_presentation_document_target' => 'iframe', + 'user_id' => 999999, + 'lis_person_sourcedid' => '_LTI_INSTRUCTOR_', + 'lis_person_contact_email_primary' => '_LTI_INSTRUCTOR_@mailinator.com', + 'lis_person_name_given' => '_LTI_INSTRUCTOR_', + 'lis_person_name_family' => '_LTI_INSTRUCTOR_', + 'custom-inst-id' => '', + 'selection_directive' => '', + ]; - $validation_params = $this->create_test_case([], $validate_url); - - $instructor_params = $this->create_test_case([ - 'launch_presentation_return_url' => \Uri::create('lti/test/embed'), - 'selection_directive' => 'select_link', - 'roles' => 'Instructor' - ], $picker_url); - - $login_params = $this->create_test_case([ - 'launch_presentation_return_url' => \Uri::create('lti/test/redirect'), - 'selection_directive' => 'select_link', - 'roles' => 'Instructor' - ], $login_url); - - $new_instructor_params = $this->create_test_case([ - 'launch_presentation_return_url' => \Uri::create('lti/test/embed'), - 'selection_directive' => 'select_link', - 'roles' => 'Instructor' - ], $picker_url, $this->create_new_random_user()); - - $unknown_role_params = $this->create_test_case(['roles' => 'Chocobo'], $assignment_url); - - $unknown_assignment_params = $this->create_test_case(['resource_link_id' => 'this-will-not-work'], $assignment_url); - - $view_args = [ - 'validation_params' => $validation_params[0], - 'validation_endpoint' => $validation_params[1], - - 'instructor_params' => $instructor_params[0], - 'instructor_endpoint' => $instructor_params[1], - - 'login_params' => $login_params[0], - 'login_endpoint' => $login_params[1], - - 'new_instructor_params' => $new_instructor_params[0], - 'new_instructor_endpoint' => $new_instructor_params[1], - - 'unknown_assignment_params' => $unknown_assignment_params[0], - 'unknown_assignment_endpoint' => $unknown_assignment_params[1], - - 'learner_endpoint' => \Uri::create('lti/test/learner') + $launch_args = [ + 'LTI Assignment Launch' => [ + [ + 'label' => 'As Learner (bad signature)', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'resource_link' => 'use_bad_signature', + 'roles' => 'Learner', + 'user_id' => 1111111, + 'lis_person_sourcedid' => '_LTI_LEARNER_', + 'lis_person_contact_email_primary' => '_LTI_LEARNER_@mailinator.com', + 'lis_person_name_given' => '_LTI_LEARNER_', + 'lis_person_name_family' =>'_LTI_LEARNER_', + 'use_bad_signature' => true + ]), + 'endpoint' => $assignment_url, + ], + [ + 'label' => 'As Learner', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'custom_widget_instance_id' => 'custom_widget_instance_id', + 'resource_link' => 'use_bad_signature', + 'roles' => 'Learner', + 'user_id' => 1111111, + 'lis_person_sourcedid' => '_LTI_LEARNER_', + 'lis_person_contact_email_primary' => '_LTI_LEARNER_@mailinator.com', + 'lis_person_name_given' => '_LTI_LEARNER_', + 'lis_person_name_family' =>'_LTI_LEARNER_', + ]), + 'endpoint' => $assignment_url, + ], + [ + 'label' => 'As Random New Learner', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'resource_link' => 'lti_test_launch1', + 'roles' => 'Learner', + 'use_random_user' => true + ]), + 'endpoint' => $assignment_url, + ], + [ + 'label' => 'As Random New Learner without an email address', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'resource_link' => 'lti_test_launch2', + 'roles' => 'Learner', + 'use_random_user' => true, + 'use_no_email' => true, + ]), + 'endpoint' => $assignment_url, + ], + [ + 'label' => 'As the guest/test student', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'custom_widget_instance_id' => 'custom_widget_instance_id', + 'resource_link' => 'lti_test_launch3', + 'roles' => 'Learner', + 'lis_person_sourcedid' => '', + 'lis_person_contact_email_primary' => 'notifications@instructure.com', + 'lis_person_name_given' => 'Test', + 'lis_person_name_family' =>'Student', + + ]), + 'endpoint' => $assignment_url, + ], + [ + 'label' => 'As an instructor', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'custom_widget_instance_id' => 'custom_widget_instance_id', + 'resource_link' => 'lti_test_launch4', + 'roles' => 'Instructor', + ]), + 'endpoint' => $assignment_url, + ], + [ + 'label' => 'As A Random New Instructor', + 'params' => array_merge($base_params, [ + 'lti_url' => 'lti_url', + 'custom_widget_instance_id' => 'custom_widget_instance_id', + 'resource_link' => 'lti_test_launch5', + 'roles' => 'Instructor', + ]), + 'endpoint' => $assignment_url, + ], + ], + 'LTI Navigation Launch' => [ + [ + 'label' => 'Launch as instructor', + 'params' => array_merge($base_params, [ + 'selection_directive' => 'select_link', + 'user_id' => 999999, + 'lis_person_sourcedid' => '_LTI_INSTRUCTOR_', + 'lis_person_contact_email_primary' => '_LTI_INSTRUCTOR_@mailinator.com', + 'lis_person_name_given' => '_LTI_INSTRUCTOR_', + 'lis_person_name_family' =>'_LTI_INSTRUCTOR_', + ]), + 'endpoint' => $login_url, + ], + [ + 'label' => 'As Random New Learner', + 'params' => array_merge($base_params, [ + 'selection_directive' => 'select_link', + 'lti_url' => 'lti_url', + 'resource_link' => 'lti_test_launch1', + 'roles' => 'Learner', + 'use_random_user' => true + ]), + 'endpoint' => $login_url, + ], + [ + 'label' => 'Launch as instructor (bad signature)', + 'params' => array_merge($base_params, [ + 'selection_directive' => 'select_link', + 'roles' => 'Instructor', + 'use_bad_signature' => true, + ]), + 'endpoint' => $login_url, + ], + ], + 'LTI Picker Launch' => [ + [ + 'label' => 'Launch as instructor', + 'params' => array_merge($base_params, [ + 'launch_presentation_return_url' => \Uri::create('lti/test/embed'), + 'selection_directive' => 'select_link', + 'roles' => 'Instructor' + ]), + 'endpoint' => $picker_url, + ], + [ + 'label' => 'Launch as Random New Instructor', + 'params' => array_merge($base_params, [ + 'launch_presentation_return_url' => \Uri::create('lti/test/embed'), + 'selection_directive' => 'select_link', + 'roles' => 'Instructor', + 'use_random_user' => true + ]), + 'endpoint' => $picker_url, + ], + [ + 'label' => 'Launch as instructor (bad signature)', + 'params' => array_merge($base_params, [ + 'launch_presentation_return_url' => \Uri::create('lti/test/embed'), + 'selection_directive' => 'select_link', + 'roles' => 'Instructor', + 'use_bad_signature' => true, + ]), + 'endpoint' => $picker_url, + ], + ], + 'Other' => [ + [ + 'label' => 'Test Validation', + 'params' => $base_params, + 'endpoint' => $validate_url, + ], + [ + 'label' => 'Test Validation (bad signature)', + 'params' => array_merge($base_params, [ + 'use_bad_signature' => true, + ]), + 'endpoint' => $validate_url, + ], + [ + 'label' => 'Unknown Assignment Error', + 'params' => array_merge($base_params, ['resource_link_id' => 'this-will-not-work']), + 'endpoint' => $assignment_url, + ], + ] ]; $this->theme = \Theme::instance(); $this->theme->set_template('layouts/test_provider') - ->set($view_args); + ->set([ + 'launch_args' => $launch_args, + 'base_params' => $base_params, + 'endpoints' => [ + 'assignment_url' => $assignment_url, + 'picker_url' => $picker_url, + 'validate_url' => $validate_url, + 'login_url' => $login_url, + 'modern_play_embed' => $play_launch_url_modern_embed, + 'modern_play' => $play_launch_url_modern_play, + 'legacy_play' => $play_launch_url_legacy, + ] + ]); return \Response::forge(\Theme::instance()->render()); } + // Reports if OAuth is able to validate the signature public function post_validate() { - var_dump(\Input::post()); - echo \Oauth::validate_post() ? 'PASSED!' : 'FAILED'; - } - - protected static function get_and_unset_post($name) - { - $value = \Input::post($name); - unset($_POST[$name]); - return $value; - } - - public function post_learner() - { - $lti_url = static::get_and_unset_post('lti_url'); - if (empty($lti_url)) return \Response::forge('LTI Assignment URL can not be blank!', 500); - - $context_id = static::get_and_unset_post('context_id'); - $resource_link_id = static::get_and_unset_post('resource_link'); - $custom_inst_id = static::get_and_unset_post('custom_widget_instance_id'); - - $use_bad_signature = static::get_and_unset_post('use_bad_signature') ?: false; - $as_instructor = static::get_and_unset_post('as_instructor') ?: false; - $as_instructor2 = static::get_and_unset_post('as_instructor2') ?: false; - $as_test_student = static::get_and_unset_post('test_student') ?: false; - $as_new_learner_email = static::get_and_unset_post('new_learner_email') ?: false; - $as_new_learner_no_email = static::get_and_unset_post('new_learner_no_email') ?: false; - - switch (true) - { - case $as_instructor: - $learner_params = $this->create_test_case([ - 'roles' => 'Instructor', - 'context_id' => $context_id, - 'resource_link_id' => $resource_link_id, - 'custom_widget_instance_id' => $custom_inst_id - ], $lti_url); - break; - - case $as_instructor2: - $learner_params = $this->create_test_case([ - 'roles' => 'Instructor', - 'context_id' => $context_id, - 'resource_link_id' => $resource_link_id, - 'custom_widget_instance_id' => $custom_inst_id - ], $lti_url, false, false, 2); - break; - - case $as_test_student: - $test_student = new \Model_User([ - 'username' => '', - 'email' => 'notifications@instructure.com', - 'first' => 'Test', - 'last' => 'Student' - ]); - $learner_params = $this->create_test_case([ - 'context_id' => $context_id, - 'resource_link_id' => $resource_link_id, - 'custom_widget_instance_id' => $custom_inst_id - ], $lti_url, $test_student); - $learner_params[0]['user_id'] = ''; - break; - - case $as_new_learner_email: - $learner_params = $this->create_test_case([ - 'context_id' => $context_id, - 'resource_link_id' => $resource_link_id, - 'custom_widget_instance_id' => $custom_inst_id - ], $lti_url, $this->create_new_random_user()); - $learner_params[0]['user_id'] = ''; - break; - - case $as_new_learner_no_email: - $learner_params = $this->create_test_case([ - 'context_id' => $context_id, - 'resource_link_id' => $resource_link_id, - 'custom_widget_instance_id' => $custom_inst_id - ], $lti_url, $this->create_new_random_user(false)); - $learner_params[0]['user_id'] = ''; - break; - - default: - $learner_params = $this->create_test_case([ - 'context_id' => $context_id, - 'resource_link_id' => $resource_link_id, - 'custom_widget_instance_id' => $custom_inst_id, - ], $lti_url); - break; - } - - if ($use_bad_signature) - { - $learner_params[0]['oauth_signature'] = 'this will fail'; - } - - $this->theme = \Theme::instance(); - $this->theme->set_template('layouts/test_learner') - ->set_safe(['post' => json_encode($learner_params[0])]) - ->set(['assignment_url' => $lti_url]); - - return \Response::forge(\Theme::instance()->render()); - } - - protected function create_test_case($custom_params, $endpoint, $user = false, $passback_url = false, $new_faculty_user_override_number = false) - { - $key = \Config::get('lti.consumers.default.key'); - $secret = \Config::get('lti.consumers.default.secret'); - - $base_params = [ - 'resource_link_id' => 'test-resource', - 'context_id' => 'test-context', - 'lis_result_sourcedid' => 'test-source-id', - 'roles' => 'Learner' - ]; - - $params = array_merge($base_params, $custom_params); - - if ($user === false || $new_faculty_user_override_number) - { - // grab our test instructor - $base_username = '_LTI_INSTRUCTOR_'; - $username = $new_faculty_user_override_number ? $base_username.$new_faculty_user_override_number : $base_username; - $user = \Model_User::find_by_username($username); - - if ( ! $user) - { - // none - make one - $user_id = \Auth::instance()->create_user($username, uniqid(), $username.'@materia.com', 1, []); - - //manually add first/last name to make up for simpleauth not doing it - $user = \Model_User::find($user_id); - $user->first = $username; - $user->last = $username; - $user->profile_fields = ['notify' => true, 'avatar' => 'gravatar']; - $user->save(); - - // add basic_author permissions - \Materia\Perm_Manager::add_users_to_roles_system_only([$user_id], ['basic_author']); - } - } - - $params = \Oauth::build_post_args($user, $endpoint, $params, $key, $secret, $passback_url); - - return [$params, $endpoint]; - } - - protected function create_new_random_user($with_email = true) - { - $rand = substr(md5(microtime()), 0, 10); - - $user = new \Model_User([ - 'username' => 'test_lti_user'.$rand, - 'email' => $with_email ? 'test.lti.user'.$rand.'@materia.com' : '', - 'first' => 'Unofficial Test', - 'last' => "User $rand" - ]); - - return $user; - } - - protected function get_rand_active_widget_id() - { - $ids = \DB::select('id') - ->from('widget_instance') - ->where('is_draft', '0') - ->where('is_deleted', '0') - ->execute() - ->as_array(); - - $item = array_rand($ids); - - return $ids[$item]['id']; + echo 'LTI OAuth Validation ' . (\Oauth::validate_post() ? 'PASSED!' : 'FAILED'); + echo '
';
+		print_r(\Input::post());
+		echo '
'; } } diff --git a/fuel/app/classes/controller/widgets.php b/fuel/app/classes/controller/widgets.php index 5ce03b479..1018eee7f 100644 --- a/fuel/app/classes/controller/widgets.php +++ b/fuel/app/classes/controller/widgets.php @@ -358,9 +358,6 @@ protected function _play_widget($inst_id = false, $demo=false, $is_embedded=fals // allow events to redirect if ( ! empty($result['redirect'])) Response::redirect($result['redirect']); - // allow events to render the picker instead - if ( ! empty($result['render_picker'])) return $this->display_picker(); - // allow events to set inst_id if ( ! empty($result['inst_id'])) $inst_id = $result['inst_id']; diff --git a/fuel/app/classes/ltievents.php b/fuel/app/classes/ltievents.php index 6a49c27ab..f40d5c893 100644 --- a/fuel/app/classes/ltievents.php +++ b/fuel/app/classes/ltievents.php @@ -8,7 +8,6 @@ class LtiEvents { const PLAY_STATE_FIRST_LAUNCH = 'first_launch'; - const PLAY_STATE_CONTENT_SELECTION = 'content_selection'; const PLAY_STATE_REPLAY = 'replay'; const PLAY_STATE_NOT_LTI = 'not_lti'; protected static $inst_id; @@ -84,13 +83,6 @@ public static function on_before_play_start_event($payload) $launch = static::session_get_launch($token); return ['context_id' => $launch->context_id]; } - elseif ($play_state == self::PLAY_STATE_CONTENT_SELECTION) - { - $launch = LtiLaunch::from_request(); - if ( ! Oauth::validate_post()) $redirect = '/lti/error?message=invalid_oauth_request'; - elseif ( ! LtiUserManager::authenticate($launch)) $redirect = '/lti/error/unknown_user'; - return ['render_picker' => true]; - } return []; } @@ -248,9 +240,6 @@ protected static function find_assoc_from_resource_id($resource_id) protected static function get_lti_play_state($play_id = false) { - // Is there a resource_link_id? Then this is an LTI launch - if (\Input::param('lti_message_type') === 'ContentItemSelectionRequest') return self::PLAY_STATE_CONTENT_SELECTION; - // Is there a resource_link_id? Then this is an LTI launch if (\Input::param('resource_link_id')) return self::PLAY_STATE_FIRST_LAUNCH; diff --git a/fuel/app/classes/materia/api/v1.php b/fuel/app/classes/materia/api/v1.php index cc73fff2f..51817e150 100644 --- a/fuel/app/classes/materia/api/v1.php +++ b/fuel/app/classes/materia/api/v1.php @@ -58,6 +58,8 @@ static public function widget_instances_get($inst_ids = null) static public function lti_sign_content_item_selection(string $url, string $content_items, string $lti_key) { + // if (\Service_User::verify_session() !== true) return Msg::no_login(); + $params = [ "lti_message_type" => 'ContentItemSelection', "lti_version" => 'LTI-1p0', diff --git a/fuel/app/classes/materia/session/play.php b/fuel/app/classes/materia/session/play.php index 8c559990f..5d6443a12 100644 --- a/fuel/app/classes/materia/session/play.php +++ b/fuel/app/classes/materia/session/play.php @@ -65,7 +65,7 @@ public function start($user_id=0, $inst_id=0, $context_id=false, $is_preview=fal // Essentially true but fragile. $is_lti = array_key_exists('lti_message_type', $this->environment_data['input']) || array_key_exists('token', $this->environment_data['input']); $this->auth = $is_lti ? 'lti' : ''; - $this->referrer_url = \Input::referrer(); + $this->referrer_url = mb_strimwidth(\Input::referrer(), 0, 255); // Preview Plays dont log anything if ($is_preview) return static::start_preview($inst_id); diff --git a/fuel/app/classes/oauth.php b/fuel/app/classes/oauth.php index 2b3405a6f..6cb6188ea 100644 --- a/fuel/app/classes/oauth.php +++ b/fuel/app/classes/oauth.php @@ -18,7 +18,7 @@ public static function validate_post() $hasher = new \Eher\OAuth\HmacSha1(); // THIS CODE ASSUMES HMACSHA1, could be more versetile, but hey $consumer = new \Eher\OAuth\Consumer(null, $lti_config['secret']); - $request = \Eher\OAuth\Request::from_consumer_and_token($consumer, null, 'POST', \Uri::current(), \Input::post()); + $request = \Eher\OAuth\Request::from_consumer_and_token($consumer, null, 'POST', \Uri::main(), \Input::post()); $new_sig = $request->build_signature($hasher, $consumer, false); if ($new_sig !== $signature) throw new \Exception('Authorization signature failure.'); @@ -26,7 +26,7 @@ public static function validate_post() } catch (\Exception $e) { - \Materia\Log::profile(['invalid-oauth-received', $e->getMessage(), \Uri::current(), print_r(\Input::post(), 1)], 'lti-error-dump'); + \Materia\Log::profile(['invalid-oauth-received', $e->getMessage(), \Uri::main(), print_r(\Input::post(), 1)], 'lti-error-dump'); } return false; diff --git a/fuel/app/config/routes.php b/fuel/app/config/routes.php index 0c66e8a3b..49c02ea77 100644 --- a/fuel/app/config/routes.php +++ b/fuel/app/config/routes.php @@ -34,7 +34,14 @@ 'preview/(:alnum)(/.*)?' => 'widgets/preview_widget/$1', 'preview-embed/(:alnum)(/.*)?' => 'widgets/play_embedded_preview/$1', 'embed/(:alnum)(/.*)?' => 'widgets/play_embedded/$1', - 'lti/assignment?' => 'widgets/play_embedded/$1', // legacy LTI url + 'lti/assignment?' => function () { + if(\Input::param('lti_message_type') === 'ContentItemSelectionRequest') + { + return \Request::forge('lti/picker', false)->execute(); + } + + return \Request::forge('widgets/play_embedded', false)->execute(); + }, 'data/export/(:alnum)' => 'data/export/$1', "scores/single/{$play_id}/(:alnum)(/.*)?" => 'scores/single/$1/$2', diff --git a/fuel/app/themes/default/layouts/lti_sign_and_launch.php b/fuel/app/themes/default/layouts/lti_sign_and_launch.php new file mode 100644 index 000000000..9594bea9d --- /dev/null +++ b/fuel/app/themes/default/layouts/lti_sign_and_launch.php @@ -0,0 +1,31 @@ + + + + Materia Test as Provider + + + + + + +

Signed request created, sending

+
+
+ + + diff --git a/fuel/app/themes/default/layouts/test_learner.php b/fuel/app/themes/default/layouts/test_learner.php deleted file mode 100644 index c0b9012d6..000000000 --- a/fuel/app/themes/default/layouts/test_learner.php +++ /dev/null @@ -1,26 +0,0 @@ - - - - Materia Test as Provider - - - - - - -

Loading...

-
-
- - - diff --git a/fuel/app/themes/default/layouts/test_provider.php b/fuel/app/themes/default/layouts/test_provider.php index 4652ebeba..e0b2365c2 100644 --- a/fuel/app/themes/default/layouts/test_provider.php +++ b/fuel/app/themes/default/layouts/test_provider.php @@ -8,29 +8,13 @@
-

Use materia as an LTI Provider (inserted into another system)

+

Test Materia LTI Launches

-

This page will act as an LMS sending an LTI request to Materia.

-
- -
- - - -
+

This page will act as an LMS sending an LTI request to Materia. The Iframe below will show Materia's responses. Grab the corner to test resizing the iframe.

-

LTI Navigation Launch

+ -
- $value) : ?> - - - - - - - -
- - -
- $value) : ?> - - - -

-

LTI Picker Launch

- -
- $value) : ?> - - - - - - - -
- -
- $value) : ?> - - - -
- - -
- $value) : ?> - - - -
- - + $section) + { + echo "

{$section_name}

"; + foreach($section as $launch) + { + ?> + $value) + { + echo("$name=$value&"); + } + ?>"> ()
+
- -
-

LTI Assignment Launch

- - LTI Assignment URL: - - - - -
- -
- - Context ID: - - -
- -
- - Resource Link ID: - - -
- +

resource_link_id is used to determine which widget is linked to the current LMS's assignment/module/whatever. The association is inserted into the lti table as soon as it can be. Sometimes Canvas doesn't send the id when the instructor is choosing a widget. As a result, we try to give the LMS a launch url that contains the inst id when possible. Materia will attempt to choose the correct widget based on the lti table, the url, and the launch param custom-inst-id

+

lti_message_type can change the behavior of the assignment launch url and picker. Sending ContentItemSelectionRequest will tell both to display the picker and tell them how to return their params.

+
- - [Custom Inst ID (POST)]: - - +

Customized LTI Launch

+
URL TO SEND LTI POST REQUEST TO:
+ $value) + { + echo '
'; + } + ?> +
- - - - - - - - -
- -
- - - - - -
-
- - - - - - -
- -
- - - - - - -
- -
- - - - - - -
- -
- - - - - - -
- -
- - - - - - + $value) + { + echo $key . ':
'; + } + ?> +
-
-

Other

- -
- $value) : ?> - - - -
-
- $value) : ?> - - - - - - - -
- -
- $value) : ?> - - - -
-