Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
help
New Member

LTI placed in assignment submission box

Jump to solution

Hi

Is there any guide/documentation to build an LTI tool that will show in a specific place in Canvas - I am thinking about another "tab" in the assignment submission like the dropbox LTI (see attached image) so that the file attached this way will be connected with the assignment submissiondropbox LTI

Labels (1)
1 Solution

Accepted Solutions
tnijssen
New Member

To find out, I started by looking at the HTML in my browser. I found the following:

<form id="submit_online_upload_form" class="submit_assignment_form ui-tabs-panel ui-widget-content ui-corner-bottom" enctype="multipart/form-data" action="/courses/12719/assignments/42589/submissions" accept-charset="UTF-8" method="post" aria-labelledby="ui-id-3" role="tabpanel" aria-expanded="true" aria-hidden="false">

That "id" attribute looks interesting. Let's look it up in the Canvas source code, and we find this file. Clearly, the Google ones are special, but here we see what we're looking for:

<% (@external_tools[0,3] || []).each do |external_tool| %>
        <li><a href="#submit_from_external_tool_form_<%= external_tool.id %>"
          class="external-tool"
          data-id="<%= external_tool.id %>"
          data-name="<%= external_tool.name %>">
<%= external_tool.label_for(:homework_submission, I18n.locale) %></a></li>
      <% end %>

So we're looking for the controller of this template, which should define "external_tools".

I went up to the controllers directory, and guessed that we're dealing with the assignments_controller.

Indeed, we find the following useful snippet:

 if @assignment.submission_types.include?("online_upload") || @assignment.submission_types.include?("online_url")
        @external_tools = ContextExternalTool.all_tools_for(@context, :user => @current_user, :placements => :homework_submission)

Aha! We're looking for those tools that have "homework_submission" as one of the placements.

One quick Google search and we find this page, which links to the Canvas documentation for making an LTI homework submission.

Hope that helps!

View solution in original post

6 Replies
stuart_ryan
Community Coach
Community Coach

Hi  @help ,

Apologies your question has gone unanswered for a while, it really seems to have stumped the community. Have you had any success tinkering with this yourself or to get anything working?

Look forward to hearing from you!

Stuart

Thank for you reply Stuart

I actually got busy on other projects and have not been able to spend this on this

It would be great to see a guide that explains how to get started with LTI and understand the procedure of where the LTI will be "placed" in Canvas. 

No worries at all  @help ,

I certainly know the feeling. If I get a chance to attend the Hack Night at InstructureCon in July I will see if anyone there might have any ideas that could be pulled together into a guide.

Cheers,

Stuart

tnijssen
New Member

To find out, I started by looking at the HTML in my browser. I found the following:

<form id="submit_online_upload_form" class="submit_assignment_form ui-tabs-panel ui-widget-content ui-corner-bottom" enctype="multipart/form-data" action="/courses/12719/assignments/42589/submissions" accept-charset="UTF-8" method="post" aria-labelledby="ui-id-3" role="tabpanel" aria-expanded="true" aria-hidden="false">

That "id" attribute looks interesting. Let's look it up in the Canvas source code, and we find this file. Clearly, the Google ones are special, but here we see what we're looking for:

<% (@external_tools[0,3] || []).each do |external_tool| %>
        <li><a href="#submit_from_external_tool_form_<%= external_tool.id %>"
          class="external-tool"
          data-id="<%= external_tool.id %>"
          data-name="<%= external_tool.name %>">
<%= external_tool.label_for(:homework_submission, I18n.locale) %></a></li>
      <% end %>

So we're looking for the controller of this template, which should define "external_tools".

I went up to the controllers directory, and guessed that we're dealing with the assignments_controller.

Indeed, we find the following useful snippet:

 if @assignment.submission_types.include?("online_upload") || @assignment.submission_types.include?("online_url")
        @external_tools = ContextExternalTool.all_tools_for(@context, :user => @current_user, :placements => :homework_submission)

Aha! We're looking for those tools that have "homework_submission" as one of the placements.

One quick Google search and we find this page, which links to the Canvas documentation for making an LTI homework submission.

Hope that helps!

That is outstanding  @tnijssen , awesome sleuthing work!

Amazing, Thomas, I know where to get started now. We can call you the sherlock holmes of APIs Smiley Happy