pipwerks / scorm-api-wrapper

The pipwerks SCORM API Wrapper
http://pipwerks.com
357 stars 125 forks source link

Issue using Blackboard #43

Closed JonathanSloan closed 5 years ago

JonathanSloan commented 5 years ago

Hello, I have been trying to utilize this api to upload a course to Blackboard. I have recreated your sample project and uploaded it successfully to our Blackboard, but when the project loads I repeatedly receive the following error: "The specified resource was not found, or you do not have permission to access it.". Upon checking my console I am receiving the following error: "ReferenceError: ToolActivityService is not defined". as well as some missing scripts in: "/courses/dwr_open/interface/", one of which is "ToolActivityService.js".

 I may be misunderstand this, as I am a Jr. dev, but our Sr. dev left and I was thown into this. Any help at all would be very appreciated.
JonathanSloan commented 5 years ago

This is linked after the api script in the header:

var scorm = pipwerks.scorm; var lmsConnected = false;

function handleError(msg) { alert(msg); window.close(); }

function initCourse() { //scorm.init returns a boolean lmsConnected = scorm.init(); //If the scorm.init function succeeded... if (lmsConnected) { //Let's get the completion status to see if the course has already been completed var completionstatus = scorm.get("cmi.completion_status"); //If the course has already been completed... if (completionstatus == "completed") { //...let's display a message and close the browser window handleError("You have already completed this course. You do not need to continue."); } //Now let's get the username from the LMS var learnername = scorm.get("cmi.learner_name"); //If the name was successfully retrieved... if (learnername) { //...let's display the username in a page element named "learnername" document.getElementById("learnername").innerHTML = learnername; //use the name in the form } //If the course couldn't connect to the LMS for some reason... } else { //... let's alert the user then close the window. handleError("Error: Course could not connect with the LMS"); } }

function setComplete() { //If the lmsConnection is active... if (lmsConnected) { //... try setting the course status to "completed" var success = scorm.set("cmi.completion_status", "completed"); //If the course was successfully set to "completed"... if (success) { //... disconnect from the LMS, we don't need to do anything else. scorm.quit(); //If the course couldn't be set to completed for some reason... } else { //alert the user and close the course window handleError("Error: Course could not be set to complete!"); } //If the course isn't connected to the LMS for some reason... } else { //alert the user and close the course window handleError("Error: Course is not connected to the LMS"); } }

function initForm() { document.getElementById("myform").onsubmit = function () { this.innerHTML = "Thank you, your selection has been recorded. You may close this window."; setComplete(); return false; // This prevents the browser from trying to post the form results } } window.onload = function () { initCourse(); initForm(); }

and I used your xml manifest. I am using scorm 2004. Thank you again.

pipwerks commented 5 years ago

Hi Jonathan

Several things to note.

First, this issues list is for bugs with the SCORM API wrapper, not for implementation support. For general e-learning dev help, I suggest posting to http://pwrk.us/etd. There are lots of folks there who are familiar with assorted LMS quirks as well as the SCORM wrapper.

Second, when posting code, whenever possible, you should try to format your code. For example

var scorm = pipwerks.scorm; var lmsConnected = false;

function handleError(msg) { alert(msg); window.close(); }

should be formatted as

var scorm = pipwerks.scorm;
var lmsConnected = false;

function handleError(msg) {
   alert(msg);
   window.close();
}

It makes the code much easier to read, which helps the folks who might in turn help you.

As for the errors you received from Blackboard, they are not pointing to anything in the SCORM API Wrapper's code base.

"The specified resource was not found, or you do not have permission to access it.".

This sounds as if your SCORM ZIP package might be set up incorrectly. This is a very common error. You need to ensure the manifest is at the root of the ZIP file, not in a nested subfolder.

"ReferenceError: ToolActivityService is not defined". as well as some missing scripts in: "/courses/dwr_open/interface/", one of which is "ToolActivityService.js".

These are Blackboard-specific errors, I am unfamiliar with them.

Good luck!

JonathanSloan commented 5 years ago

Thank you for your advice and prompt reply! I will review my project's setup and try again. Have you a complete version of your example from your site that could be tested, or? Thanks again!