Members
(static) createPart
Create a new question part.
- Source:
- See:
(static) createPartFromJSON
Create a question part based on an XML definition.
- Source:
Fires:
- Numbas.Part#event:finaliseLoad
(static) createPartFromXML
Create a question part based on an XML definition.
- Source:
Fires:
- Numbas.Part#event:finaliseLoad
(static) createQuestionFromJSON
Create a Numbas.Question
object from a JSON object.
(static) createQuestionFromXML
Create a Numbas.Question
object from an XML definition.
(static) custom_part_types :object
Definitions of custom part types.
Type:
- Source:
(static) extensions
Extensions should add objects to this so they can be accessed
(static) loadScript
Ask to load a javascript file. Unless noreq
is set, the file's code must be wrapped in a call to Numbas.queueScript with its filename as the first parameter.
(static) locale :object
Resources to do with localisation: preferred_locale
is the code of the locale to use, and resources
is a dictionary of localisations.
Type:
(static) marking_scripts :Object.<Numbas.marking.MarkingScript>
Marking scripts for the built-in part types.
Type:
(static) partConstructors
Associate part type names with their object constructors.
These constructors are called by Numbas.createPart
- they should be finalised constructors with all the generic part methods implemented.
Most often, you do this by extending Numbas.parts.Part
.
- Source:
(static) raw_marking_scripts :Object.<string>
Definitions of marking scripts for the built-in part types.
Type:
(static) rawxml :Object.<string>
Raw XML of the exam definition.
Type:
- Source:
(static) store
The active storage object (Numbas.storage
) to be used by the exam
Methods
(static) activateExtension(name)
Run the extension with the given name. The extension must have already been registered with Numbas.addExtension
.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
(static) addExtension(name, deps, callback)
A wrapper round Numbas.queueScript
to register extensions easily.
The extension is not run immediately - call Numbas.activateExtension
to run the extension.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Unique name of the extension. |
deps |
Array.<string> | A list of other scripts which need to be run before this one can be run. |
callback |
function | Code to set up the extension. It's given the object |
(static) checkAllScriptsLoaded() → {Array.<object>}
Check all required scripts have executed - the theme should call this once the document has loaded.
Returns:
Type | Description |
---|---|
Array.<object> |
A list of files which have not loaded. |
(static) debug(msg, noStackopt, error)
A function for displaying debug info in the console. It will try to give a reference back to the line that called it, if it can.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
msg |
string | Text to display. |
||
noStack |
boolean |
<optional> |
false | Don't show the stack trace. |
error |
Error |
(static) getStandaloneFileURL(extension, path) → {string}
Get the URL of a standalone file from an extension.
Parameters:
Name | Type | Description |
---|---|---|
extension |
string | The name of the extension. |
path |
string | The path to the script, relative to the extension's |
Returns:
Type | Description |
---|---|
string |
(static) init()
Initialise the exam:
- Connect to the LMS, which might have saved student answers
- Load the exam XML and the XSL templates
- create and initialise the exam object
- display the frontpage
This function is called when all the other scripts have been loaded and executed. It uses the scheduling system to make sure the browser isn't locked up when the exam is being initialised.
Fires:
- Numbas.signals#event:exam_ready
- Numbas.signals#event:Numbas_initialised
(static) loadStandaloneScript(extension, path)
Load a standalone script from an extension. Inserts a