dtpsLMS

Description
Global DTPS LMS integration object. All LMS-related tasks, such as fetching data, are handled by this object. This is always loaded first.
Properties
Name Type Attributes Description
name string Full LMS name
shortName string <optional>
Short LMS name
legalName string Legal name (or names) to show in the "Welcome to Power+" disclaimer
description string <optional>
A short description of the LMS integration provided
logo string LMS logo image URL
url string URL to the LMS' website
source string URL to the LMS integration's source code
inboxURL string <optional>
URL to the LMS inbox. Required only if dtpsLMS.fetchUnreadMessageCount count is implemented
dtech boolean <optional>
True if this LMS is d.tech
institutionSpecific boolean <optional>
True if the LMS is designed for a specific institution instead of a broader LMS
useRubricGrades boolean | Array.<string> <optional>
True if DTPS should use rubric grades for assignments. If an array is provided, only assignments whose class ID is in the array will use rubric grades.
genericGradebook boolean <optional>
True if DTPS should show the generic gradebook. Ignored if dtpsLMS.gradebook defined.
gradeCalculationAllowlist Array.<string> <optional>
An array of class IDs that will use dtpsLMS.calculateGrade, if provided. All other classes will bypass dtpsLMS.calculateGrade and instead use the default LMS grade.
lmsGradebookAllowlist Array.<string> <optional>
An array of class IDs that will use dtpsLMS.gradebook, if provided. All other classes will bypass dtpsLMS.gradebook and instead use the generic gradebook if enabled.
Details

Members


<static> commonHeaders

Description
Common headers used for Canvas web requests. This variable is specific to Canvas LMS integration in DTPS and is not required for other LMS integrations.
Details

<static> teacherCache

Description
List of teachers from dtpsLMS.fetchClasses for use in other methods This variable is specific to Canvas LMS integration in DTPS and is not required for other LMS integrations.
Details

<static> fetchQueue

Description
A queue for API requests
Details

Methods


<static> fetchWrapper()

Description
A function that behaves the same way as fetch, although it adds the request to the queue for spacing
Details

<static> fetchUser() → {Promise.<User>}

Description
[REQUIRED] Fetches data for the current user from the LMS. If the user is not signed in, reject with an object that looks like {action: "login", redirectURL: "..."} to login the user.
Returns
A promise which resolves to a User object
Details

<static> fetchUnreadMessageCount() → {Promise.<string>}

Description
[OPTIONAL] Fetches the unread message count for the current user
Returns
A promise which resolves to a string depicting the count of unread messages
Details

<static> fetchClasses( userID ) → {Promise.<Array.<Class>>}

Description
[REQUIRED] Fetches class data from the LMS
Parameters
Name Type Description
userID string The user ID to fetch classes for
Returns
A promise which resolves to an array of Class objects
Details

<static> fetchAssignments( userID, classID ) → {Promise.<Array.<Assignment>>}

Description
[REQUIRED] Fetches assignment data for a course from the LMS
Parameters
Name Type Description
userID string The user ID to fetch assignments for
classID string The class ID to fetch assignments for
Returns
A promise which resolves to an array of Assignment objects
Details

<static> fetchModules( userID, classID ) → {Promise.<Array.<Module>>}

Description
[OPTIONAL] Fetches module data for a course from the LMS
Parameters
Name Type Description
userID string The user ID to fetch modules for
classID string The class ID to fetch modules for
Returns
A promise which resolves to an array of Module objects
Details

<static> collapseModule( classID, moduleID, collapsed ) → {Promise}

Description
[OPTIONAL] Collapses a module in the LMS
Parameters
Name Type Description
classID string The ID of the class
moduleID string The ID of the module to collapse
collapsed boolean True if the module is collapsed, false otherwise
Returns
A promise which resolves when the operation is completed
Details

<static> collapseAllModules( classID, collapsed ) → {Promise}

Description
[OPTIONAL] Collapses all modules in the LMS
Parameters
Name Type Description
classID string The ID of the class
collapsed boolean True if all modules should be collapsed, false otherwise
Returns
A promise which resolves when the operation is completed
Details

<static> fetchAnnouncements( classID ) → {Promise.<Array.<Announcement>>}

Description
[OPTIONAL] Fetches recent announcements for a course from the LMS
Parameters
Name Type Description
classID string The class ID to fetch announcements for
Returns
A promise which resolves to an array of Announcement objects
Details

<static> fetchMeetingURL( classID ) → {Promise.<string>}

Description
[OPTIONAL] Fetches the videoMeetingURL for a class
Parameters
Name Type Description
classID string The class ID to get the videoMeetingURL for
Returns
A promise which resolves to the videoMeetingURL for the class, or null if the class does not have a videoMeetingURL
Details

