Fix a bug introduced recently that broke launches (adding the return url after signin...
authorChris Scribner <scriby@gmail.com>
Wed, 12 Oct 2011 13:45:14 +0000 (09:45 -0400)
committerChris Scribner <scriby@gmail.com>
Mon, 7 Nov 2011 01:41:59 +0000 (20:41 -0500)
mod/lti/locallib.php

index af5c4c5..60233e3 100644 (file)
@@ -124,6 +124,8 @@ function lti_view($instance) {
     }
     
     $endpoint = !empty($instance->toolurl) ? $instance->toolurl : $typeconfig['toolurl'];
+    $endpiont = trim($endpoint);
+    
     $orgid = $typeconfig['organizationid'];
     /* Suppress this for now - Chuck
     $orgdesc = $typeconfig['organizationdescr'];
@@ -143,19 +145,21 @@ function lti_view($instance) {
         $requestparams["tool_consumer_instance_guid"] = $orgid;
     }
     
+    if(empty($key) || empty($secret)){
+        $returnurlparams['unsigned'] = '1';
+        
+        //Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
+    $url = new moodle_url('/mod/lti/return.php', $returnurlparams);
+        $parms['launch_presentation_return_url'] = $url->out(false);    
+    }
+    
     if(!empty($key) && !empty($secret)){
         $parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret);
     } else {
         //If no key and secret, do the launch unsigned.
         $parms = $requestparams;
-        
-        $returnurlparams['unsigned'] = '1';
     }
     
-    //Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
-    $url = new moodle_url('/mod/lti/return.php', $returnurlparams);
-    $parms['launch_presentation_return_url'] = $url->out(false);
-    
     $debuglaunch = ( $instance->debuglaunch == 1 );
     
     $content = lti_post_launch_html($parms, $endpoint, $debuglaunch);
@@ -230,12 +234,12 @@ function lti_build_request($instance, $typeconfig, $course) {
         $requestparams["ext_ims_lis_basic_outcome_url"] = $CFG->wwwroot.'/mod/lti/service.php';
     }
 
-    if ( isset($placementsecret) &&
+    /*if ( isset($placementsecret) &&
          ( $typeconfig['allowroster'] == LTI_SETTING_ALWAYS ||
          ( $typeconfig['allowroster'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceallowroster == LTI_SETTING_ALWAYS ) ) ) {
         $requestparams["ext_ims_lis_memberships_id"] = $sourcedid;
         $requestparams["ext_ims_lis_memberships_url"] = $CFG->wwwroot.'/mod/lti/service.php';
-    }
+    }*/
 
     // Send user's name and email data if appropriate
     if ( $typeconfig['sendname'] == LTI_SETTING_ALWAYS ||