Extended question type: drag-and-drop matching question

Extended question type: drag-and-drop matching question

by Adriane Boyd -
Number of replies: 39
Hi everyone,

I've attached an extension of the existing matching question that displays a drag-and-drop version in supported browsers. If the YUI javascript libraries aren't supported, it looks like the original matching question. The question editing interface and the grading are identical to the original matching question.

The drag-and-drop version provides all the answers in a list to the right of the question table. The current target is highlighted to show where the answer will be dropped. There are screenshots on the project page.

I have tested it in Firefox 2 and IE 6. There seem to be bugs with the YUI javascript libraries and Opera, so until I figure out what's going on, the non-javascript version is displayed for Opera.

Average of ratings: -
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Adriane,
Thanks for your drag and drop matching question type. Just tested it on Moodle 1.9 (dev). It works fine, even works with pictures (see attached).
Congrats!
Joseph
Attachment image00.jpg
In reply to Joseph Rézeau

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
I'm glad to see that it worked! You should be able to put any HTML you like in the questions and answers. The non-YUI fallback is still like the original matching question, so it won't work with images because of the drop-down menus, but I think the YUI libraries are supported by most browsers people are using these days. (If I can just figure out the Opera bug...)
In reply to Joseph Rézeau

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
Joseph,

I was just getting carried away the ability to add pictures when it occured to me that if a user has a browser that cannot display ddm I don't know what happens... Unfortunately I can't test this, is the alternate text shown or the html for the image link?
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
You can test it by temporarily turning javascript off in your browser. As it stands, nothing is displayed in the drop-down menu in the place of the image. The HTML is there, but it can't be displayed in the drop-down menu.
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Ray,
then you'll have to display the images in the left column, and matching text in the right column,
Joseph
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
The Opera bug was indeed a YUI bug (bug report). It has been fixed in YUI 2.3.0, which was just released on Monday. Hopefully YUI within moodle will be updated and this will no longer be a problem.
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You should post this in the General Developers Forum, to make sure Martin or Petr see it, and it they can then update the libraries in Moodle.
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
It looks like it's already assigned to Martin as part of another GSoC project (MDL-10336). I can bring it up in the General Developers Forum as not just relevant to that one project. I don't know how many complications it causes for other components, but it's a pretty old version at this point.
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
They have just updated YUI in head.
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
Here is an updated version that works with Opera in the current 1.9 dev. It also takes advantage of newer YUI features to load more quickly/cleanly.
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What to people think? Should I stick this into Moodle 1.9, along with the drag-and-drop ordering question? (1.9 beta release due any day now, so I would have to be quick.)

Adriane, remind me, do both those types support backup/restore, and import/export?
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Tim - My response would be "go for it!" I like the idea of drag and drop. I think students would like it as well - somehow it seems less formal but I have a hunch that it might help the student to connect the items better since they are doing something to bring the two concepts together. Peace - Anthony
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Matt Campbell -
I second Anthony's 'Go for it!' - as long as you have backup/restore and import/export. These both look to be great additions!

Thanks,
Matt
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -

The drag-and-drop matching question could in theory replace the existing matching question. Other than minor renaming to replace "match" with "ddmatch" (in the database and in backup/restore), I only changed how it gets displayed to the student. The database tables are identical and all the backup/restore functionality should be identical to the existing matching question. I will test it out soon and make sure it works.

Import/export would depend on whether it replaced the existing matching question. If it did replace it, importing should continue to work as it did before. If it were an additional question type, I'm not sure how importing would work because you wouldn't know whether an imported matching question should be drag-and-drop or not.

The ordering question is based on the existing matching question, so backup/restore should not be difficult to get working. I will also test it out soon.

I haven't thought about importing for ordering questions at all. There would be similar import problems since they look a whole lot like (or exactly like) matching questions in many import formats. I don't know that much about how import/export works, so I'm not sure how this should be dealt with.

In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I am suggesting using the drag-and-drop matching to replace the existing one.

