13.7. Setup in Moodle¶
You can set up Mahara in two different ways for use in Moodle:
General setup on the site level to make it easier for teachers as they won’t require the technical details
Manual setup on the course level
All screenshots were made with Moodle 3.5.
13.7.1. Preconfigure LTI for all courses to use¶
Go to Site administration → Plugins → Activity modules → External tool → Manage tools
Tool name: Give a name that your teachers will recognize.
Tool URL: Provide the launch URL. It consists of the base URL of your Mahara site and the following added to the end of it:
/webservice/rest/server.php?wsfunction=module_lti_launch
Tool description: This field is optional. Providing a description will help your teachers to identify the tool.
Consumer key: Paste the consumer key from Mahara for the LTI connection that you set up earlier.
Shared secret: Paste the consumer secret from Mahara for the LTI connection that you set up earlier.
Default launch container: Choose ‘New window’ or ‘Existing window’. Do not choose to embed Mahara. That will not work as you are not allowed to embed Mahara into other websites. Furthermore, it will reduce the space that you have available to work in Mahara.
Secure icon URL: If you don’t want to display the regular Moodle icon for external tools, you can provide a link to your favorite icon. It is recommended that you provide one that sits on your Mahara site and has the dimensions needed by Moodle for best results.
Click the Save changes button to accept the configuration or the Cancel button if you want to abort setting up the tool.
Note
You do not have to make changes to any of the other settings on the page.
13.7.2. Use a preconfigured Mahara site in a course¶
If Mahara was already set up as external tool on the site level in Moodle, a teacher only needs to select it when adding the ‘External tool’ activity in Moodle.
Activity name: Give your activity a title.
Preconfigured tool: Select your Mahara instance from the drop-down menu. It may not be called ‘Mahara’. Certain fields are not editable when you choose this option as they are determined by the existing site-wide configuration.
Note
Click the Show more… link if you want to make some additional changes.
Privacy: Tick the option ‘Accept grades from the tool’ if you want to be able to use the activity for the submission of a portfolio.
Click the Save and return to course button to be taken back to your course page, click the Save and display button to launch into Mahara immediately, or click the Cancel button to abort adding Mahara to your course as activity.
13.7.3. Configure Mahara in a course activity manually¶
You can set up the connection to Mahara also on the activity level in Moodle without having preconfigured it first on the site level. This can be beneficial if your course is the only one connecting to a specific Mahara site that other courses should not have access to.
If everyone should have access to the same Mahara site, setting up a preconfiguration on the site level is advised though.
Activity name: Give your activity a title.
Activity description: Provide a description of your activity. This field is optional.
Preconfigured tool: Select ‘Automatic, based on tool URL’.
Secure tool URL: Provide the launch URL. It consists of the base URL of your Mahara site and the following added to the end of it:
/webservice/rest/server.php?wsfunction=module_lti_launch
Note
You could use the ‘Tool URL’ field, but since web services in Mahara only work over SSL (unless you have a developer instance), choosing the ‘Secure tool URL’ is recommended.
Launch container: Choose ‘New window’ or ‘Existing window’. Do not choose to embed Mahara. That will not work as you are not allowed to embed Mahara into other websites. Furthermore, it will reduce the space that you have available to work in Mahara.
Consumer key: Paste the consumer key from Mahara for the LTI connection that you set up earlier.
Shared secret: Paste the consumer secret from Mahara for the LTI connection that you set up earlier.
Secure icon URL: If you don’t want to display the regular Moodle icon for external tools, you can provide a link to your favorite icon. It is recommended that you provide one that sits on your Mahara site and has the dimensions needed by Moodle for best results.
Privacy: Tick the option ‘Accept grades from the tool’ if you want to be able to use the activity for the submission of a portfolio.
Click the Save and return to course button to be taken back to your course page, click the Save and display button to launch into Mahara immediately, or click the Cancel button to abort adding Mahara to your course as activity.
Note
You do not have to make changes to any of the other settings on the page.
13.7.4. Set up an assignment in Moodle¶
Select to add the External Tool activity in Moodle.
During the setup ensure that you tick the checkbox next to ‘Accept grades from the tool’ under ‘Privacy’. If you don’t tick this checkbox, you can only authenticate to Mahara but not select a portfolio for submission.
Click the activity name to finalize the assessment settings. Learners are not able to use the activity until these settings have been saved.
13.7.5. Similarity check with Ouriginal¶
It is possible to submit a portfolio via the assignment submission functionality in Moodle and send it to Ouriginal for similarity checks. This requires that both the Mahara assignment submission plugin (web services) and the Ouriginal Moodle plugin are installed. The latter requires a number of changes to access the web services in Mahara. These changes have not yet been added to the public Moodle plugin code.
On the Mahara side, the available functionalities are the HTML lite and the PDF lite export options. Since similarity checking software can only process certain file types, the ‘lite’ export allows to restrict the export to just those file types. Refer to htdocs/export/htmllite/lib.php
or htdocs/export/pdflite/lib.php
for the file types that will be included in the export via the variable $validfiles
.
The PDF lite export is a proof of concept and an experimental feature at this stage.
Make sure that the normal HTML export is enabled, as it is a prerequisite for HTML lite to work. If you use the PDF lite option, enable the regular PDF export option.
Enable the plugin in Administration menu → Extensions → Plugin administration → HTML Lite by clicking the Show button.
Enable incoming web service requests and select the protocol that you want to use at Administration menu → Web services → Configuration.
Set up a web service on the same page:
Create a new service group and assign the function
mahara_submission_generate_view_for_plagiarism_test
to the group and make sure that ‘Service’ and ‘User token access’ are enabled.Create a new service access token and select the newly created service group.
You can now access this service from an external source, for example to access it from a terminal via cURL:
curl --location --request POST 'http://example.com/webservice/rest/server.php' \
-F 'views[0][viewid]="8"' \
-F 'views[0][iscollection]=0' \
-F 'views[0][submittedhost]="fakeexternalsite"' \
-F 'views[0][exporttype]="htmllite"' \
-F 'wstoken="...your generated webservice token..."' \
-F 'wsfunction="mahara_submission_generate_view_for_plagiarism_test"'
Note
To use the PDF lite option in the cURL command, change views[0][exporttype]="htmllite"
to views[0][exporttype]="pdflite"
.
13.7.6. Moodle LTI connection troubleshooting¶
Some people experienced issues connecting Moodle to Mahara via LTI for assignment submission. One thing to check is that hosts are not blocked by Moodle.
Make sure you have the Mahara assignment submission plugin installed in your Moodle.
In the Moodle code in file
/mod/assign/submission/maharaws/classes/mahara_oauth.php
, comment out the following code.if ($this->http->info['http_code'] != 200) { throw new \moodle_exception('webservice call was not successful'); }
Add the following three lines below your commented out code:
echo $url; echo $method; echo $params;
Set Debug messages in Moodle in Site administration → Development to ‘DEVELOPER: extra Moodle debug messages for developers’.
In Site administration → General → HTTP security remove all hosts from the ‘cURL blocked hosts list’.
Add one host at a time back to the ‘cURL blocked hosts list’, create a new assignment activity that connects to Mahara, and check if you get an error message.
If you get a message like
mahara.xxx.xxx/webservice/rest URL blocked
then you have the host that is blocked. Remove it from the ‘cURL blocked hosts list’.Give it a go in the activity again.
Make sure you add or update the host on which your Mahara site runs in your
/etc/hosts file
.Note
If you don’t make sure that you have the correct host IP in your
hosts
file, you may see the following error message: “Error when connecting to Mahara web services Check that URL and OAuth credentials are correct and that there is a valid SSL certificate if HTTPS is used. Also check that the correct functions are assigned to the OAuth access.”