LTI Launch Test - dev1

Whenever a launch is triggered, the configuration parameters are applied, new nonce and timestamp values are obtained, and a new OAuth signature is calculated. The "Refresh" button does the same, without triggering a launch. Current support is for LTI 1.0/1.1 Adapted from Lance's implementation and customized for testing dashboards

by prakgarnly

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha1.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64.js"></script>
<p><em>Remember to click on "Refresh" at the bottom of the form before launching!!</em>

</p>

<h2>LTI configuration parameters</h2>

<form id="ltiConfigurationForm" onsubmit="updateLtiLaunchForm(); return false;">
    <ul>http://jsfiddle.net/prakgarnly/sd20tL6b/56/#run
        <li>
            <label>Launch URL:
                <input id="launchUrl" value="" type="text" />
            </label>
        </li>
        <li>
            <label>View ID:
                <input id="viewId" value="" type="text" />
            </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="urn:lti:role:ims/lis/Instructor">
            </label>
        </li>
  <li>
    <label class='sri'>custom_siteId:
      <input type="text" id="custom_siteId" name="custom_siteId" value="mohawk"/>
    </label>
  </li>
  <li>
    <label class='sri'>custom_classId:
      <input type="text" id="custom_classId" name="custom_classId" value="CLASS-M-1A"/>
    </label>
  </li>
  <li>
    <label class='sri'>custom_studentId:
      <input type="text" id="custom_studentId"...

CSS

input:read-only {
    background-color: #D6D6D6;
}
em {
    background-color: #FFD666;
}
label.sri {
    background-color: #FFD666;
}
input#launchUrl {
    width: 90%
}
input{
    width: 60%;
}

JavaScript

(function () {
    window.onload = function () {
        
// Local testing (Instructor Only Dashbaord)
<!-- $('#launchUrl').val('http://dev1.intellifylearning.com/ltilaunch/');
$('#viewId').val('55b7b9f80cf2246bcdb3bd0f');
$('#key').val('r22nOP20RIOfSD7UzZVVVA');
$('#secret').val('22ab106d-52c7-418f-a35a-1b1adb3c43bc');        
 -->        
// spi class
$('#launchUrl').val('https://dev1.intellifylearning.com/ltilaunch/');
$('#viewId').val('55f9c01a0cf2011135f8754f');
$('#key').val('yScTs-BpQVaSg0PIlDlfzw');
$('#secret').val('22ab106d-52c7-418f-a35a-1b1adb3c43bc');
$('#custom_siteId').val('h900000012');
$('#custom_classId').val('1bu96flg6jj9ul1103967vhk_v8q9qq0');
$('#custom_studentId').val('');
        
// spi student        
$('#launchUrl').val('https://dev1.intellifylearning.com/ltilaunch/');
$('#viewId').val('561dc1ba0cf2bffa8004ff4a');
$('#key').val('yScTs-BpQVaSg0PIlDlfzw');
$('#secret').val('22ab106d-52c7-418f-a35a-1b1adb3c43bc');
$('#custom_siteId').val('h900000031');
$('#custom_classId').val('1bu96flg6jj9ul1103967vhk_v8q9qq0');
$('#custom_studentId').val('oic7nalqmamjl8ghs7ctmsfu_v8q9qq0');
/*        
// sri student        
$('#launchUrl').val('https://dev1.intellifylearning.com/ltilaunch/');
$('#viewId').val('5661b62d0cf2c1c8405734a5');
$('#key').val('yScTs-BpQVaSg0PIlDlfzw');
$('#secret').val('22ab106d-52c7-418f-a35a-1b1adb3c43bc');
$('#custom_siteId').val('h900000031');
$('#custom_classId').val('dqplh6404evdko3p7c9jh33i_v8q9qq0');
$('#custom_studentId').val('1novbrd5a1rt1phf0lrr6hir_v8q9qq0');
  */      
//rtw simple        
//$('#launchUrl').val('http://77fa04f4.ngrok.com/ltilaunch/55500e1330049af4c9a6ce57');
//        $('#key').val('btAOEeZ0Qx-DeKA7BMiddA');
//        $('#secret').val('fe0bfe47-e343-43c8-a626-9d56ef26ddba');
        
        // Local testing (Learner Only Dashbaord)
        //$('#launchUrl').val('http://56ee95b0.ngrok.com/ltilaunch/559ed69b3004b603a9baaf95');//
        //$('#key').val('SHMaOmepTgaMWKrCWR0ZVw');
       ...