Module:Mooc/doc

This module is part of the MOOC interface. This is the central MOOC script to render a MOOC item at a wiki page.

Invokable functions
The following functions are static and therefore can be invoked by wiki pages.

overview
Renders the overview at the invoking page. The overview page lists all lessons the MOOC consists of.

Parameters: Returns: string representation of the overview page rendered
 * 1) Frame: frame - WikiMedia frame object holding information about the invoking page

render
Renders a MOOC item at the invoking page. The title of the invoking page is used to identify the item that should be rendered. Thus you can not invoke the module on non-MOOC pages: The page title must be a sub page of the MOOC page.

Parameters: Returns:
 * 1) Frame: frame - WikiMedia frame object holding information about the invoking page
 * string representation of the item rendered
 * throws an error if the invoking page is not a child of the MOOC base
 * throws an error if the invoking page does not represent any MOOC item (see explanation above)

Instance functions
The following functions are accessible by other Lua modules if they have access to a MOOC instance. Therefore they can not be invoked by wiki pages directly.

init
Initializes the MOOC module. This method can be overridden and is supposed to register type handlers for all item types known. If the method is overridden you should always call the super method.

Parameters:
 * 1) String: baseUrl - page title of the MOOC base (the page where the MOOC is located)

addTypeHandler
Registers a type handler for a MOOC item type.

Parameters:
 * 1) Mooc/TypeHandler: typeHandler - instance of the type handler to be registered

getBaseUrl
Determines the page title of the MOOC base. This default implementation considers the root page of the invoking wiki page as MOOC base.

Returns: page title of the MOOC base

getIndexUrl
Determines the page title of the default MOOC index. The default MOOC index is located `/MoocIndex` relative to the MOOC base.

Returns: page title of the MOOC index

getCurrentPath
Gets the MOOC item path of the invoking wiki page. The MOOC item path is always relative to the MOOC base.

Returns:
 * MOOC item path of the invoking wiki page
 * nil if the invoking page is not a child of the MOOC base

getIndex
Retrieves the plain wiki text content of the MOOC index page.

Returns:
 * wiki text of the MOOC index page
 * throws an error if the content retrieval failed

renderOverview
Renders the overview at the invoking page. The overview page lists all lessons the MOOC consists of.

Parameters: Returns: string representation of the overview page rendered
 * 1) Frame: frame - WikiMedia frame object holding information about the invoking page

renderItem
Renders a MOOC item at the invoking page. At the moment a page can only render the item it represents. (item with the path equal to the page title relative to the MOOC base)

Parameters: Returns:
 * 1) Frame: frame - WikiMedia frame object holding information about the invoking page
 * string representation of the item rendered
 * throws an error if the invoking page is not a child of the MOOC base
 * throws an error if the invoking page does not represent any MOOC item (see explanation above)

Local functions
The following functions are local and therefore can not be invoked by wiki pages or other Lua modules.

getHandler
Gets the type handler for a certain MOOC item type. The handler must be registered before e.g. by using `addTypeHandler`.

Parameters: Returns:
 * 1) String: typeIdentifier - identifier of the MOOC item type the handler is needed for
 * template handler for the MOOC item type specified
 * throws an error if no registered type handler handles the item type specified