Skip to content

Commit

Permalink
If no launch URL is specified, launch to the base URL of the tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
scriby committed Nov 7, 2011
1 parent 67ddf84 commit f17f495
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions mod/lti/locallib.php
Expand Up @@ -115,6 +115,10 @@ function lti_view($instance) {
$orgdesc = $typeconfig['organizationdescr'];
*/

if(!strstr($endpoint, '://')){
$endpoint = 'http://' . $endpoint;
}

$course = $PAGE->course;
$requestparams = lti_build_request($instance, $typeconfig, $course);

Expand Down Expand Up @@ -419,13 +423,27 @@ function lti_get_ims_role($user, $context) {
function lti_get_type_config($typeid) {
global $DB;

$query = <<<QUERY
SELECT name, value
FROM {lti_types_config}
WHERE typeid = :typeid1
UNION ALL
SELECT 'toolurl' AS name, baseurl AS value
FROM {lti_types}
WHERE id = :typeid2
QUERY;

$typeconfig = array();
$configs = $DB->get_records('lti_types_config', array('typeid' => $typeid));
$configs = $DB->get_records_sql($query, array('typeid1' => $typeid, 'typeid2' => $typeid));

if (!empty($configs)) {
foreach ($configs as $config) {
$typeconfig[$config->name] = $config->value;
}
}

return $typeconfig;
}

Expand Down Expand Up @@ -913,7 +931,7 @@ function lti_sign_parameters($oldparms, $endpoint, $method, $oauthconsumerkey, $
$parms["ext_submit"] = $submittext;

$testtoken = '';

$hmacmethod = new lti\OAuthSignatureMethod_HMAC_SHA1();
$testconsumer = new lti\OAuthConsumer($oauthconsumerkey, $oauthconsumersecret, null);

Expand Down

0 comments on commit f17f495

Please sign in to comment.