Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Peter Ruthven-Stuart -
Number of replies: 12
Picture of Plugin developers

What do people suggest is the 'Best Practice' for linking multimedia (sounds, images etc.) to questions written in the GIFT format to be uploaded to a moodle version 2 system?

For moodle version 1.9, I create a GIFT format Multiple Choice question containing an MP3 as follows:

::MC question with linked MP3::
Listen to this<a href\="http://vle.c.fun.ac.jp/moodle/file.php/282/sounds/piano.mp3">:</a><br>
What is it?
{=a piano
~a harpsichord
~an organ
~a clavichord}

the '282' in the URL refers to the Files directory of a course with id 282. So I would upload all relevant mp3 files to the 'sounds' directory in that course's files directory. Alternatively, as an admin, I could have uploaded all multimedia to the Front page site files directory, and added the relevant links to the GIFT file.

However, with moodle version 2 the management of files has completely changed. There are no course or system level directories to upload multimedia files to, unless I activate the 'legacy course files', which I want to avoid because of its associated problems.

So, what would be the best solution (or possible solutions) for linking to multimedia in GIFT files destined for a Moodle version 2 system?

At the moment I am thinking of creating a directory on the Moodle server, separate from Moodle but open to the web, and uploading all multimedia to that, and then adding absolute links to the relevant media files in that directory in the GIFT file. The problem with this solution is that it's only possible for someone who has access to the web directory on the server. I would rather not have to set up ftp accounts for every teacher.

Any suggestions will be most welcome.

Average of ratings: -
In reply to Peter Ruthven-Stuart

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That is definitely a good question, and I am not sure there is a good answer at the moment.

In one sense what you are doing is strange. GIFT is meant to be a simple plain-text format for questions, so how can you expect it to cope with attached files.

On the other hand, what you are doing is clearly a highly practical way to create questions, and something like that should be made to work.

The best idea I can think of at the moment is to make GIFT cope if you upload a zip file. It should look for a single. There would have to be some way for it to know which of the files in the zip was the actual GIFT format file with the quetsions, and there there should be some syntax in the GIFT format for refering to one of the files in the ZIP. It could probably be as simple as a token like @@FILELINK@@ that you use in URL. E.g. if the zip file contains a file sounds/piano.mp3, then the gift format would contain <a href\="@@FILELINK@@/sounds/piano.mp3">

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Peter Ruthven-Stuart -
Picture of Plugin developers

Tim,

Thanks for your reply.

"...and I am not sure there is a good answer at the moment."

I was afraid that might be the answer.

"On the other hand, what you are doing is clearly a highly practical way to create questions, and something like that should be made to work."

Yes, the GIFT format has saved me many hours of work. The ability to add URLs to questions in GIFT files means that in 1.9 I can create and upload 100's of listening questions without having to manually link each question to its respective sound file. The same goes for any 'media' file, and of course includes URLs in feedback too.

So while I fully understand that the new file system is better, it seems a pity that this extremely useful and time saving feature of GIFT (the ability to add URLs to multimedia) appears to have been rendered almost impossible in version 2.

Your suggested solution makes a lot of sense. Would it be worthwhile me 'creating an issue' (an 'improvement') in the tracker?

In reply to Peter Ruthven-Stuart

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes, please put an issue in the tracker. However, don't hold you breath waiting for me to do anything about it. (Sorry.) It should be a relatively self-contained task, so hopefully there are plenty of other people who could implement this.

In reply to Tim Hunt

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Actually, it seems there is already a feature request for this: MDL-13905.

In reply to Tim Hunt

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Peter Ruthven-Stuart -
Picture of Plugin developers

Thanks for that update.

It does seem that the feature request you mention (MDL-13905) is after a similar goal, but I'm not quite sure why the requester needs this feature in 1.9. He wrote: "However, it (GIFT) doesn't support an image to show with the question."

It is possible in both 1.9 and version 2 to add URLs (i.e. add HTML img tags or links to sound files). I have attached a text file containing two MC questions in the GIFT format. The first question is the same as above, which contains a link to an MP3 in a course directory. This works in 1.9, but is no longer possible in version 2.

The second question in the attached file is more complex. It contains links to both images and sound files (OGGs). Even the feedback contains links to sound files. Because all these images and sounds are in an external site (Wikimedia) this question will work in both versions 1.9 and 2.

