ucfopen / Materia

Engage students with easily embedded apps for online courses. Supercharge your course with compelling experiences and game mechanics.
https://ucfopen.github.io/Materia-Docs/
GNU Affero General Public License v3.0
36 stars 34 forks source link

Work required to allow Materia to embed course page content #654

Closed jaxbot closed 5 years ago

jaxbot commented 9 years ago

Since I went down this road yesterday, I figured I'd write down what would be needed to allow Materia to embed content into course pages if we end up deciding that we want to do this.

Step 1: update Materia XML to add editor button

https://www.eduappcenter.com/tools/xml_builder is a great tool for exploring what extension needs to be added.

<cartridge_basiclti_link
  xmlns="http://www.imsglobal.org/xsd/imslticc_v1p0"
  xmlns:blti="http://www.imsglobal.org/xsd/imsbasiclti_v1p0"
  xmlns:lticm="http://www.imsglobal.org/xsd/imslticm_v1p0"
  xmlns:lticp="http://www.imsglobal.org/xsd/imslticp_v1p0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd">
  <blti:title>Materia Widget Assignment</blti:title>
  <blti:description>
    <!--[CDATA[Add a Materia Widget as an assignment]]-->
  </blti:description>
  <blti:launch_url>https://materia.qa.cdl.ucf.edu/lti/assignment</blti:launch_url>
  <blti:custom></blti:custom>
  <blti:extensions platform="canvas.instructure.com">
    <lticm:property name="tool_id">grade_passback</lticm:property>
    <lticm:property name="domain">materia.qa.cdl.ucf.edu</lticm:property>
    <lticm:property name="privacy_level">public</lticm:property>
    <lticm:property name="text">Materia</lticm:property>

    <lticm:options name="editor_button">
      <lticm:property name="enabled">true</lticm:property>
      <lticm:property name="url">https://materia.qa.cdl.ucf.edu/lti/picker</lticm:property>
      <lticm:property name="text">Materia</lticm:property>
      <lticm:property name="icon_url">some 16x16 png</lticm:property>
      <lticm:property name="selection_width">700</lticm:property>
      <lticm:property name="selection_height">600</lticm:property>
    </lticm:options>

    <lticm:options name="resource_selection">
      <lticm:property name="enabled">true</lticm:property>
      <lticm:property name="url">https://materia.qa.cdl.ucf.edu/lti/picker</lticm:property>
      <lticm:property name="text">Materia Widget Assignment</lticm:property>
      <lticm:property name="selection_width">700</lticm:property>
      <lticm:property name="selection_height">600</lticm:property>
    </lticm:options>
  </blti:extensions>
</cartridge_basiclti_link>

Step 2: Allow LTI to accept the new return URL

https://github.com/ucfcdl/Materia/blob/issue/fix-flaky-tests/fuel/app/modules/lti/classes/controller/lti.php#L47-48 need to be updated to support the new selection directive and return URL. Some code needs to be added around the Js::push_inline to clarify whether this is an assignment selection or a course selection. Scorable widgets should probably be blocked from showing up in the picker.

The RETURN_URL logic in the frontend LTI picker controller needs to be able to handle the different endpoint method. The URL query looks like this: return_type=oembed&endpoint=https://materia.ucf.edu/lti/oembed/0dIDA

Step 3: Add Oembed support

Basically just need a page that returns some JSON for what to return to Canvas:

    public function action_oembed($inst_id) {
        return <<<EOF
{"version": "1.0","type": "rich","width": 75,"height": 75,"html":"\u003Ciframe src=\u0022https:\/\/materia.qa.cdl.ucf.edu\/embed\/{$inst_id}\u0022 width=700 height=600 alt=\u0022 Assignment\u0022 \/\u003E"}
EOF;
        }

Step 4: Add UI

Better UI is needed, and some messaging about the widget not being scorable should be added, too.

iturgeon commented 5 years ago

Closing to consolidate with #1093