We're converting from ANGEL to D2L. We've created JavaScript-based widgets that use the $SECTION_ID$ token to tell the script what course it is running from. In Desire2Learn the equivalent would be the replacement string {OrgUnitCode}. We'd like to just use that replacement string, but they don't work properly in course page (where most of my widget useage is). Is there some other way to find out what course a JavaScript widget is running in?
Here is an example the code for one of our widgets that a user would paste into a page in their course:
<script type="text/javascript" data-id="NotablePAD540" section="{OrgUnitCode}">
var DAT = DAT || {}; if (!DAT.n) { (function (d) {
var f = d.getElementsByTagName('SCRIPT')[0], s = d.createElement('SCRIPT'); s.async = true;
s.type = 'text/javascript'; s.charset = 'utf-8'; s.src = '//dev.notable.vudat.msu.edu/n.js';
f.parentNode.insertBefore(s, f); }(document)); }; DAT.n = 1; </script>
Each notepad has a unique ID, this code snippet example is for a notepad with the id 540. The dynamic bit, {OrgUnitCode}, is what would separate out data, allowing me to use the same snippet in multiple course offerings and have the data stored separately.