We would need backup/restore and import/export of at least Moodle XML format before we could include ordering in core. Preferably GIFT format too, if GIFT supports matching and there is a natural extension of GIFT to support it.
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
If it replaces the existing matching question, then I think import/export should work with no problems. Whatever importing of matching was supported before should still continue to work because I haven't changed the database tables at all.
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Tim - I would be OK with it replacing it provided that there is an option to use the drag and drop. In other words have the matching question type with the ability to turn on or off the drag and drop functionality with the idea that even with it on depending on YUI working it may or may not be rendered. By default, I would like to see it off so as not to confuse folks who have already been using the matching questions. Peace - Anthony
In reply to Anthony Borrow

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
I'm with Anthony with this. To effectively drop one question type i.e. matching at a stroke would be a bad thing IMO. The addition of an option to switch on d&d, with the default set to off, is the ideal solution. Everybody will be happy and catered for.
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, everyone is happy except all the people that think the quiz is already too complicated. The new drag and drop matching poses exactly the same question, but with a better interface. Why would anyone want to keep using the old interface?

Can anyone come up with a pedagogic reason why you might want to keep the old interface?
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
Can anyone come up with a pedagogic reason why you might want to keep the old interface?

Frankly, no. My concern is that this is a long established question type and interface, to discard it entirely on a version upgrade is unnecessarily disruptive in my view.

btw, I can attempt a Matching question using my keyboard only. I haven't yet discovered how to do that with the d&d matching question type.

Just for the record, I don't think quiz is too complicated and I think the new question type is great. Yes
In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

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

I agree with Tim that "The new drag and drop matching poses exactly the same question, but with a better interface."

On the other hand, Hot Potatoes' JMatch offers drop-down list and drag & drop as options when you save your exercice. The big difference is that, in HP, it is almost impossible to use drag & drop when you have lists of pairs to be matched which are too long to be displayed on one screen. When you want to drag the first item in the right list opposite the last item of the left list, the screen gets confused/confusing. There is no such problem with Adriane's drag & drop version of the Moodle matching question.

Ray says:

My concern is that this is a long established question type and interface, to discard it entirely on a version upgrade is unnecessarily disruptive in my view.

I think the interface was unfriendly from the start, it should have been drag & drop, it is now possible, I am finding this a good thing, not something disruptive.

btw, I can attempt a Matching question using my keyboard only. I haven't yet discovered how to do that with the d&d matching question type.

Ray may have a point here for accessibility's sake, but it's hard to imagine using a computer without a mouse these days.

In conclusion: please let's have Adriane's drag & drop matching question as a replacement of the current matching question, not as a new type. I don't think we need to have an option to have the matching question as a drop-down list or drag & drop. If we do, then let's have drag & drop as the default option.

Joseph (a drag & drop addict)wink

In reply to Joseph Rézeau

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
Hmmm..

The new drag and drop matching poses exactly the same question, but with a better interface."

Isn't it more that the new drag and drop matching poses exactly the same question, but with a different interface?

I think the interface was unfriendly from the start...

Really? I've never encountered that view before, but I have encountered plenty of people who would have liked drag and drop as well.

Across the many thousands of Matching questions created and in use I would suspect that there will be a sizeable proportion of quiz instructions and stems that reference the current interface. They will be redundant at the moment of upgrade. We should not assume that all Moodle users will regard revisiting their question banks with enthusiasm.

Dumping the current interface also affords no opportunity to retain it to maintain a consistent experience in a course where the Lesson matching question is used.

Mice: Yes, but how do you attempt this question type if you can't use a mouse? Perhaps the answer to this issue is for the question to recognise the "AJAX and Javascript" (or something like it) setting in the user profile and make the "old" interface available.

I think this new question type is great, let's not throw the baby out with the bath water.
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -

The current interface is still there, used as a fallback. If YUI isn't supported or you turn javascript off, you get the original version.

When I started working on it, I thought about using the site-wide AJAX option to control whether the new version is displayed, but the option seems tangled up with the AJAX course format, plus the matching question doesn't use AJAX. It's just javascript, and there's already some javascript in the quiz.

It would not be hard to add an option, but I also think it would better to keep the database tables the same if at all possible. Then, backup/restore and import/export don't need to be modified at all from the original version.

