Rustici Cross Domain API
Rustici Cross Domain supports the following subset of the Rustici Driver API.
Start / Finish Functions
SetReachedEnd()
You can optionally call this function to indicate that the user has made sufficient progress in the content to be considered complete. This function is useful for content that has a final diploma or confirmation page. When that final page is reached, you should call SetReachedEnd, that way if the user closes the browser before initiating an action that calls Finish, the LMS will be told that the user completed the content instead of unloading the content.
ConcedeControl()
This function will pass control back to the LMS. Note, this function call should originate from a child (or descendent) frame of the indexapi.html page. It should not be invoked from a popped up window.
Utilities
CommitData()
This function will tell the LMS that you want to ensure all of the data you have sent to it is immediately persisted. Some LMS’s will cache data for a while before saving it permanently, invoking this function ensures that any cached data is permanently saved. It is best to call this function on each page where you set values. This flushes the previously set values to the LMS.
Storing and Retrieving General Data
NOTE: All values set with RXD are held locally in the JavaScript object and they
are set on launch with values from the LMS. Getting a value using the below
methods gets the locally stored value and not neccesarily the value currently on
the LMS. Calling CommitData
after setting values will send those values to the
LMS and also updates the locally held data.
GetStudentID()
Returns the ID of the student currently taking the content. There is no technical reason why you should need this value unless your content is performing some functionality that is outside the scope of the standards or unless the content displays the student’s ID.
GetStudentName()
Returns the name of the student currently taking the content. Formatted “Last Name, First Name”
GetBookmark()
This function returns the last value that was saved using SetBookmark
. If
SetBookmark
was not called previously, this function returns an empty string.
This function is useful to call at the beginning of the content to retrieve the
user’s last location and give him/her the option to return to that location.
SetBookmark(val)
Saves a string that represents the user’s current location in the content. This string can be formatted however you choose as long as it is less than 255 ASCII characters. This function should be called periodically as the user progresses through the content.
GetSuspendData()
This function returns the last value that was saved to the suspend data bucket.
If SetSuspendData
was not called previously, or there was no suspend data
available on launch, this function returns an empty string.
SetSuspendData(val)
This function allows you to save a string of data up to 4000 characters. This data can represent anything; it is just an arbitrary chunk of data. This function is useful for saving internal state data that does not correspond to any other data element.
Testing
GetScore()
Retrieves a score (float) previously recorded by SetScore
. If no score was
previously set, this function returns an empty string.
SetScore(score, max, min)
Allows you to record the score that the user achieved in the content to the LMS. In addition, you should also specify the minimum and maximum scores that were available. All scores should be numbers (float) between 0 and 100.
State Functions
GetStatus()
Returns the current lesson status of the content. Possible values are:
- LESSON_STATUS_PASSED (1) - The user completed the content with a score sufficient to pass.
- LESSON_STATUS_COMPLETED (2) - The user completed the content.
- LESSON_STATUS_FAILED (3) - The user completed the content but his/her score was not sufficient to pass.
- LESSON_STATUS_INCOMPLETE (4) - The user began the content but did not complete it.
- LESSON_STATUS_BROWSED (5) - The user looked at the content but was not making a recorded attempt at it.
- LESSON_STATUS_NOT_ATTEMPTED (6) - The user has not started the content
SetPassed()
Sets the current status of the content to passed. If there is a mastery score stored in the LMS (as specified in your content packaging) and if you record a score for the content, then this function does not need to be called; the LMS will automatically compare the score to the mastery score to determine if the content was passed or failed.
SetFailed()
Sets the current status of the content to failed. If there is a mastery score stored in the LMS (as specified in your content packaging) and if you record a score for the content, then this function does not need to be called; the LMS will automatically compare the score to the mastery score to determine if the content was passed or failed.
ResetStatus()
Resets the status of the content back to incomplete if you previously set it to passed or failed.