Members
StorageWrapper :Object
- Description:
Wraps browsers localStorage object
- Source:
Wraps browsers localStorage object
Type:
- Object
(constant) addContextmenuItem
- Description:
Given a TinyMCE contextmenu configuration, add the specified button to the end.
- Source:
Given a TinyMCE contextmenu configuration, add the specified button to the end.
(constant) addMenubarItem
- Description:
Given a TinyMCE Menubar configuration, add the specified button to the named section.
- Source:
Given a TinyMCE Menubar configuration, add the specified button to the named section.
(constant) addQuickbarsToolbarItem
- Description:
Given a TinyMCE quickbars configuration, add items to the meun.
- Source:
Given a TinyMCE quickbars configuration, add items to the meun.
(constant) addToolbarButton
- Description:
Given a TinyMCE Toolbar configuration, add the specified button to the named section.
- Source:
Given a TinyMCE Toolbar configuration, add the specified button to the named section.
(constant) addToolbarButtons
- Description:
Given a TinyMCE Toolbar configuration, add the specified buttons to the named section.
- Source:
Given a TinyMCE Toolbar configuration, add the specified buttons to the named section.
(constant) addToolbarSection
- Description:
Insert a new section into the toolbar.
- Source:
Insert a new section into the toolbar.
(constant) byCategory
- Description:
Emoji data based on the data available from https://github.com/iamcal/emoji-data.
- Source:
- Copyright:
- 2019 Ryan Wyllie
- 2019 Ryan Wyllie
- License:
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Emoji data based on the data available from https://github.com/iamcal/emoji-data.
(constant) clearSearch
- Description:
Reset the search icon and trigger the init for the block.
- Source:
Reset the search icon and trigger the init for the block.
(constant) displayFilepicker
- Description:
Helper to display a filepicker and return a Promise.
The Promise will resolve when a file is selected, or reject if the file type is not found.
- Source:
Helper to display a filepicker and return a Promise.
The Promise will resolve when a file is selected, or reject if the file type is not found.
endTime
- Description:
Timestamp at which time runs out.
- Source:
Properties:
Name | Type | Description |
---|---|---|
endTime |
Number |
Timestamp at which time runs out.
(constant) ensureEditorIsValid
- Description:
Ensure that the editor is still in the DOM, removing it if it is not.
- Source:
Ensure that the editor is still in the DOM, removing it if it is not.
(constant) getDocumentationLink
- Description:
Get the link to the user documentation for the named plugin.
- Source:
Get the link to the user documentation for the named plugin.
(constant) getImagePath
- Description:
Get the image path for the specified image.
- Source:
Get the image path for the specified image.
(constant) getPluginMetadata
- Description:
Get the default plugin metadata for the named plugin. If no URL is provided, then a URL is generated pointing to the standard Moodle Documentation.
- Source:
Get the default plugin metadata for the named plugin. If no URL is provided, then a URL is generated pointing to the standard Moodle Documentation.
(constant) init
- Description:
Initialise the timeline view navigation by adding event listeners to the navigation elements.
- Source:
Initialise the timeline view navigation by adding event listeners to the navigation elements.
(constant) init
- Description:
Intialise the courses list and cards views on page load.
- Source:
Intialise the courses list and cards views on page load.
(constant) init
- Description:
Initialise all of the modules for the overview block.
- Source:
Initialise all of the modules for the overview block.
(constant) init
- Description:
Initialize module
- Source:
Initialize module
isEditing
- Description:
Return the current edit mode.
Components should use this method to check if edit mode is active.
- Source:
Return the current edit mode.
Components should use this method to check if edit mode is active.
isLoggerSet :boolean
- Description:
Flag to determine whether the screen reader-only logger has already been set, so we only need to set it once.
- Source:
Flag to determine whether the screen reader-only logger has already been set, so we only need to set it once.
Type:
- boolean
locked
- Description:
Set the lock value and locks or unlocks the element.
- Source:
Set the lock value and locks or unlocks the element.
locked
- Description:
Get the current locked value from the element.
- Source:
Get the current locked value from the element.
prepare
- Description:
Prepares to begin a drag operation - call with a mousedown or touchstart event.
If the returned object has 'start' true, then you can set up a drag proxy, and call start. This function will call preventDefault automatically regardless of whether starting or not.
- Source:
Prepares to begin a drag operation - call with a mousedown or touchstart event.
If the returned object has 'start' true, then you can set up a drag proxy, and call start. This function will call preventDefault automatically regardless of whether starting or not.
(constant) removeMenubarItem
- Description:
Given a TinyMCE Menubar configuration, remove the specified menu from the named section.
- Source:
Given a TinyMCE Menubar configuration, remove the specified menu from the named section.
(constant) removeMenubarItems
- Description:
Given a TinyMCE Menubar configuration, remove the specified menu from the named section.
- Source:
Given a TinyMCE Menubar configuration, remove the specified menu from the named section.
(constant) removeSubmenuItem
- Description:
Remove the specified sub-menu item from the named section. Recreate a menu with the same sub-menu items but remove the specified item.
- Source:
Remove the specified sub-menu item from the named section. Recreate a menu with the same sub-menu items but remove the specified item.
(constant) removeToolbarButton
- Description:
Given a TinyMCE Toolbar configuration, remove the specified button from the named section.
- Source:
Given a TinyMCE Toolbar configuration, remove the specified button from the named section.
(constant) removeToolbarButtons
- Description:
Given a TinyMCE Toolbar configuration, remove the specified buttons from the named section.
- Source:
Given a TinyMCE Toolbar configuration, remove the specified buttons from the named section.
(constant) reset
- Description:
Reset the courses views to their original state on first page load.courseOffset
This is called when configuration has changed for the event lists to cause them to reload their data.
- Source:
Reset the courses views to their original state on first page load.courseOffset
This is called when configuration has changed for the event lists to cause them to reload their data.
(constant) serialize
- Description:
Serialize form values into a string.
This must be used instead of URLSearchParams, which does not correctly encode nested values such as arrays.
- Source:
Serialize form values into a string.
This must be used instead of URLSearchParams, which does not correctly encode nested values such as arrays.
start
- Description:
Call to start a drag operation, in response to a mouse down or touch start event. Normally call this after calling prepare and receiving start true (you can probably skip prepare if only supporting drag not touch).
Note: The caller is responsible for creating a 'drag proxy' which is the thing that actually gets dragged. At present, this doesn't really work properly unless it is added directly within the body tag.
You also need to ensure that there is CSS so the proxy is absolutely positioned, and styled to look like it is floating.
You also need to absolutely position the proxy where you want it to start.
- Source:
Call to start a drag operation, in response to a mouse down or touch start event. Normally call this after calling prepare and receiving start true (you can probably skip prepare if only supporting drag not touch).
Note: The caller is responsible for creating a 'drag proxy' which is the thing that actually gets dragged. At present, this doesn't really work properly unless it is added directly within the body tag.
You also need to ensure that there is CSS so the proxy is absolutely positioned, and styled to look like it is floating.
You also need to absolutely position the proxy where you want it to start.
start
- Description:
Starts automatic scrolling if user moves near edge of window. This should be called in response to mouse down or touch start.
- Source:
Starts automatic scrolling if user moves near edge of window. This should be called in response to mouse down or touch start.
state
- Description:
Return the current state.
- Source:
Return the current state.
stop
- Description:
Stops automatic scrolling. This should be called in response to mouse up or touch end.
- Source:
Stops automatic scrolling. This should be called in response to mouse up or touch end.
supportComponents
- Description:
Return if the current course support components to refresh the content.
- Source:
Return if the current course support components to refresh the content.
timeoutId
- Description:
ID of the timeout that updates the clock.
- Source:
Properties:
Name | Type | Description |
---|---|---|
timeoutId |
Number |
ID of the timeout that updates the clock.
timer
- Description:
The timer element.
- Source:
Properties:
Name | Type | Description |
---|---|---|
timer |
Element |
The timer element.
Methods
_activityAnchor(event)
- Description:
The activity anchor event.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event |
_addEventTotalMovement(event)
- Description:
Add the total amout of movement to a mouse event.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
MouseEvent |
_allSectionToggler(event)
- Description:
Handle the collapse/expand all sections button.
Toggler click is delegated to the main course content element because new sections can appear at any moment and this way we prevent accidental double bindings.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the triggered event |
_callEditWebservice(action, courseId, ids, targetSectionId, targetCmId)
- Description:
Private method to call core_courseformat_update_course webservice.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
action |
string | |
courseId |
number | |
ids |
array | |
targetSectionId |
number | optional target section id (for moving actions) |
targetCmId |
number | optional target cm id (for moving actions) |
_callParentMethod(methodname, dropdata, event)
- Description:
Convenient method for calling parent component functions if present.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
methodname |
string | the name of the method |
dropdata |
Object | the current drop data object |
event |
Event | the original event |
_cancelDebouncedReloadCm(cmId)
- Description:
Cancel the active reload CM debounced function, if any.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
cmId |
Number |
_checkSectionlist(detail)
- Description:
Check the section list and disable some options if needed.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail |
Object | the update details. Properties
|
(async) _cmBasicAction(stateManager, action, cmIds, targetSectionId, targetCmId)
- Description:
Execute a basic course module state action.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
action |
string | the action name |
cmIds |
array | the cm ids |
targetSectionId |
number | optional target section id (for moving actions) |
targetCmId |
number | optional target cm id (for moving actions) |
_completionHandler(event)
- Description:
Activity manual completion listener.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the custom ecent |
_completionHandler(event)
- Description:
Activity manual completion listener.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
event |
Event | the custom event Properties
|
_containsOnlyFiles(event) → {boolean}
- Description:
Check if the dragged event contains only files.
Files dragging does not generate drop data because they came from outside the page and the component must check it before validating the event.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the original event. |
Returns:
if the drag dataTransfers contains files.
- Type
- boolean
(async) _createCm(param)
- Description:
Create a newcm instance.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
_createCmItem(container, cmid) → {Element}
- Description:
Create a new course module item in a section.
Thos method will append a fake item in the container and trigger an ajax request to replace the fake element by the real content.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
Element | the container element (section) |
cmid |
Number | the course-module ID |
Returns:
the created element
- Type
- Element
(async) _createSection(details)
- Description:
Create a new section instance.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
details |
Object | the update details. Properties
|
_createSectionItem(container, sectionid) → {Element}
- Description:
Create a new section item.
This method will append a fake item in the container and trigger an ajax request to replace the fake element by the real content.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
Element | the container element (section) |
sectionid |
Number | the course-module ID |
Returns:
the created element
- Type
- Element
_deleteCm(param)
- Description:
Remove a cm from the list.
The actual DOM element removal is delegated to the cm component.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
_deleteSection(details)
- Description:
Remove a section from the list.
The actual DOM element removal is delegated to the section component.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
details |
Object | the update details. Properties
|
_destroyModal(modal, element)
- Description:
Hide and later destroy a modal.
Behat will fail if we remove the modal while some boostrap collapse is executing.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
modal |
Modal | |
element |
HTMLElement | the dom element to focus on. |
_disableLink(element)
- Description:
Replace an element with a copy with a different tag name.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | the original element |
_dragEnd(event)
- Description:
Drag end event handler.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the event. |
_dragEnter(event)
- Description:
Drag enter event handler.
The JS drag&drop API triggers several dragenter events on the same element because it bubbles the child events as well. To prevent this form affecting the dropzones display, this methods use "entercount" to determine if it's one extra child event or a valid one.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the event. |
_dragLeave(event)
- Description:
Drag over leave handler.
The JS drag&drop API triggers several dragleave events on the same element because it bubbles the child events as well. To prevent this form affecting the dropzones display, this methods use "entercount" to determine if it's one extra child event or a valid one.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the event. |
_dragOver(event)
- Description:
Drag over event handler.
We only use dragover event when a draggable action starts inside a valid dropzone. In those cases the API won't trigger any dragEnter because the dragged alement was already there. We use the dropzonevisible to determine if the component needs to display the dropzones or not.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the event. |
_dragStart(event)
- Description:
Drag start event handler.
This method will generate the current dropable data. This data is the one used to determine if a droparea accepts the dropping or not.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the event. |
_drop(event)
- Description:
Drop event handler.
This method will call both hideDropZones and drop methods on the parent component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the event. |
_expandSectionNode(element, forceValue)
- Description:
Expand a section node.
By default the method will use element.indexcollapsed to decide if the section is opened or closed. However, using forceValue it is possible to open or close a section independant from the indexcollapsed attribute.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
element |
Object | the course module state element |
forceValue |
boolean | optional forced expanded value |
(async) _fixOrder(container, neworder, selector, dettachedelements, createMethod)
- Description:
Fix/reorder the section or cms order.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
Element | the HTML element to reorder. |
neworder |
Array | an array with the ids order |
selector |
string | the element selector |
dettachedelements |
Object | a list of dettached elements |
createMethod |
function | method to create missing elements |
_fixOrder(container, neworder, allitems)
- Description:
Fix/reorder the section or cms order.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
Element | the HTML element to reorder. |
neworder |
Array | an array with the ids order |
allitems |
Array | the list of html elements that can be placed in the container |
_getClosestActionMenuToogler(element) → {HTMLElement|undefined}
- Description:
Get the closest actions menu toggler to an action element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | the action link element |
Returns:
- Type
- HTMLElement | undefined
_getDebouncedReloadCm(cmId) → {function}
- Description:
Generate or get a reload CM debounced function.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
cmId |
Number |
Returns:
the debounced reload function
- Type
- function
_getDraggableData() → {Object}
- Description:
Get the draggable data of this component.
- Source:
Returns:
exported course module drop data
- Type
- Object
_getDropData(event) → {Object|undefined}
- Description:
Get the current dropdata for a specific event.
The browser can generate drag&drop events related to several user interactions:
- Drag a page elements: this case is registered in the activeDropData map
- Drag some HTML selections: ignored for now
- Drag a file over the browser: file drag may appear in the future but for now they are ignored.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the original event. |
Returns:
with the dragged data (or undefined if none)
- Type
- Object | undefined
(async) _getLoggerEntry(stateManager, action, itemIds, data) → {Object}
- Description:
Get log entry for the current action.
- Source:
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
stateManager |
StateManager | the current state manager |
|||||||||||||||
action |
string | the action name |
|||||||||||||||
itemIds |
Array.<int> | null | the element ids |
|||||||||||||||
data |
Object | undefined | extra params for the log entry Properties
|
Returns:
the log entry
- Type
- Object
_indexContents()
- Description:
Regenerate content indexes.
This method is used when a legacy action refresh some content element.
- Source:
_modalBodyRenderedPromise(modalParams) → {Promise}
- Description:
Render a modal and return a body ready promise.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
modalParams |
object | the modal params |
Returns:
the modal body ready promise
- Type
- Promise
_prepareFields(stateManager, updateName, fields) → {Object}
- Description:
Add default values to state elements.
This method is called every time a webservice returns a update state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
Returns:
final fields data
- Type
- Object
_processEvent(event) → {Object|false}
- Description:
Process a drag and drop event and delegate logic to the parent component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the drag and drop event |
Returns:
the dropdata or null if the event should not be processed
- Type
- Object | false
_publishEvents()
- Description:
Internal method to publish events.
This is a private method, it will be invoked when the state is set back to read only mode.
- Source:
_refreshAllSectionsToggler(state)
- Description:
Refresh the collapse/expand all sections element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | The state data |
_refreshCm(param)
- Description:
Update a course index cm using the state information.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
_refreshCm(param)
- Description:
Update a course index cm using the state information.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
(async) _refreshCompletion(details)
- Description:
Update the activity completion icon.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
details |
Object | the update details Properties
|
_refreshCourseSectionlist(param)
- Description:
Refresh the section list.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
Object |
Properties
|
_refreshCourseSectionlist(param)
- Description:
Refresh the section list.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
_refreshPageItem(details)
- Description:
Handle a page item update.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
details |
Object | the update details Properties
|
_refreshPageItem(details)
- Description:
Handle a page item update.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
details |
Object | the update details Properties
|
_refreshPageItem(details)
- Description:
Handle a page item update.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
details |
Object | the update details Properties
|
_refreshSection(param)
- Description:
Update a course index section using the state information.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
Object | details the update details. Properties
|
_refreshSection(param)
- Description:
Update a content section using the state information.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
_refreshSectionCmlist(param)
- Description:
Refresh a section cm list.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
Object |
Properties
|
_refreshSectionCmlist(param)
- Description:
Refresh a section cm list.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
object |
Properties
|
_refreshSectionCollapsed(args)
- Description:
Update section collapsed state via bootstrap 4 if necessary.
Formats that do not use bootstrap 4 must override this method in order to keep the section toggling working.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
args |
object |
Properties
|
_refreshSectionCollapsed(args)
- Description:
Update section collapsed.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
object |
Properties
|
_refreshSectionNumber(param)
- Description:
Update a course section when the section number changes.
The courseActions module used for most course section tools still depends on css classes and section numbers (not id). To prevent inconsistencies when a section is moved, we need to refresh the
Course formats can override the section title rendering so the frontend depends heavily on backend rendering. Luckily in edit mode we can trigger a title update using the inplace_editable module.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param |
Object |
Properties
|
_reloadCm(param0)
- Description:
Reload a course module contents.
Most course module HTML is still strongly backend dependant. Some changes require to get a new version of the module.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param0 |
object | the watcher details Properties
|
_reloadSection(param0)
- Description:
Reload a course section contents.
Section HTML is still strongly backend dependant. Some changes require to get a new version of the section.
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
param0 |
details | the watcher details Properties
|
(async) _requestAddSection(target, event)
- Description:
Handle a create section request.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the dispatch action element |
event |
Event | the triggered event |
(async) _requestDeleteSection(target, event)
- Description:
Handle a delete section request.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the dispatch action element |
event |
Event | the triggered event |
(async) _requestMoveCm(target, event)
- Description:
Handle a move cm request.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the dispatch action element |
event |
Event | the triggered event |
(async) _requestMoveSection(target, event)
- Description:
Handle a move section request.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the dispatch action element |
event |
Event | the triggered event |
(async) _requestMutationAction(target, event, mutationName)
- Description:
Basic mutation action helper.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the dispatch action element |
event |
Event | the triggered event |
mutationName |
string | the mutation name |
_scanIndex(selector, index, creationhandler)
- Description:
Reindex a content (section or cm) of the course content.
This method is used internally by _indexContents.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | the DOM selector to scan |
index |
* | the index attribute to update |
creationhandler |
* | method to create a new indexed element |
_scrollHandler()
- Description:
Check the current page scroll and update the active element if necessary.
- Source:
(async) _sectionBasicAction(stateManager, action, sectionIds, targetSectionId, targetCmId)
- Description:
Execute a basic section state action.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
action |
string | the action name |
sectionIds |
array | the section ids |
targetSectionId |
number | optional target section id (for moving actions) |
targetCmId |
number | optional target cm id (for moving actions) |
_sectionTogglers(event)
- Description:
Setup sections toggler.
Toggler click is delegated to the main course content element because new sections can appear at any moment and this way we prevent accidental double bindings.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the triggered event |
_sectionTogglers(event)
- Description:
Setup sections toggler.
Toggler click is delegated to the main course index element because new sections can appear at any moment and this way we prevent accidental double bindings.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the triggered event |
_setAddSectionLocked(locked)
- Description:
Disable all add sections actions.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
locked |
boolean | the new locked value. |
_startProcessing()
- Description:
Setup the component to start a transaction.
Some of the course actions replaces the current DOM element with a new one before updating the course state. This means the component cannot preload any index properly until the transaction starts.
- Source:
(async) _updateActionsMenu(section)
- Description:
Update a section action menus.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
section |
object | the section state. |
_updateBadges(section)
- Description:
Update a section badges using the state information.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
section |
object | the section state. |
_updateStateSectionPreference(stateManager, preferenceName, sectionIds, preferenceValue) → {Array.<Number>|null}
- Description:
Private batch update for a section preference attribute.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
preferenceName |
string | the preference name |
sectionIds |
array | the affected section ids |
preferenceValue |
boolean | the new preferenceValue value |
Returns:
sections ids with the preference value true or null if no update is required
- Type
- Array.<Number> | null
accessibilityHide()
- Description:
Restores the aria visibility on the DOM elements changed when displaying the dialogue popup and makes the dialogue aria hidden to allow screen readers to navigate the main page correctly when the dialogue is closed.
- Source:
accessibilityShow()
- Description:
Sets the appropriate aria attributes on this dialogue and the other elements in the DOM to ensure that screen readers are able to navigate the dialogue popup correctly.
- Source:
activeSearch(clearIcon)
- Description:
Change the searching icon to its' active state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
clearIcon |
HTMLElement | Our closing icon to manipulate. |
addActions(actions)
- Description:
Add extra actions to the module.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
actions |
array | array of methods to execute |
addEventListener(target, type, listener)
- Description:
Add and bind an event listener to a target and keep track of all event listeners.
The native element.addEventListener method is not object oriented friently as the "this" represents the element that triggers the event and not the listener class. As components can be unregister and removed at any time, the BaseComponent provides this method to keep track of all component listeners and do all of the bind stuff.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the event target |
type |
string | the event name |
listener |
function | the class method that recieve the event |
addIconToContainer(container) → {Promise}
- Description:
Add a loading icon to the end of the specified container and return an unresolved promise.
Resolution of the returned promise causes the icon to be faded out and removed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
jQuery | HTMLElement | The element to add the spinner to |
Returns:
The Promise used to create the icon.
- Type
- Promise
addIconToContainerWithPromise(container, loadingIconPromise) → {jQuery}
- Description:
Add a loading icon to the end of the specified container and return an unresolved promise.
Resolution of the returned promise causes the icon to be faded out and removed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
jQuery | HTMLElement | The element to add the spinner to |
loadingIconPromise |
Promise | The jQuery Promise which determines the removal of the icon |
Returns:
The Promise used to create and then remove the icon.
- Type
- jQuery
addIconToContainerWithPromise(container) → {Promise}
- Description:
Add a loading icon to the end of the specified container and return an unresolved promise.
Resolution of the returned promise causes the icon to be faded out and removed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
container |
jQuery | HTMLElement | The element to add the spinner to |
Returns:
A jQuery Promise to resolve when ready
- Type
- Promise
addLoggerEntry(entry)
- Description:
Add a new log entry into the reactive logger.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entry |
LoggerEntry |
addMutations(newFunctions)
- Description:
Add individual functions to the mutations.
Note new mutations will be added to the existing ones. To replace the full mutation object with a new one, use setMutations method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
newFunctions |
Object | an object with new mutation functions. |
(async) addSection(stateManager, targetSectionId)
- Description:
Add a new section to a specific course location.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
targetSectionId |
number | optional the target section id |
addSelectors(newSelectors)
- Description:
Add or update the component selectors.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
newSelectors |
Object | an object of new selectors. |
addToFavourites(root, courseId)
- Description:
Add course to favourites
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id number |
addUpdateTypes(newFunctions)
- Description:
Add methods to process update state messages.
The state manager provide a default update, create and delete methods. However, some applications may require to override the default methods or even add new ones like "refresh" or "error".
- Source:
Parameters:
Name | Type | Description |
---|---|---|
newFunctions |
Object | the new update types functions. |
allItemsArray(state) → {Array}
- Description:
Return a sorted list of all sections and cms items in the state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the current state. |
Returns:
all sections and cms items in the state.
- Type
- Array
asyncSet(value, setFunction) → {Promise}
- Description:
Set or resolve and set the value using the function.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | object | The string or jQuery promise. |
setFunction |
function | The setter |
Returns:
- Type
- Promise
attachToDOM()
- Description:
Attach the modal to the correct part of the page.
If it hasn't already been added it runs any javascript that has been cached until now.
- Source:
calculateZIndex() → {int}
- Description:
Determine the highest z-index value currently on the page.
- Source:
Returns:
- Type
- int
callWatchersHandler(event)
- Description:
State changed listener.
This function take any state change and send it to the proper watchers.
To prevent internal state changes from colliding with other reactive instances, only the general "state changed" is triggered at document level. All the internal changes are triggered at private target level without bubbling. This way any reactive instance can alert only its own watchers.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
CustomEvent |
checkImage() → {Node}
- Description:
Check accessiblity issue only for img type.
- Source:
Returns:
A complete list of all warnings and problems.
- Type
- Node
checkTableCaption() → {Node}
- Description:
Look for any table without a caption.
- Source:
Returns:
A complete list of all warnings and problems.
- Type
- Node
clean()
- Description:
Clean local storage
- Source:
cm(state, cminfo) → {Object}
- Description:
Generate a cm export data from the state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the current state. |
cminfo |
Object | the course module state data. |
Returns:
- Type
- Object
cmCompletion(stateManager, cmIds, complete)
- Description:
Mark or unmark course modules as complete.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of course modules ids |
complete |
bool | the new completion value |
cmCompletion(state, cminfo) → {Object}
- Description:
Generate a compoetion export data from the cm element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the current state. |
cminfo |
Object | the course module state data. |
Returns:
- Type
- Object
cmDrag(stateManager, cmIds, dragValue)
- Description:
Mark or unmark course modules as dragging.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of course modules ids |
dragValue |
bool | the new dragging value |
cmDraggableData(state, cmid) → {Object|null}
- Description:
Generate a dragable cm data structure.
This method is used by any draggable course module element to generate drop data for its reactive/dragdrop instance.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
* | the state object |
cmid |
* | the cours emodule id |
Returns:
- Type
- Object | null
(async) cmHide(stateManager, cmIds)
- Description:
Hide cms.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of cm ids |
cmLock(stateManager, cmIds, lockValue)
- Description:
Lock or unlock course modules.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of course modules ids |
lockValue |
bool | the new locked value |
(async) cmMove(stateManager, cmids, targetSectionId, targetCmId)
- Description:
Move course modules to specific course location.
Note that one of targetSectionId or targetCmId should be provided in order to identify the new location:
- targetCmId: the activities will be located avobe the target cm. The targetSectionId value will be ignored in this case.
- targetSectionId: the activities will be appended to the section. In this case targetSectionId should not be present.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmids |
array | the list of cm ids to move |
targetSectionId |
number | the target section id |
targetCmId |
number | the target course module id |
(async) cmMoveLeft(stateManager, cmIds)
- Description:
Move cms to the left: indent = 0.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of cm ids |
(async) cmMoveRight(stateManager, cmIds)
- Description:
Move cms to the right: indent = 1.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of cm ids |
(async) cmShow(stateManager, cmIds)
- Description:
Show cms.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of cm ids |
cmState(stateManager, cmids)
- Description:
Get updated state data related to some cm ids.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state |
cmids |
array | the list of cm ids to update |
(async) cmStealth(stateManager, cmIds)
- Description:
Stealth cms.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
cmIds |
array | the list of cm ids |
collapseGroup(item)
- Description:
Collpase a group item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item |
JQuery | the jQuery object |
configDragDrop(sectionid, state, fullregion)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sectionid |
number | the section id |
state |
Object | the initial state |
fullregion |
Element | the complete section region to mark as dragged |
configDragDrop(sectionitem)
- Description:
Register state values and the drag and drop subcomponent.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sectionitem |
BaseComponent | section item component |
configDragDrop(cmid)
- Description:
Configure the component drag and drop.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
cmid |
number | course module id |
configState(state)
- Description:
Save some values form the state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the current state |
count(args) → {Promise}
- Description:
Get a count of LTI tool types and tool proxies from Moodle for the given search args.
See also: mod/lti/classes/external.php get_tool_types_and_proxies_count()
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
Object | Search parameters |
Returns:
Promise that will be resolved when the ajax call returns.
- Type
- Promise
countOtherVisibleModals() → {int}
- Description:
Count the number of other visible modals (not including this one).
- Source:
Returns:
- Type
- int
course(state) → {Object}
- Description:
Generate the course export data from the state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the current state. |
Returns:
- Type
- Object
(async) courseState(stateManager)
- Description:
Get the full updated state data of the course.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state |
create(parent)
- Description:
Constructor hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
parent |
BaseComponent | the parent component. |
create(descriptor)
- Description:
Component create function.
Default init method will call "create" when all internal attributes are set but before the component is not yet registered in the reactive module.
In this method any component can define its own defaults such as:
- this.selectors {object} the default query selectors of this component.
- this.events {object} a list of event names this component dispatch
- extract any data from the main dom element (this.element)
- set any other data the component uses
- Source:
Parameters:
Name | Type | Description |
---|---|---|
descriptor |
descriptor | the component descriptor |
create(descriptor)
- Description:
Constructor hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
descriptor |
Object | the component descriptor |
create(descriptor)
- Description:
Constructor hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
descriptor |
Object |
create()
- Description:
Constructor hook.
- Source:
create()
- Description:
Component creation hook.
- Source:
create()
- Description:
Constructor hook.
- Source:
create()
- Description:
Constructor hook.
- Source:
create()
- Description:
Constructor hook.
- Source:
create()
- Description:
Constructor hook.
- Source:
create()
- Description:
Constructor hook.
- Source:
create()
- Description:
Constructor hook.
- Source:
create(descriptor)
- Description:
Constructor hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
descriptor |
Object |
create()
- Description:
Constructor hook.
- Source:
createWarnings(description, nodes, isImageType) → {Array.<ProblemDetail>}
- Description:
Generate the data that describes the issues found.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
description |
String | Description of this failure. |
nodes |
Array.<HTMLElement> | An array of failing nodes. |
isImageType |
boolean | Whether the warnings are related to image type checks |
Returns:
A set of problem details
- Type
- Array.<ProblemDetail>
defaultCreate(stateManager, updateName, fields)
- Description:
Process a create state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
defaultDelete(stateManager, updateName, fields)
- Description:
Process a delete state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
defaultOverride(stateManager, updateName, fields)
- Description:
Process an override state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
defaultPrepareFields(stateManager, updateName, fields) → {Object}
- Description:
Prepare fields for processing.
This method is used to add default values or calculations from the frontend side.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
Returns:
final fields data
- Type
- Object
defaultPut(stateManager, updateName, fields)
- Description:
Process a put state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
defaultRemove(stateManager, updateName, fields)
- Description:
Process a remove state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
defaultUpdate(stateManager, updateName, fields)
- Description:
Process a update state message.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
Object | the state manager |
updateName |
String | the state element to update |
fields |
Object | the new data |
destroy()
- Description:
Remove this modal from the DOM.
- Source:
destroy()
- Description:
Component destroy hook.
BaseComponent call this method when a component is unregistered or removed.
Components may override this method to clean the HTML or do some action when the component is unregistered or removed.
- Source:
destroy()
- Description:
Remove all subcomponents dependencies.
- Source:
destroy()
- Description:
Remove all subcomponents dependencies.
- Source:
destroy()
- Description:
Remove all subcomponents dependencies.
- Source:
dispatch(actionName, params)
- Description:
Dispatch a change in the state.
This method is the only way for components to alter the state. Watchers will receive a read only state to prevent illegal changes. If some user action require a state change, the component should dispatch a mutation to trigger all the necessary logic to alter the state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
actionName |
string | the action name (usually the mutation name) |
params |
mixed | any number of params the mutation needs. |
dispatch(args)
- Description:
Dispatch a change in the state.
Usually reactive modules throw an error directly to the components when something goes wrong. However, course editor can directly display a notification.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
mixed | any number of params the mutation needs. |
dispatchRegistrationFail()
- Description:
Dispatch a component registration fail event to inform the parent node.
As dispatchRegistrationSuccess, this method will communicate the registration fail to the parent node to inform the possible parent component.
- Source:
dispatchRegistrationSuccess()
- Description:
Dispatch a component registration event to inform the parent node.
The registration event is different from the rest of the component events because is the only way in which components can communicate its existence to a possible parent. Most components will be created by including a mustache file, child components must emit a registration event to the parent DOM element to alert about the registration.
- Source:
dragEnd(dropdata)
- Description:
The element end start hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the dropdata |
dragEnd(dropdata)
- Description:
The element drop end hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the dropdata |
dragEnd(dropdata)
- Description:
The element drop end hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the dropdata |
dragStart(dropdata)
- Description:
The element drop start hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the dropdata |
dragStart(dropdata)
- Description:
The element drop start hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the dropdata |
dragStart(dropdata)
- Description:
The element drop start hook.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the dropdata |
drop(dropdata)
- Description:
Drop event handler.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the accepted drop data |
drop(dropdata)
- Description:
Drop event handler.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the accepted drop data |
drop(dropdata)
- Description:
Drop event handler.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the accepted drop data |
enterCallback(jQueryItem)
- Description:
Handle enter key on a collpasible node.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
jQueryItem |
JQuery | the jQuery object |
expandAllGroups()
- Description:
Expand all groups.
- Source:
expandGroup(item)
- Description:
Expand a group item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item |
JQuery | the jQuery object |
formatSeconds(secs) → {String}
- Description:
Helper method to convert time remaining in seconds into HH:MM:SS format.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
secs |
Number | Time remaining in seconds to get value for. |
Returns:
Time remaining in HH:MM:SS format.
- Type
- String
get(type) → {object}
- Description:
Get a registered type of modal.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The type of modal to get |
Returns:
The registered config for the modal
- Type
- object
get(key) → {boolean|string}
- Description:
Get a value from local storage. Remember - all values must be strings.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The cache key to check. |
Returns:
False if the value is not in the cache, or some other error - a string otherwise.
- Type
- boolean | string
get(name, id) → {Object|undefined}
- Description:
Get an element from the state or form an alternative state object.
The altstate param is used by external update functions that gets the current state as param.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the state object name |
id |
* | and object id for state maps. |
Returns:
the state object found
- Type
- Object | undefined
get(name, id) → {Object|undefined}
- Description:
Get state data.
Components access the state frequently. This convenience method is a shortcut to this.reactive.state.stateManager.get() method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the state object name |
id |
* | an optional object id for state maps. |
Returns:
the state object found
- Type
- Object | undefined
getActiveItem() → {Element|undefined}
- Description:
Return the current active node.
- Source:
Returns:
the active item if any
- Type
- Element | undefined
getAddFavouriteMenuItem(root, courseId) → {Object}
- Description:
Get the action menu item
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id. |
Returns:
The add to favourite menu item.
- Type
- Object
getBackdrop() → {object}
- Description:
Get the modal backdrop.
- Source:
Returns:
jQuery promise
- Type
- object
getBody() → {object}
- Description:
Get the modal body element.
- Source:
Returns:
jQuery object
- Type
- object
getBodyPromise() → {object}
- Description:
Get a promise resolving to the body region.
- Source:
Returns:
jQuery object
- Type
- object
getClasses() → {Object}
- Description:
Return the component drag and drop CSS classes.
- Source:
Returns:
the dragdrop css classes
- Type
- Object
getColumnOrder(listRoot) → {Array}
- Description:
Gets the newly reordered columns to display in the question bank view.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
listRoot |
Element |
Returns:
- Type
- Array
getContent() → {object}
- Description:
Return the jQuery element with the content. This will return either the unread notification container or the all notification container depending on which is currently visible.
- Source:
Returns:
jQuery object currently visible content contianer
- Type
- object
getCourseId(root) → {Number}
- Description:
Get the course id from a favourite element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The favourite icon container element. |
Returns:
Course id.
- Type
- Number
(async) getDialogueContent() → {Promise.<Array>}
- Description:
Return the dialogue content.
- Source:
Returns:
A template promise containing the rendered dialogue content.
- Type
- Promise.<Array>
getDraggableData() → {Object}
- Description:
Get the draggable data of this component.
- Source:
Returns:
exported course module drop data
- Type
- Object
getElementLocked(target) → {boolean}
- Description:
Get the current locked value from the element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the event target |
Returns:
- Type
- boolean
getElements(query, dataId) → {NodeList}
- Description:
Get the all subelement that match a query selector.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
query |
string | undefined | optional subelement query |
dataId |
string | undefined | optional data-id value |
Returns:
the DOM elements
- Type
- NodeList
getEvents() → {Object}
- Description:
Return the component custom event names.
Components may override this method to provide their own events.
Component custom events is an important part of component reusability. This function is static because is part of the component definition and should be accessible from outsite the instances. However, values will be available at instance level in the this.events object.
- Source:
Returns:
the component events.
- Type
- Object
getExporter() → {Exporter}
- Description:
Return a data exporter to transform state part into mustache contexts.
- Source:
Returns:
the exporter class
- Type
- Exporter
getFavouriteIconContainer(root, courseId) → {Object}
- Description:
Get the container element for the favourite icon.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id number |
Returns:
The favourite icon container
- Type
- Object
getFilterValues(root) → {filters}
- Description:
Get filter values from DOM.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
object | The root element for the courses view. |
Returns:
Set filters.
- Type
- filters
getFooter() → {object}
- Description:
Get the modal footer element.
- Source:
Returns:
jQuery object
- Type
- object
getFooterPromise() → {object}
- Description:
Get a promise resolving to the footer region.
- Source:
Returns:
jQuery object
- Type
- object
getHideCourseMenuItem(root, courseId) → {Object}
- Description:
Get the action menu item
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id. |
Returns:
The hide course menu item.
- Type
- Object
getInitialPromise() → {Promise}
- Description:
Generate a promise that will be resolved when the initial state is loaded.
In most cases the final state will be loaded using an ajax call. This is the reason why states manager are created unlocked and won't be reactive until the initial state is set.
- Source:
Returns:
the resulting promise
- Type
- Promise
getLastCm() → {element|null}
- Description:
Get the last CM element of that section.
- Source:
Returns:
- Type
- element | null
getLastCm() → {element|null}
- Description:
Get the last CM element of that section.
- Source:
Returns:
the las course module element of the section.
- Type
- element | null
getLastCm() → {element|null}
- Description:
Get the last CM element of that section.
- Source:
Returns:
- Type
- element | null
getModal() → {object}
- Description:
Get the modal element of this modal.
- Source:
Returns:
jQuery object
- Type
- object
getModalCount() → {int}
- Description:
Get the unique modal count.
- Source:
Returns:
- Type
- int
getMyCourses(filters, limit) → {promise}
- Description:
Get enrolled courses from backend.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filters |
object | The filters for this view. |
limit |
int | The number of courses to show. |
Returns:
Resolved with an array of courses.
- Type
- promise
getNotificationElement(id) → {object|null}
- Description:
Find the notification element for the given id.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
id |
int |
Returns:
The notification element
- Type
- object | null
getOffset() → {int}
- Description:
Get the offset value for the current state of the popover in order to sent to the backend to correctly paginate the notifications.
- Source:
Returns:
current offset
- Type
- int
getPagedContentContainer(root, index) → {Object}
- Description:
Get the paged content container element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
index |
Number | Rendered page index. |
Returns:
The rendered paged container.
- Type
- Object
getRemoveFavouriteMenuItem(root, courseId) → {Object}
- Description:
Get the action menu item
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id. |
Returns:
The remove from favourites menu item.
- Type
- Object
getRoot() → {object}
- Description:
Get the root element of this modal.
- Source:
Returns:
jQuery object
- Type
- object
getSearchMyCourses(filters, limit, searchValue) → {promise}
- Description:
Search for enrolled courses from backend.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filters |
object | The filters for this view. |
limit |
int | The number of courses to show. |
searchValue |
string | What does the user want to search within their courses. |
Returns:
Resolved with an array of courses.
- Type
- promise
getSelector(selectorName) → {string|undefined}
- Description:
Return a component selector.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
selectorName |
string | the selector name |
Returns:
the query selector
- Type
- string | undefined
(async) getServerCourseState() → {Object}
- Description:
Load the current course state from the server.
- Source:
Returns:
the current course state
- Type
- Object
getShowCourseMenuItem(root, courseId) → {Object}
- Description:
Get the action menu item
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id. |
Returns:
The show course menu item.
- Type
- Object
getState() → {Promise}
- Description:
Return the initial state promise.
Typically, components do not require to use this promise because registerComponent will trigger their stateReady method automatically. But it could be useful for complex components that require to combine state, template and string loadings.
- Source:
Returns:
- Type
- Promise
getStorageValue(key) → {boolean|string}
- Description:
Get a value from the course editor static storage if any.
The course editor static storage uses the sessionStorage to store values from the components. This is used to prevent unnecesary template loadings on every page. However, the storage does not work if no sessionStorage can be used (in debug mode for example), if the page is in editing mode or if the initial state change from the last page.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | the key to get |
Returns:
the storage value or false if cannot be loaded
- Type
- boolean | string
getTitle() → {object}
- Description:
Get the modal title element.
- Source:
Returns:
jQuery object
- Type
- object
getTitlePromise() → {Promise}
- Description:
Get a promise resolving to the title region.
- Source:
Returns:
- Type
- Promise
getWarnings() → {Array.<ProblemDetail>}
- Description:
Find all problems with the content editable region.
- Source:
Returns:
A complete list of all warnings and problems.
- Type
- Array.<ProblemDetail>
getWatchers() → {array}
- Description:
Return the list of watchers that component has.
Each watcher is represented by an object with two attributes:
- watch (string) the specific state event to watch. Example 'section.visible:updated'
- handler (function) the function to call when the watching state change happens
Any component shoudl override this method to define their state watchers.
- Source:
Returns:
array of watchers.
- Type
- array
getWatchers() → {Array}
- Description:
Return the component watchers.
- Source:
Returns:
of watchers
- Type
- Array
getWatchers() → {Array}
- Description:
Component watchers.
- Source:
Returns:
of watchers
- Type
- Array
getWatchers() → {Array}
- Description:
Component watchers.
- Source:
Returns:
of watchers
- Type
- Array
getWatchers() → {Array}
- Description:
Component watchers.
- Source:
Returns:
of watchers
- Type
- Array
getWatchers() → {Array}
- Description:
Return the component watchers.
- Source:
Returns:
of watchers
- Type
- Array
getWatchers() → {Array}
- Description:
Component watchers.
- Source:
Returns:
of watchers
- Type
- Array
handleItemClick(event, jQueryItem)
- Description:
Handle an item click.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the click event |
jQueryItem |
jQuery | the item clicked |
hasDoneInitialLoad() → {bool}
- Description:
Check if the first load of notification has been triggered for the current state of the popover.
- Source:
Returns:
true if first notification loaded, false otherwise
- Type
- bool
hasFocus() → {bool}
- Description:
Check if this modal has focus.
- Source:
Returns:
- Type
- bool
hasFooterContent() → {bool}
- Description:
Check if the footer has any content in it.
- Source:
Returns:
- Type
- bool
hasLoadedAllContent() → {bool}
- Description:
Check if we've loaded all of the notifications for the current popover state.
- Source:
Returns:
true if all notifications loaded, false otherwise
- Type
- bool
hasTransitions() → {bool}
- Description:
Check if this modal has CSS transitions applied.
- Source:
Returns:
- Type
- bool
hide()
- Description:
Hide this modal.
- Source:
hideCourse(root, courseId)
- Description:
Hide course
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id number |
hideDropZone()
- Description:
Hide the component dropzone.
- Source:
hideDropZone()
- Description:
Hide the component dropzone.
- Source:
hideDropZone()
- Description:
Hide the component dropzone.
- Source:
hideElement(root, id)
- Description:
Reset the loadedPages dataset to take into account the hidden element
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
id |
Number | The course id number |
hideFavouriteIcon(root, courseId)
- Description:
Hide the favourite icon.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The favourite icon container element. |
courseId |
Number | Course id number. |
hideFooter()
- Description:
Hide the footer element.
- Source:
hideIfNotForm()
- Description:
Hide this modal if it does not contain a form.
- Source:
hideUnreadCount()
- Description:
Hide the unread notification count badge on the menu toggle.
- Source:
incrementOffset()
- Description:
Increment the offset for the current state, if required.
- Source:
init()
- Description:
Initialize the page.
- Source:
init(timerId)
- Description:
Set up the submission timer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
timerId |
Number | Unique ID of the timer element. |
initializePagedContent(root, promiseFunction, inputValue)
- Description:
Initialise the courses list and cards views on page load.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
root |
object | The root element for the courses view. |
|
promiseFunction |
function | How do we fetch the courses and what do we do with them? |
|
inputValue |
null | string |
null
|
What to search for |
isGroupCollapsed(jQueryItem) → {boolean}
- Description:
Check if a gorup item is collapsed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
jQueryItem |
JQuery | the jQuery object |
Returns:
if the element is collapsed
- Type
- boolean
isLarge() → {bool}
- Description:
Check if the modal is a large modal.
- Source:
Returns:
- Type
- bool
isSmall() → {bool}
- Description:
Check if the modal is a small modal.
- Source:
Returns:
- Type
- bool
isVisible() → {bool}
- Description:
Check if this modal is visible.
- Source:
Returns:
- Type
- bool
itemsPerPageFunc(pagingLimit, root) → {Array.<Number>}
- Description:
Figure out how many items are going to be allowed to be rendered in the block.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pagingLimit |
Number | How many courses to display |
root |
Object | The course overview container |
Returns:
How many courses will be rendered
- Type
- Array.<Number>
(async) loadCourse(courseId, serverStateKey)
- Description:
Set up the course editor when the page is ready.
The course can only be loaded once per instance. Otherwise an error is thrown.
The backend can inform the module of the current state key. This key changes every time some update in the course affect the current user state. Some examples are:
- The course content has been edited
- The user marks some activity as completed
- The user collapses or uncollapses a section (it is stored as a user preference)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
courseId |
number | course id |
serverStateKey |
string | the current backend course cache reference |
loadMoreNotifications() → {object}
- Description:
Send a request for more notifications from the server, if we aren't already loading some and haven't already loaded all of them.
Takes into account the current mode of the popover and will request only unread notifications if required.
All notifications are marked as read by the server when they are returned.
- Source:
Returns:
jQuery promise that is resolved when notifications have been retrieved and added to the DOM
- Type
- object
loadStaticContent() → {boolean}
- Description:
Load the course index from the session storage if any.
- Source:
Returns:
true if the static version is loaded form the session
- Type
- boolean
(async) loadTemplateContent(state)
- Description:
Load the course index template.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the initial state |
markAllAsRead() → {Promise}
- Description:
Send a request to the server to mark all unread notifications as read and update the unread count and unread notification elements appropriately.
- Source:
Returns:
- Type
- Promise
module:core/emoji/auto_complete(root, textArea, hasSuggestionCallback, selectCallback)
- Description:
Initialise the emoji auto complete.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Element | The root container element for the auto complete |
textArea |
Element | The text area element to monitor for auto complete |
hasSuggestionCallback |
function | Callback for when there are auto-complete suggestions |
selectCallback |
function | Callback for when the user selects an emoji |
module:core/emoji/picker(root, selectCallback)
- Description:
Initialise the emoji picker.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Element | The root element for the picker |
selectCallback |
function | Callback for when the user selects an emoji |
module:core/menu_navigation(elementRoot)
- Description:
The initial entry point that a given module can pass a HTMLElement.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
elementRoot |
HTMLElement | The menu to add handlers upon. |
module:core/moremenu(menu)
- Description:
Initialise the more menus.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
menu |
HTMLElement | The navbar moremenu. |
module:mod_forum/local/grades/local/grader/gradingpanel(component, context, gradingComponent, gradingSubtype, itemName) → {Object}
- Description:
Get the grade panel setter and getter for the current component. This function dynamically pulls the relevant gradingpanel JS file defined in the grading method. We do this because we do not know until execution time what the grading type is and we do not want to import unused files.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
component |
String | The component being graded |
context |
Number | The contextid of the thing being graded |
gradingComponent |
String | The thing providing the grading type |
gradingSubtype |
String | The subtype fo the grading component |
itemName |
String | The name of the thing being graded |
Returns:
- Type
- Object
module:mod_forum/local/grades/local/grader/user_picker(users, showUserCallback, preChangeUserCallback, currentUserIDopt) → {UserPicker}
- Description:
Create a new user picker.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
users |
Array | The list of users |
|
showUserCallback |
function | The function to call to show a specific user |
|
preChangeUserCallback |
function | The fucntion to call to save the grade for the current user |
|
currentUserID |
Number |
<optional> |
The userid of the current user |
Returns:
- Type
- UserPicker
noCoursesRender(root) → {promise}
- Description:
Given there are no courses to render provide the rendered template.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
object | The root element for the courses view. |
Returns:
jQuery promise resolved after rendering is complete.
- Type
- promise
pageBuilder(coursesData, currentPage, pageData, actions, activeSearch)
- Description:
Mutates and controls the loadedPages array and handles the bootstrapping.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
coursesData |
Array | Object | Array of all of the courses to start building the page from |
|
currentPage |
Number | What page are we currently on? |
|
pageData |
Object | Any current page information |
|
actions |
Object | Paged content helper |
|
activeSearch |
null | boolean |
null
|
Are we currently actively searching and building up search results? |
processUpdate(updateName, action, fields, updateTypes)
- Description:
Process a single state update.
Note this method will not lock or unlock the state by itself.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
updateName |
string | the state element to update |
action |
string | to action to perform |
fields |
object | the new data |
updateTypes |
Object | optional functions to override the default update types. |
processUpdates(updates, updateTypes)
- Description:
Process a state updates array and do all the necessary changes.
Note this method unlocks the state while it is executing and relocks it when finishes.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
updates |
array | |
updateTypes |
Object | optional functions to override the default update types. |
query(args) → {Promise}
- Description:
Get a list of LTI tool types and tool proxies from Moodle for the given search args.
See also: mod/lti/classes/external.php get_tool_types_and_proxies()
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
Object | Search parameters |
Returns:
Promise that will be resolved when the ajax call returns.
- Type
- Promise
register(type, module, template)
- Description:
Register a modal with the registry.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The type of modal (must be unique) |
module |
function | The modal module (must be a constructor function of type core/modal) |
template |
string | The template name of the modal |
registerChildComponent(component)
- Description:
Register a child component into the reactive instance.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
component |
self | the component to register. |
registerCloseOnCancel()
- Description:
Register a listener to close the dialogue when the cancel button is pressed.
- Source:
registerCloseOnSave()
- Description:
Register a listener to close the dialogue when the save button is pressed.
- Source:
registerComponent(component) → {object}
- Description:
Register a new component.
Component can provide some optional functions to the reactive module:
- getWatchers: returns an array of watchers
- stateReady: a method to call when the initial state is loaded
It can also provide some optional attributes:
- name: the component name (default value: "Unkown component") to customize debug messages.
The method will also use dispatchRegistrationSuccess and dispatchRegistrationFail. Those are BaseComponent methods to inform parent components of the registration status. Components should not override those methods.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
component |
object | the new component Properties
|
Returns:
the registered component
- Type
- object
registerEventListeners()
- Description:
Set up all of the event handling for the modal.
- Source:
registerEventListeners()
- Description:
Register event listeners for the default_notification_preferences page.
- Source:
registerEventListeners()
- Description:
Add all of the required event listeners for this notification popover.
- Source:
registerEventListeners(root, page)
- Description:
Listen to, and handle events for the myoverview block.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The myoverview block container element. |
page |
HTMLElement | The whole HTMLElement for our block. |
registerPagedEventHandlers(root, namespace)
- Description:
Intialise the paged list and cards views on page load. Returns an array of paged contents that we would like to handle here
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
object | The root element for the courses view |
namespace |
string | The namespace for all the events attached |
registerSelector(root)
- Description:
Event listener for the Display filter (cards, list).
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
object | The root element for the overview block |
registerStateAction(field, prop, action, data)
- Description:
Register a state modification and generate the necessary events.
This method is used mainly by proxy helpers to dispatch state change event. However, mutations can use it to inform components about non reactive changes in the state (only the two first levels of the state are reactive).
Each action can produce several events:
- The specific attribute updated, created or deleter (example: "cm.visible:updated")
- The general state object updated, created or deleted (example: "cm:updated")
- If the element has an ID attribute, the specific event with id (example: "cm[42].visible:updated")
- If the element has an ID attribute, the general event with id (example: "cm[42]:updated")
- A generic state update event "state:update"
- Source:
Parameters:
Name | Type | Description |
---|---|---|
field |
string | the affected state field name |
prop |
string | null | the affecter field property (null if affect the full object) |
action |
string | the action done (created/updated/deleted) |
data |
* | the affected data |
remove()
- Description:
Remove a previously rendered component instance.
This method will remove the component HTML and unregister it from the reactive module.
- Source:
removeAllEventListeners()
- Description:
Remove all event listeners from this component.
This method is called also when the component is unregistered or removed.
Note that only listeners registered with the addEventListener method will be removed. Other manual listeners will keep active.
- Source:
removeEventListener(target, type, listener)
- Description:
Remove an event listener from a component.
This method allows components to remove listeners without keeping track of the listeners bind versions of the method. Both addEventListener and removeEventListener keeps internally the relation between the original class method and the bind one.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the event target |
type |
string | the event name |
listener |
function | the class method that recieve the event |
removeFromFavourites(root, courseId)
- Description:
Remove course from favourites
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id number |
renderComponent(target, file, data) → {Promise}
- Description:
Render a new Component using a mustache file.
It is important to note that this method should NOT be used for loading regular mustache files as it returns a Promise that will only be resolved if the mustache registers a component instance.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
element | the DOM element that contains the component |
file |
string | the component mustache file to render |
data |
* | the mustache data |
Returns:
a promise of the resulting component instance
- Type
- Promise
renderCourses(root, coursesData) → {promise}
- Description:
Render the dashboard courses.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
object | The root element for the courses view. |
coursesData |
array | containing array of returned courses. |
Returns:
jQuery promise resolved after rendering is complete.
- Type
- promise
renderNotifications(notifications, container) → {object}
- Description:
Render the notification data with the appropriate template and add it to the DOM.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
notifications |
array | Notification data |
container |
object | jQuery object the container to append the rendered notifications |
Returns:
jQuery promise that is resolved when all notifications have been rendered and added to the DOM
- Type
- object
renderUnreadCount()
- Description:
Show the unread notification count badge on the menu toggle if there are unread notifications, otherwise hide it.
- Source:
resetGlobals()
- Description:
In cases when switching between regular rendering and search rendering we need to reset some variables.
- Source:
searchFunctionalityCurry() → {function}
- Description:
Initialize the searching functionality so we can call it when required.
- Source:
Returns:
- Type
- function
section(state, sectioninfo) → {Object}
- Description:
Generate a section export data from the state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the current state. |
sectioninfo |
Object | the section state data. |
Returns:
- Type
- Object
(async) sectionContentCollapsed(stateManager, sectionIds, collapsed)
- Description:
Update the course content collapsed attribute of some sections.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the affected section ids |
collapsed |
boolean | the new collapsed value |
(async) sectionDelete(stateManager, sectionIds)
- Description:
Delete sections.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the list of course modules ids |
sectionDrag(stateManager, sectionIds, dragValue)
- Description:
Mark or unmark course sections as dragging.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the list of section ids |
dragValue |
bool | the new dragging value |
sectionDraggableData(state, sectionid) → {Object|null}
- Description:
Generate a dragable cm data structure.
This method is used by any draggable section element to generate drop data for its reactive/dragdrop instance.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
* | the state object |
sectionid |
* | the cours section id |
Returns:
- Type
- Object | null
(async) sectionHide(stateManager, sectionIds)
- Description:
Hides sections.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the list of section ids |
(async) sectionIndexCollapsed(stateManager, sectionIds, collapsed)
- Description:
Update the course index collapsed attribute of some sections.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the affected section ids |
collapsed |
boolean | the new collapsed value |
sectionLock(stateManager, sectionIds, lockValue)
- Description:
Lock or unlock course sections.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the list of section ids |
lockValue |
bool | the new locked value |
(async) sectionMove(stateManager, sectionIds, targetSectionId)
- Description:
Move course modules to specific course location.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the list of section ids to move |
targetSectionId |
number | the target section id |
(async) sectionShow(stateManager, sectionIds)
- Description:
Show sections.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
sectionIds |
array | the list of section ids |
sectionState(stateManager, sectionIds)
- Description:
Get updated state data related to some section ids.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state |
sectionIds |
array | the list of section ids to update |
selectAndScroll(node)
- Description:
Set the selection and scroll to the selected element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
node |
node |
set(key, value) → {boolean}
- Description:
Set a value to local storage. Remember - all values must be strings.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The cache key to set. |
value |
string | The value to set. |
Returns:
False if the value can't be saved in the cache, or some other error - true otherwise.
- Type
- boolean
setBody(value)
- Description:
Set the modal body element.
This method is overloaded to take either a string value for the body or a jQuery promise that is resolved with HTML and Javascript most commonly from a Templates.render call.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | object | The body string or jQuery promise which resolves to the body. |
Fires:
setCourseFavouriteState(courseId, status) → {Promise}
- Description:
Set the courses favourite status and push to repository
- Source:
Parameters:
Name | Type | Description |
---|---|---|
courseId |
Number | Course id to favourite. |
status |
boolean | new favourite status. |
Returns:
Repository promise.
- Type
- Promise
setCourseHiddenState(courseId, status) → {Promise}
- Description:
Set the courses hidden status and push to repository
- Source:
Parameters:
Name | Type | Description |
---|---|---|
courseId |
Number | Course id to favourite. |
status |
Boolean | new hidden status. |
Returns:
Repository promise.
- Type
- Promise
setDraggable(value)
- Description:
Enable or disable the draggable property.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
bool | the new draggable value |
setElementLocked(target, locked)
- Description:
Lock/unlock an element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
Element | the event target |
locked |
boolean | the new locked value |
setFooter(value)
- Description:
Set the modal footer element. The footer element is made visible, if it isn't already.
This method is overloaded to take either a string value for the body or a jQuery promise that is resolved with HTML and Javascript most commonly from a Templates.render call.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | object | The footer string or jQuery promise |
setInitialState(initialState)
- Description:
Loads the initial state.
Note this method will trigger a state changed event with "state:loaded" actionname.
The state mode will be set to read only when the initial state is loaded.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
initialState |
object |
setInitialState(stateData)
- Description:
Set the initial state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateData |
object | the initial state data. |
setLarge()
- Description:
Mark the modal as a large modal.
- Source:
setLimit(root) → {function}
- Description:
Return the callback to be passed to the subscribe event
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
object | The root element for the courses view |
Returns:
Partially applied function that'll execute when passed a limit
- Type
- function
setLoadedAllContent(val)
- Description:
Set the state of the loaded all content property for the current state of the popover.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
val |
bool | True if all content is loaded, false otherwise |
setLogger(logger)
- Description:
Set the logger class instance.
Reactive instances can provide alternative loggers to provide advanced logging.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
logger |
Logger |
setMutations(manager)
- Description:
Replace the current mutations with a new object.
This method is designed to override the full mutations class, for example by extending the original one. To add some individual mutations, use addMutations instead.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
object | the new mutations intance |
setOrder(columns) → {Promise}
- Description:
Call external function set_order - inserts the updated column in the config_plugins table.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
columns |
String | String that contains column order. |
Returns:
- Type
- Promise
setPageItem(stateManager, type, id, isStatic)
- Description:
Set the page current item.
Only one element of the course state can be the page item at a time.
There are several actions that can alter the page current item. For example, when the user is in an activity page, the page item is always the activity one. However, in a course page, when the user scrolls to an element, this element get the page item.
If the page item is static means that it is not meant to change. This is important because static page items has some special logic. For example, if a cm is the static page item and it is inside a collapsed section, the course index will expand the section to make it visible.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
type |
String | undefined | the element type (section or cm). Undefined will remove the current page item. |
id |
Number | undefined | the element id |
isStatic |
boolean | undefined | if the page item is static |
setReadOnly(readonly)
- Description:
Locks or unlocks the state to prevent illegal updates.
Mutations use this method to modify the state. Once the state is updated, they must block again the state.
All changes done while the state is writable will be registered using registerStateAction. When the state is set again to read only the method will trigger _publishEvents to communicate changes to all watchers.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
readonly |
bool | if the state is in read only mode enabled |
setScrollable(value)
- Description:
Set this modal to be scrollable or not.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
bool | Whether the modal is scrollable or not |
setSmall()
- Description:
Mark the modal as a small modal.
- Source:
setStorageValue(key, value) → {boolean}
- Description:
Stores a value into the course editor static storage if available
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
String | the key to store |
value |
* | the value to store (must be compatible with JSON,stringify) |
Returns:
true if the value is stored
- Type
- boolean
setTitle(value)
- Description:
Set the modal title element.
This method is overloaded to take either a string value for the title or a jQuery promise that is resolved with HTML most commonly from a Str.get_string call.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | object | The title string or jQuery promise which resolves to the title. |
setupSortableLists(listRoot)
- Description:
Sets up sortable list in the column sort order page.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
listRoot |
Element |
show() → {Promise}
- Description:
Display this modal. The modal will be attached to the DOM if it hasn't already been.
- Source:
Returns:
- Type
- Promise
showCourse(root, courseId)
- Description:
Show course
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container |
courseId |
Number | Course id number |
showDropZone()
- Description:
Display the component dropzone.
- Source:
showDropZone(dropdata)
- Description:
Display the component dropzone.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the accepted drop data |
showDropZone(dropdata)
- Description:
Display the component dropzone.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the accepted drop data |
showFavouriteIcon(root, courseId)
- Description:
Show the favourite icon.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
Object | The course overview container. |
courseId |
Number | Course id number. |
showFooter()
- Description:
Show the footer element.
- Source:
standardFunctionalityCurry() → {function}
- Description:
The default functionality of fetching paginated courses without special handling.
- Source:
Returns:
- Type
- function
stateReady()
- Description:
Initial state ready method.
This method will add all the necessary event listeners to the component depending on the parent methods.
- Add drop events to the element if the parent component has validateDropData method.
- Configure the elements draggable if the parent component has getDraggableData method.
- Source:
stateReady()
- Description:
Reactive module will call this method when the state is ready.
Component can override this method to update/load the component HTML or to bind listeners to HTML entities.
- Source:
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the state data |
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the initial state |
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the initial state |
(async) stateReady(state)
- Description:
Initial state ready method.
This stateReady to be async because it loads the real courseindex.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
object | the initial state |
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the state data |
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the course state. |
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the initial state |
stateReady()
- Description:
Initial state ready method.
- Source:
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the state data. |
stateReady(state)
- Description:
Initial state ready method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | the initial state |
stateReady()
- Description:
Initial state ready method.
- Source:
stop()
- Description:
Stop the timer, if it is running.
- Source:
submitTagCreateUpdateForm(questionId, contextId, formdata) → {promise}
- Description:
Submit the form data for the question tags form.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
questionId |
Number | |
contextId |
Number | |
formdata |
string | The URL encoded values from the form |
Returns:
- Type
- promise
toggleGroup(item)
- Description:
Toggle a group item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item |
JQuery | the jQuery object |
unlockAll(stateManager)
- Description:
Unlock all course elements.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stateManager |
StateManager | the current state manager |
unregister()
- Description:
Unregister the component from the reactive module.
This method will disable the component logic, event listeners and watchers but it won't remove any HTML created by the component. However, it will trigger the destroy hook to allow the component to clean parts of the interface.
- Source:
unregisterComponent(component) → {object}
- Description:
Unregister a component and its watchers.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
component |
object | the object instance to unregister |
Returns:
the deleted component
- Type
- object
update()
- Description:
Function to update the clock with the current time left.
- Source:
updateButtonAriaLabel()
- Description:
Set the correct aria label on the menu toggle button to be read out by screen readers. The message will indicate the state of the unread notifications.
- Source:
updatePreferences(filter, value)
- Description:
Update the user preference for the block.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filter |
String | The type of filter: display/sort/grouping. |
value |
String | The current preferred value. |
validateDropData(dropdata) → {boolean}
- Description:
Validate if the drop data can be dropped over the component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the exported drop data. |
Returns:
- Type
- boolean
validateDropData(dropdata) → {boolean}
- Description:
Validate if the drop data can be dropped over the component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the exported drop data. |
Returns:
- Type
- boolean
validateDropData(dropdata) → {boolean}
- Description:
Validate if the drop data can be dropped over the component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the exported drop data. |
Returns:
- Type
- boolean
validateDropData(dropdata) → {boolean}
- Description:
Validate if the drop data can be dropped over the component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dropdata |
Object | the exported drop data. |
Returns:
- Type
- boolean
Type Definitions
LoggerEntry
- Description:
Logger entry structure.
- Source:
Properties:
Name | Type | Description |
---|---|---|
feedbackMessage |
string | Feedback message. |
Logger entry structure.
Type:
- object
LoggerEntry
- Description:
Logger entry structure.
- Source:
Properties:
Name | Type | Description |
---|---|---|
feedbackMessage |
string | Feedback message. |
Logger entry structure.
Type:
- object
ProblemDetail
Type:
- object
ProblemNode
Type:
- object
description
- Description:
The component descriptor data structure.
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventName |
string | the custom event name used for state changed events |
|
eventDispatch |
function | the state update event dispatch function |
|
target |
Element |
<optional> |
the target of the event dispatch. If not passed a fake element will be created |
mutations |
Object |
<optional> |
an object with state mutations functions |
state |
Object |
<optional> |
an object to initialize the state. |
The component descriptor data structure.
Type:
- object
descriptor
- Description:
The component descriptor data structure.
This structure is used by any component and init method to define the way the component will interact with the interface and whith reactive instance operates. The logic behind this object is to avoid unnecessary dependancies between the final interface and the state logic.
Any component interacts with a single main DOM element (description.element) but it can use internal selector to select elements within this main element (descriptor.selectors). By default each component will provide it's own default selectors, but those can be overridden by the "descriptor.selectors" property in case the mustache wants to reuse the same component logic but with a different interface.
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
reactive |
Reactive | an optional reactive module to register in |
|
element |
DOMElement | all components needs an element to anchor events |
|
selectors |
object |
<optional> |
an optional object to override query selectors |
The component descriptor data structure.
This structure is used by any component and init method to define the way the component will interact with the interface and whith reactive instance operates. The logic behind this object is to avoid unnecessary dependancies between the final interface and the state logic.
Any component interacts with a single main DOM element (description.element) but it can use internal selector to select elements within this main element (descriptor.selectors). By default each component will provide it's own default selectors, but those can be overridden by the "descriptor.selectors" property in case the mustache wants to reuse the same component logic but with a different interface.
Type:
- object