MaharaProject / moodle-assignsubmission_mahara

Old, unmaintained Mahara assignment submission plugin for Moodle
https://moodle.org/plugins/view/assignsubmission_mahara
4 stars 10 forks source link

Moodle Assignment Collection broken link #15

Closed robinleung closed 9 years ago

robinleung commented 9 years ago

Moodle assignment links to collection is broken. It opens up "https://teportfolios.domain.ca/https://teportfolios.domain.ca/view/view.php?id=2972".

How to reproduce:

  1. Create a Mahara submission assignment in Moodle.
  2. Create a collection in Mahara.
  3. Use a test student to submit a Mahara assignment in Moodle. In the submission page in Moodle, under "Collections by xxxxx", click on the collection link. It should open the portfolio collection. However, it displays the link below. (<-- This is what needs to be fixed.)
  4. However, if we submit the collection selected. The instructor is able to see the collection. It just doesn't display in preview.

Currently on Mahara 15.04.1 and Moodle 2.8.8.

Thanks.

agwells commented 9 years ago

Hi Robin,

Thanks for the bug report! I'll see if I can fix that...

Cheers, Aaron

agwells commented 9 years ago

Okay, it appears this is due to a bug in the Mahara XMLRPC method get_views_for_user(). For views, it retrieves "fullurl", which is the absolute URL of the page, and "url", which is the relative URL for the page. For collections, it just retrieves "url" which is the absolute URL of the collection.

To make a link to roam over via mnet we need that local URL. So, it breaks for collections because it's using the absolute URL.

It works in the gradebook, because the gradebook gets the collection's URL form the return value of "mnet_submit_view()", and that correctly fetches the partial URL for the collection.

I'll take a two-pronged approach to fix this:

  1. In Mahara, fix the get_views_for_user() method so that it correctly retrieves the relative URL for collections.
  2. In the assign submission plugin, put in place workaround functions that check to see if the collection's URL is absolute, and if so, attempt to convert it to a relative URL.

This should fix it for the most Mahara & Moodle sites, without requiring both sites to be upgrade simultaneously. On the downside, it'll put that hacky workaround code into the Moodle plugin, but perhaps we can remove it after a couple of releases.

agwells commented 9 years ago

Mahara bug report to fix the issue on the Mahara side: https://bugs.launchpad.net/mahara/+bug/1514299

agwells commented 9 years ago

Should be fixed with commit 697ca001ecc0ea36ae6583ba7c024e2e0c831dc8

robinleung commented 9 years ago

Thanks Aaron.