- 
      
- 
        Save cleblond/121d033c11ed016eca528df94e4d8ad6 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | See the entry point in file "blti-launch.html". | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | lticonf.php | |
| .idea | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | input:read-only { | |
| background-color: #D6D6D6; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <html> | |
| <head> | |
| <script type="text/javascript" src="//code.jquery.com/jquery-2.1.4.min.js"></script> | |
| <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha1.js"></script> | |
| <script type="text/javascript" | |
| src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64.js"></script> | |
| <script type="text/javascript" src="blti-launch.js"></script> | |
| <link rel="stylesheet" href="blti-launch.css"/> | |
| </head> | |
| <body> | |
| <h2>LTI configuration parameters</h2> | |
| <form id="ltiConfigurationForm" onsubmit="updateLtiLaunchForm(); return false;"> | |
| <ul> | |
| <li> | |
| <label>Launch URL: | |
| <input id="launchUrl" value="" type="text" size="80"/></label> | |
| </li> | |
| <li> | |
| <label>Key: | |
| <input id="key" value="" type="text" size="80"/></label> | |
| </li> | |
| <li> | |
| <label>Secret: | |
| <input id="secret" value="" type="text" size="80"/></label> | |
| </li> | |
| </ul> | |
| <button type="submit" style="display: none;"></button> | |
| </form> | |
| <h2>LTI launch parameters</h2> | |
| <form id="ltiLaunchForm" name="ltiLaunchForm" method="POST" action="" onsubmit="updateLtiLaunchForm()"> | |
| <ul> | |
| <li><label>user_id: | |
| <input type="text" name="user_id" value="0ae836b9-7fc9-4060-006f-27b2066ac545"></label></li> | |
| <li><label>roles: | |
| <input type="text" name="roles" value="Instructor"></label></li> | |
| <li><label>resource_link_id: | |
| <input type="text" name="resource_link_id" value="88391-e1919-bb3456"></label></li> | |
| <li><label>resource_link_title: | |
| <input type="text" name="resource_link_title" value="My Weekly Wiki"></label></li> | |
| <li><label>resource_link_description: | |
| <input type="text" name="resource_link_description" | |
| value="A weekly wiki."></label></li> | |
| <li><label>lis_person_name_full: | |
| <input type="text" name="lis_person_name_full" value="Jane Q. Public"></label> | |
| </li> | |
| <li><label>lis_person_name_family: | |
| <input type="text" name="lis_person_name_family" value="Public"></label></li> | |
| <li><label>lis_person_name_given: | |
| <input type="text" name="lis_person_name_given" value="Jane"></label></li> | |
| <li><label>lis_person_contact_email_primary: | |
| <input type="text" name="lis_person_contact_email_primary" | |
| value="[email protected]"></label></li> | |
| <li><label>lis_person_sourcedid: | |
| <input type="text" name="lis_person_sourcedid" value="school.edu:user"></label> | |
| </li> | |
| <li><label>context_id: | |
| <input type="text" name="context_id" value="8213060-006f-27b2066ac545"></label></li> | |
| <li><label>context_title: | |
| <input type="text" name="context_title" | |
| value="Design of Personal Environments"></label></li> | |
| <li><label>context_label: | |
| <input type="text" name="context_label" value="SI182"></label></li> | |
| <li><label>tool_consumer_instance_guid: | |
| <input type="text" name="tool_consumer_instance_guid" | |
| value="lmsng.school.edu"></label></li> | |
| <li><label>tool_consumer_instance_description: | |
| <input type="text" name="tool_consumer_instance_description" | |
| value="University of School (LMSng)"></label></li> | |
| <li><label>lti_version: | |
| <input type="text" name="lti_version" value="LTI-1p0"></label></li> | |
| <li><label>lti_message_type: | |
| <input type="text" name="lti_message_type" | |
| value="basic-lti-launch-request"></label></li> | |
| <li><label>oauth_callback: | |
| <input type="text" name="oauth_callback" value="about:blank"></label></li> | |
| <li><label>oauth_consumer_key: | |
| <input type="text" name="oauth_consumer_key" id="oauth_consumer_key" readonly | |
| value=""></label></li> | |
| <li><label>oauth_version: | |
| <input type="text" name="oauth_version" value="1.0"></label></li> | |
| <li><label>oauth_nonce: | |
| <input type="text" name="oauth_nonce" id="oauth_nonce" value=""></label></li> | |
| <li><label>oauth_timestamp: | |
| <input type="text" name="oauth_timestamp" id="oauth_timestamp" value=""></label> | |
| </li> | |
| <li><label>oauth_signature_method: | |
| <input type="text" name="oauth_signature_method" value="HMAC-SHA1"></label> | |
| </li> | |
| <li>oauth_signature: | |
| <input type="text" readonly name="oauth_signature" id="oauth_signature" value="" | |
| size="40"> <input type="button" value="Refresh" | |
| onclick="updateLtiLaunchForm(); return false;"/></li> | |
| </ul> | |
| <p> | |
| <button type="submit">Launch</button> | |
| </p> | |
| </form> | |
| </body> | |
| </html> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (function () { | |
| window.onload = function () { | |
| $('#launchUrl').val('http://dr-chuck.com/ims/php-simple/tool.php'); | |
| $('#key').val('THX1138'); | |
| $('#secret').val('secret'); | |
| updateLtiLaunchForm(); | |
| }; | |
| this.updateLtiLaunchForm = function () { | |
| var launchUrl = $('#launchUrl').val(); | |
| var encodedSecret = encodeURIComponent($('#secret').val()) + '&'; | |
| var $ltiLaunchForm = $('#ltiLaunchForm'); | |
| $ltiLaunchForm.attr('action', launchUrl); | |
| $('#oauth_consumer_key').val($('#key').val()); | |
| $('#oauth_timestamp').val(Math.floor(new Date().getTime() / 1000)); | |
| $('#oauth_nonce').val(uniqid('', true)); | |
| var fields = []; | |
| $('input[type="text"]', $ltiLaunchForm).not('[name="oauth_signature"]').each(function () { | |
| var input = $(this); | |
| fields.push(input.attr('name') + '=' + rawurlencode(input.val())); | |
| }); | |
| var message = 'POST&' + encodeURIComponent(launchUrl) + '&' + | |
| rawurlencode(fields.sort().join('&')); | |
| var oauthSignature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(message, encodedSecret)); | |
| $('#oauth_signature').val(oauthSignature); | |
| }; | |
| this.rawurlencode = function (str) { | |
| str = (str + '').toString(); | |
| return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28'). | |
| replace(/\)/g, '%29').replace(/\*/g, '%2A'); | |
| }; | |
| this.uniqid = function (prefix, moreEntropy) { | |
| prefix = prefix || ''; | |
| moreEntropy = moreEntropy || false; | |
| var result; | |
| this.formatSeed = function (seed, width) { | |
| seed = parseInt(seed, 10).toString(16); | |
| return width < seed.length | |
| ? seed.slice(seed.length - width) | |
| : ((width > seed.length) ? new Array(1 + (width - seed.length)).join('0') + seed : seed); | |
| }; | |
| result = prefix + this.formatSeed(parseInt(new Date().getTime() / 1000, 10), 8) + this.formatSeed(Math.floor(Math.random() * 0x75bcd15) + 1, 5); | |
| if (moreEntropy) result += (Math.random() * 10).toFixed(8).toString(); | |
| return result; | |
| }; | |
| })(); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment