Once CodeOcean and Edly are setup, there are certain configuration steps to do, to provide an own course on this platform. The following steps show common steps used by content creators. 

== Creating a course in openEdx ==

A new course can be created on the edit page: `https://hostname/course-authoring`. Course creation needs a naming scheme for course, organization, course number and course run (for example "Python Introduction", "HTWK", "C123.1", "WiSe24").

Before it is possible to link external LTI tools, this has to be enabled for this specific course. The openEdx platform supports LTI 1.1 up to and including LTI 1.3, extended by deep linking, grading and role provisioning services. To do this, the "lti_consumer" entry has to be added to "Advanced Module List" in the Course Settings/Advanced Settings.

[https://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/exercises_tools/lti_component.html]

A single course consists out of a strict hierarchy of section, subsection and units. There is a "New Section" button in the top right of the course edit page. To create subsections and units, the structure level above must first be expanded using the caret symbol on the left. In the edit page for a single unit, an external grader can be linked using an "Advanced" module and the "LTI Consumer" entry.

== Creating a CodeOcean consumer for edX ==

Go to Administation -> Integrations -> Consumer in CodeOcean and add a new entry to get individual secret and key for the LTI integration. 

These keys are required for OAuth 1 authentication, which is used by LTI 1.1. The new OAuth 2 standard is not yet supported by CodeOcean, but openEdx supports both standards. In the advanced course settings of openEdx, **go to "Lti passports" and add a new passport with key and secret in the following format: `unique_id: key:secret`** as an entry in a JSON string list. An example configuration looks like this:

[source,json]
----
[
 . "htwkcodeocean:bbebc02185e8e91dedaef54246779516:fc819bdfa4f216ffa525efa87af5579a"
]
----

The id can be chosen freely, but it has to be unique inside the edX platform.

== Linking a CodeOcean exercise == 

After adding the Lti passport with the required secrets of the Codeocean LTI provider, new exercises can be linked. To get the link, open up an exercise in CodeOcean (Administrator -> Exercises -> Exercises) by clicking on it's title. The LTI embedding parameters are shown like this: `locale=en&token=1234abcd`. We are only interested in the last part, the token.

The newly added "LTI Consumer" module has to be configured. In the edit page of the unit, the following settings must be applied: 

NOTE:the "LTI Version" needs to be set to "LTI 1.1/1.2 (Default)" and the "LTI ID" has to match the unique_id of the passport, in the aforementioned example "htwkcodeocean". 

[cols="1,1,2",options="header"]
|===
| Field | Value | Comment

| LTI Version 
| LTI 1.1/1.2 (Default) 
| LTI 1.3 is not yet supported by CodeOcean

| LTI ID 
| `htwkcodeocean` 
| Has to be identical with the secrets in the LTI passport in advanced course sections

| LTI URL 
| `https://codeocean.htwk-leipzig.de/lti/launch`
| Base URL of the CodeOcean platform, with `/lti/launch` as the endpoint

| Individuelle Parameter 
| `["token=1234abcd"]`
| This redirects to the correct exercise

| LTI Startziel
| Inline (Default)
| The exercise is shown directly in the course

| Schaltflächentext
| `To the exercise`
| Not necessary when inline exercise is chosen

| Erzielte Punkte
| True
| Necessary to get grading information back from CodeOcean

| Weight
| 1.0
| It says default would be 1.0, don't be fooled by this hint. If nothing is entered, the exercise will not be graded.

|===

The rest can be left default. All other necessary LTI parameters are automatically added by the openEdx platform, i. e. to identify the user and the course.

In individual parameters there are a lot more optional parameters, for example to hide parts of the CodeOcean interface. Those can be found in the CodeOcean documentation under `docs/lti_parameters.md`.

.For a clean look, the following options can be added:
[source, json]
----
[
    "token=1234abcd", 
    "embed_options_hide_navbar=true"
    "embed_options_hide_sidebar=true"
]
----

This hides all unnecessary navigational components, additionally the comment section can be hidden with `disable_rfc=true`.
