-
Notifications
You must be signed in to change notification settings - Fork 16
Renderer API
K. Andrew Parker edited this page Sep 5, 2021
·
1 revision
Can be interfaced through /render-api
Key | Type | Default Value | Required | Description | Notes |
---|---|---|---|---|---|
problemSourceURL | string | null | true if sourceFilePath and problemSource are null |
The URL from which to fetch the problem source code | Takes precedence over problemSource and sourceFilePath . A request to this URL is expected to return valid pg source code in base64 encoding. |
problemSource | string (base64 encoded) | null | true if problemSourceURL and sourceFilePath are null |
The source code of a problem to be rendered | Takes precedence over sourceFilePath . |
sourceFilePath | string | null | true if problemSource and problemSourceURL are null |
The path to the file that contains the problem source code | Can begin with Library/ or Contrib/, in which case the renderer will automatically adjust the path relative to the webwork-open-problem-library root. Path may also begin with private/ for local, non-OPL content. |
problemSeed | number | NA | true | The seed to determine the randomization of a problem | |
psvn | number | 123 | false | used for consistent randomization between problems | |
formURL | string | /render-api | false | the URL for form submission | |
baseURL | string | / | false | the URL for relative paths | |
format | string | '' | false | Determine how the response is formatted ('html' or 'json') | |
outputFormat | string (enum) | static | false | Determines how the problem should render, see below descriptions below | |
language | string | en | false | Language to render the problem in (if supported) | |
showHints | number (boolean) | 1 | false | Whether or not to show hints (restrictions apply) | Irrelevant if permissionLevel >= 10 , in which case showHints is regarded as automatically 'true' |
showSolutions | number (boolean) | 0 | false | Whether or not to show the solutions (restrictions apply) | Irrelevant if permissionLevel >= 10 , in which case showSolutions is regarded as automatically 'true' |
permissionLevel | number | 0 | false | Affects the rendering of hints and solutions. Also controls display of scaffold problems (possibly more) | See the levels we use below |
problemNumber | number | 1 | false | We don't use this | |
numCorrect | number | 0 | false | The number of correct attempts on a problem | |
numIncorrect | number | 1000 | false | the number of incorrect attempts on this problem | Relevant for triggering hints that are not immediately available |
processAnswers | number (boolean) | 1 | false | Determines whether or not answer json is populated, and whether or not problem_result and problem_state are non-empty | |
answersSubmitted | number (boolean) | ? | false? | Determines whether to process form-data associated to the available input fields | |
showSummary | number (boolean) | ? | false? | Determines whether or not to show the summary result of processing the form-data associated with answersSubmitted above |
|
showComments | number (boolean) | 0 | false | Renders author comment field at the end of the problem | |
includeTags | number (boolean) | 0 | false | Includes problem tags in the returned JSON | Only relevant when requesting format: 'json'
|
Key | Description |
---|---|
static | zero buttons, locked form fields (read-only) |
nosubmit | zero buttons, editable (for exams, save problem state and submit all together) |
single | one submit button (intended for graded content) |
classic | preview + submit buttons |
simple | preview + submit + show answers buttons |
practice | check answers + show answers buttons |
Key | Value |
---|---|
student | 0 |
prof | 10 |
admin | 20 |
- If
permissionLevel >= 10
, then hints and solutions will be rendered - no exceptions. - If
permissionLevel < 10
, then:- solutions (if they are provided in the pg source code) will be rendered if and only if
showSolutions
is true. - hints (if they are provided in the pg source code) will be rendered if and only if:
-
showHints
is true, and -
numCorrect + numIncorrect > n
wheren
is set by the pg sourcce code being rendered
-
- solutions (if they are provided in the pg source code) will be rendered if and only if