The issue is that most moodle users will want to upload multimedia to their own Moodle system (i.e. not rely on an external repository), and then link to these media files in their GIFT formatted questions. This is no longer possible in version 2 because the 'course files directory' has been discontinued.

In reply to Peter Ruthven-Stuart

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Yulia I -

you can create a folder for uploads outside Moodle, e.g. http://www.yoursite.com/uploads  and link  all your media files in GIFT.

In reply to Yulia I

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Peter Ruthven-Stuart -
Picture of Plugin developers

Yulia, thanks for that advice.

As I mentioned above: "At the moment I am thinking of creating a directory on the Moodle server, separate from Moodle but open to the web", so I realise that it's possible to create a folder for uploads, however, this workaround is no good for teachers who don't have access to a server or are unable to create such a directory (e.g. don't have the right permissions). Furthermore, the advantage of the new file system is that when questions are made within Moodle, multimedia files become permanently attached to the questions, which is good for backups and importing etc. I think Tim Hunt's proposed solution would probably make this permanent linkage possible even with GIFT formatted questions that are imported.

In reply to Peter Ruthven-Stuart

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Yulia I -

teachers will be always able to link their files even if they don't  have permit to upload. The url is permanent and they can just add name of file into question. Admin uploads files for them and link is viable.

In reply to Yulia I

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Peter Ruthven-Stuart -
Picture of Plugin developers

Hello Yulia,

Yes, what you suggest is possible, but it creates extra work for Admins, work that they didn't need to do with 1.9 because teachers could upload the files themselves to a course files directory. It also means that teachers become even more dependent on Admins; something they could do on their own now requires admin support.

Average of ratings: Useful (1)
In reply to Peter Ruthven-Stuart

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Peter:

It also means that teachers become even more dependent on Admins; something they could do on their own now requires admin support.

I quite agree. This is one of the "pernicious" effects of the new files API system - and the disparition of the "Course files" system - in Moodle 2.

Joseph

Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Jean-Michel Védrine -

As this post is linked to the MDL-13905 tracker issue, I think it is useful I post here that there is now a solution to this problem.

I have created a new contributed question import format "Gift with media" available in the Moodle plugins directory here: https://moodle.org/plugins/view.php?plugin=qformat_giftmedia

Once this plugin is installed, a new format is available during question import: "Gift with medias format", if you choose this format, it will only accept a zip archive and not a text file as the "classic" Gift format

To prepare your zip archive, you need to prepare a folder hierarchy containing all your media files (images, sounds, ...) and create a text file containing your questions with exactly the same syntax used with the "classic" gift format.

When you want to link to a media file, you must use the word @ @PLUGINFILE@ @ to reference the root level of the zip archive.

Note that I was forced to type a space between the 2 @ sign in the word above (if I don't do that, the forum will interpret this as a link to an image and render my post completely unreadable, but you need to type it without any space !)

For instance if all your medias files are in a folder named "media" with 2 subfolders named "image" and "sound" and you want to put a

link to an image media/image/flower.jpg you have to write it as:

<img src\="@ @PLUGINFILE@ @/media/image/sound.jpg" />

If you want to link to a sound media/sound/piano.mp3, you have to write it as:

<a href\="https://@ @PLUGINFILE@ @/media/sound/piano.mp3">

 This may seems complicated at first, but certainly no more than it was in Moodle 1.9 when questions authors using Gift wanted to link to a file in the old "course files directory".

when your gift text file is ready just zip it with the media folder and use this zip archive when importing questions with the "Gift with media" format.

Some notes:

When creating questions please note that, as the equal character is a gift control character, it must be escaped with backslash when writing the link to media:

src= WRONG

src\= RIGHT

I make that mistake quite frequently smile.

When zipping you text file and your medias, be sure both are at the root level of your zip archive, if you put them in a folder inside your zip archive, import will fail.

In reply to Jean-Michel Védrine

Re: Any suggestions for Best Practice re GIFT and links to multimedia in Version 2?

by Jean-Michel Védrine -

Hello, here is a sample zip archive with 2 multichoice questions. one is using links to external medias (sons and images) on the web, and the other is using files included in the archive (sorry the sound is very short because files are limited to 100 Ko in the forum).

You can study the files in the archive without any requirement, but to test the import and compare the resulting 2 questions in Moodle you will of course have to install the "Gift with media" plugin on your Moodle server smile