canvas-lms/doc/api/link_selection_tools.md

90 lines
4.4 KiB
Markdown
Raw Normal View History

External Tool Link Selector
============================
An extension to standard LTI, external tools can be configured
to allow selecting custom links to be
added to modules or used for external tool assignments. When a tool is
configured, if the user goes to add a link to a module or select a link
for an external tool assignment, they'll see the tool with a special
"find" icon on it. Clicking this tool will pop up a dialog and load
the external tool inline. The tool should direct users to select or
build a resource. The tool will then redirect the user to the LTI
success URL with some additional parameters. Canvas will use these
parameters to create custom URL that will be used as the link.
URLs returned in this manner will not circumvent the standard LTI
URL/domain checking procedure, which is important to remember when
returning URLs to add to the course. In general, it is best to make
the these type of tools as domain-matching tool and only return URLs
whose domain matches the tool's specified domain.
When tools are loaded as link selectors, Canvas sends an additional
parameter to notify the tool of the directive, `ext_content_return_types=select_link`.
When a tool receives this directive, it means Canvas is expecting the
tool to redirect the user to the LTI success URL with some specific
additional parameters. These additional parameters tell Canvas what
URL to select, as listed below. Remember to URL encode parameter
values such as url.
## Possible Redirect Parameters
### to embed an lti link:
<table class="tool">
<tr>
turning in homework from LTI tools adds a new LTI extension, "content", that defines the interaction for sending content from a tool provider to the tool consumer. This extension will replace the "embed_content" and '"select_link" selection_directives, as well as adding allowing am external tool to submit content for a homework submission. also starts sending intended_use, return_types, return_url and file_extensions as part of the LTI launch with the new extension. test plan: - make sure the "more" tab only shows up when there are valid tools - install at least one valid tool (make a homework_submission tool by taking the xml for a resource_selection tool and replace "resource_selection" with "homework_submission") - click "more" - make sure you can't submit the assignment when no resource has been selected - set an assignment that only allows file uploads - try selecting a url from the tool - make sure it errors out - set an assignment that only allows file uploads - limit the file types - try selecting a file with a non-supported file extension - make sure it errors out - set an assignment that only allows file uploads - try selecting an invalid file from the tool - try submitting the homework - make sure it errors out gracefully - set an assignment that only allows file uploads - try selecting a file from the tool - make sure the submission works correctly - set an assignment that only allows urls - try selecting a file from the tool - make sure it errors out - set an assignment that only allows urls - try selecting a url from the tool - make sure the submission works correctly Change-Id: I8df682bc73087681159110ab02f77f0e5a2b3911 Reviewed-on: https://gerrit.instructure.com/13419 Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Adam Phillipps <adam@instructure.com> Product-Review: Brad Humphrey <brad@instructure.com> Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2013-01-30 02:52:36 +08:00
<td>return_type=lti_launch_url</td>
<td></td>
<td>(required)</td>
</tr><tr>
<td>url=&lt;url&gt;</td>
<td>this is URL that will be used to load the external tool</td>
<td>(required)</td>
</tr><tr>
<td>title=&lt;text&gt;</td>
<td>this is used as the 'title' attribute of the inserted external tool link</td>
<td>(optional)</td>
</tr><tr>
<td>text=&lt;text&gt;</td>
<td>this is the suggested text for the inserted link. If the user has already selected some content before opening this dialog, the link will wrap that content and this value will be ignored.</td>
<td>(optional, defaults to 'link')</td>
</tr>
</table>
#### examples:
If the `launch_presentation_return_url` were
<code>http://www.example.com/done</code>, possible return URLs could include:
turning in homework from LTI tools adds a new LTI extension, "content", that defines the interaction for sending content from a tool provider to the tool consumer. This extension will replace the "embed_content" and '"select_link" selection_directives, as well as adding allowing am external tool to submit content for a homework submission. also starts sending intended_use, return_types, return_url and file_extensions as part of the LTI launch with the new extension. test plan: - make sure the "more" tab only shows up when there are valid tools - install at least one valid tool (make a homework_submission tool by taking the xml for a resource_selection tool and replace "resource_selection" with "homework_submission") - click "more" - make sure you can't submit the assignment when no resource has been selected - set an assignment that only allows file uploads - try selecting a url from the tool - make sure it errors out - set an assignment that only allows file uploads - limit the file types - try selecting a file with a non-supported file extension - make sure it errors out - set an assignment that only allows file uploads - try selecting an invalid file from the tool - try submitting the homework - make sure it errors out gracefully - set an assignment that only allows file uploads - try selecting a file from the tool - make sure the submission works correctly - set an assignment that only allows urls - try selecting a file from the tool - make sure it errors out - set an assignment that only allows urls - try selecting a url from the tool - make sure the submission works correctly Change-Id: I8df682bc73087681159110ab02f77f0e5a2b3911 Reviewed-on: https://gerrit.instructure.com/13419 Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Adam Phillipps <adam@instructure.com> Product-Review: Brad Humphrey <brad@instructure.com> Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2013-01-30 02:52:36 +08:00
- http://www.example.com/done?return_type=lti_launch_url&url=https%3A%2F%2Fothersite.com%2Flti_link
- http://www.example.com/done?return_type=lti_launch_url&url=https%3A%2F%2Fothersite.com%2Flti_link&text=other+site+link
- http://www.example.com/done?return_type=lti_launch_url&url=https%3A%2F%2Fothersite.com%2Flti_link&title=link
## Settings
All of these settings are contained under "resource_selection"
- url: &lt;url&gt; (optional)
This is the URL that will be POSTed to when users click the button in any rich editor. It can be the same as the tool's URL, or something different. Domain and URL matching are not enforced for editor button links. In order to prevent security warnings for users, it is recommended that this URL be over SSL (https).
This is required if a url is not set on the main tool configuration.
- icon_url: &lt;url&gt; (optional)
This is the URL of the icon to be shown.
- text: &lt;text&gt; (optional)
This is the default text that will be shown if a user hovers over the editor button. This can be overridden by language-specific settings if desired by using the labels setting. This text will also be shown next to the icon if there are too many buttons and the tool is available in the "more tools" dropdown.
This is required if a text value is not set on the main tool configuration.
- labels: &lt;set of locale-label pairs&gt; (optional)
This can be used to specify different label names for different locales. For example, if an institution supports both English and Spanish interfaces, the text in the link should change depending on the language being displayed. This option lets you support multiple languages for a single tool.
- selection_width: &lt;number&gt; (required)
This value is the explicit width of the dialog that is loaded when a user clicks the icon in the rich editor.
- selection_height: &lt;number&gt; (required)
This value is the explicit height of the dialog that is loaded when a user clicks the icon in the rich editor.
- enabled: &lt;boolean&gt; (required)
Whether to enable this selection feature.