<static> fetchHomepage( classID ) → {Promise.<string>}

Description
[OPTIONAL] Fetches homepage HTML for a course from the LMS
Parameters
Name Type Description
classID string The class ID to get the homepage for
Returns
A promise which resolves to the HTML for the class homepage
Details

<static> fetchUsers( classID ) → {Promise.<Array.<ClassSection>>}

Description
[OPTIONAL] Fetches the users for a course from the LMS
Parameters
Name Type Description
classID string The class ID to fetch users for
Returns
A promise which resolves to an array of sections in this class
Details

<static> fetchDiscussionThreads( classID ) → {Promise.<Array.<PartialDiscussionThread>>}

Description
[OPTIONAL] Fetches discussion threads for a course from the LMS
Parameters
Name Type Description
classID string The class ID to fetch discussion threads for
Returns
A promise which resolves to an array of partial Discussion Thread objects
Details

<static> fetchDiscussionPosts( classID, threadID ) → {Promise.<DiscussionThread>}

Description
[REQUIRED IF dtpsLMS.fetchDiscussionThreads IS IMPLEMENTED] Fetches discussion posts in a thread from the LMS
Parameters
Name Type Description
classID string The class ID to fetch discussion posts for
threadID string The discussion thread ID to fetch discussion posts for
Returns
A promise which resolves to a full discussion thread object
Details

<static> fetchPages( classID ) → {Promise.<Array.<PartialPage>>}

Description
[OPTIONAL] Fetches pages for a course from the LMS
Parameters
Name Type Description
classID string The class ID to fetch pages for
Returns
A promise which resolves to an array of partial page objects
Details

<static> fetchPageContent( classID, pageID ) → {Promise.<Page>}

Description
[REQUIRED IF dtpsLMS.fetchPages IS IMPLEMENTED] Fetches content for a page from the LMS
Parameters
Name Type Description
classID string The class ID to fetch page content for
pageID string The page ID to fetch page content for
Returns
A promise which resolves to a full DTPS page object
Details

<static> gradebook( course ) → {Promise.<string>}

Description
[OPTIONAL] Renders custom gradebook HTML for unique grading systems or for a more tailored experience. The gradebook only shows for classes with a grade and with at least 1 assignment.
Parameters
Name Type Description
course Class Class to render the gradebook for. If custom grade calculation is enabled (dtpsLMS.calculateGrade), those results can be accessed at course.gradeCalculation.
Returns
A promise which resolves to HTML to render for the class gradebook
Details

<static> gradebookDidRender( course )

Description
[OPTIONAL] Called after the HTML returned by dtpsLMS.gradebook has rendered. Runs any initialization needed for the gradebook, such as enabling interactive elements or what-if grades.
Parameters
Name Type Description
course Class Class the gradebook was rendered for
Details

<static> calculateGrade( course, assignments ) → {undefined|object}

Description
[OPTIONAL] Calculates class grades with a custom grade calculation formula. Used for unique grading systems.
Parameters
Name Type Description
course Class Class to calculate grades for [DO NOT USE COURSE.ASSIGNMENTS to access assignments for grade calculation. Use the assignments parameter instead.]
assignments Array.<Assignment> Assignments used for grade calculation. Use this instead of course.assignments for hypothetical/what-if grade calculation.
Returns
The letter grade should be returned in the "letter" property as a string and the percentage in the "grade" property as a number. Other custom properties can be set if they need to be accessed by dtpsLMS.gradebook. Return undefined if there is no grade for the class.
Details

<static> isUsualDueDate( date ) → {boolean}

Description
[OPTIONAL, INSTITUTION ONLY] This function returns true if the due date provided is usual/expected and false if the due date is unusual/expected. If the due date is unusual, it is shown in bold in the UI. For institutions where there is a pattern/standard for due dates between classes.
Parameters
Name Type Description
date Date The due date to check
Returns
True if the due date is usual, false if the due date is unusual/unexpected.
Details

<static> updateAssignments( assignments, course ) → {Promise.<Array.<Assignment>>}

Description
[OPTIONAL, INSTITUTION ONLY] This function can be implemented by institution-specific scripts to loop through and override assignment data returned by the LMS.
Parameters
Name Type Description
assignments Array.<Assignment> Original assignments array
course Class The class that the assignment is in
Returns
A promise that resolves to the updated assignments array
Details

<static> updateClasses( classes ) → {Promise.<Array.<Class>>}

Description
[OPTIONAL, INSTITUTION ONLY] This function can be implemented by institution-specific scripts to loop through and override class data returned by the LMS.
Parameters
Name Type Description
classes Array.<Class> Original classes array
Returns
A promise that resolves to the updated classes array
Details