How about providing instructions for disabling the drag-and-drop version for people who want to keep using the old version? The drag-and-drop version can be disabled by modifying a single line of code. (The single line of code doesn't prevent the YUI libraries from being loaded, so an efficient disabling would be a little more complicated, but still very much possible.)

In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
Hi,

Ajax/Javascript: OK, thanks for that clarification.

I don't imagine for a moment that anyone would not want ddm question as an option for questions as soon as possible. I don't feel that your proposal takes us on much further than Tim's. This what I understand is being proposed:

Tim: Drop the current matching question entirely in favour of ddm. No legacy support for questions that have been created using the current matching question type.

Adriane: As above, but include guidance on how to modify the code for a site so that all users are required to stay with "old" matching and there is no opportunity to start using ddm.

And me... (and others?)

Ray: Get ddm into core asap. Provide option so that existing (and new if required) "old" matching questions continue as before until consciously converted to ddm type by the question "owner".

You know it makes sense.... big grin

Still on the usability track... How does someone in a supported browser who cannot use a mouse attempt a ddm question?
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -

Someone in a supported browser who cannot use a mouse would have trouble, at least with the browsers I've tested with. They would have to disable javascript to see the original keyboard-accessible version. Do you know if this a common situation? (For instance, I don't think a screen reader would appear to be a supported browser, at least I really hope not, but I don't have any to test with.)

In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
There is a user profile screenreader setting too ... if someone has that turned on then the YUI interface should definitely be turned off.
In reply to Martin Dougiamas

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
Ah, I've seen the option mentioned and I should have thought to add that. I'll add it to all the question types that use YUI. (I think someone with a screen reader would need an alternate assignment for the image target question, but I'll add it anyway.)
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -

The ddmatch backup/restore already worked just as well as the existing matching question. The existing matching question doesn't work quite right, because shuffleanswers in question_match isn't backed up or restored. I fixed this for ddmatch and I've attached the updated version.

I am still working on the order question backup/restore. The question backup/restore is fine, but the answer recoding is not. I'll post an update in the order question thread when it's working.

In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
Adriane,

When an item is dragged to a location and then subsequently dragged away, the "Drag answer here" instruction is not re-instated.

Is this deliberate? I would have thought it more useful to have the instruction present in each "empty" box.
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
I agree with Ray that it would be more consistent to have the "Drag answer here" instruction re-initialised when an answer is dragged away.
Joseph
In reply to Joseph Rézeau

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -
It was just the teensiest bit simpler not to. Here is an updated version that reinitializes the "Drag answer here" instructions.
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Ray Lawrence -
That's great, Adriane. Many thanks.

Another quick point, is it possible to move the dragged item to the left rather than copy it?
In reply to Ray Lawrence

Re: Extended question type: drag-and-drop matching question

by Adriane Boyd -

In order to allow the same functionality as with the drop-down menus, it needs to be a copy. With the drop-down menus, you could choose the same answer for all subquestions if you wanted. I wanted to be sure that that was still possible in the drag-and-drop version because multiple subquestions can have the same answer. If the teacher provides the same answer for two subquestions, it only shows up once the drop-down menus or once in the drag-drop list.

It is, of course, possible, but I'd rather not do it because it would change the relationship between the original and drag-and-drop versions. If there are strong arguments in favor, it could be changed, but I was trying to keep it as close to the original version as I could.

In reply to Tim Hunt

Re: Extended question type: drag-and-drop matching question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Yes, please implement Adriane's drag-and-drop and re-ordering questions in 1.9.
Joseph
In reply to Adriane Boyd

Re: Extended question type: drag-and-drop matching question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Adriane,
There is a CSS declaration in your plugin which interferes with MULTIPLE CHOICE display. See MDL-10842

Joseph
In reply to Adriane Boyd

Tárgy: Extended question type: drag-and-drop matching question

by Deni Nagy -
Hello,

Could you please help me how to install this drag-and-drop-matching type question? I would really like to use it but it has a missing subquestion error message. I'm sure that I have done somethng ncrrectly just don't know what.


Thank you in advance!

Deni
In reply to Deni Nagy

Re: Tárgy: Extended question type: drag-and-drop matching question

by Angela Sivia -

FYI for those who can't get the image to appear in the question and/or answer, you need to use HTML coding:

<img src="image.gif" />

So, as an example, here would be the full path to the image:

<img src="http://moodle.net/file.php/6997/LoisLane.jpg" />

Now you should be able to view the images in your question.

 

(We are version 1.9.11)