General developer forum

I need some javascript help

Picture of Jean-Michel Védrine
Re: I need some javascript help
Core developersParticularly helpful MoodlersPlugin developers

Thanks Andrew,

I think all users of the drag and drop matching question type should thank you too.

My github repo include all Andrew's changes and my own one. You will se that I tried to make the code more in line with Moodle coding style standards, and also that I removed all non english language strings.

This is because I intend to submit this plugin to the Moodle plugin directory (I have Adriane Boyd permission to do so), and I want all languages strings management to be done using AMOS. This will permit contributors to submit their own translations (I will submit a french one myself).

This should be easy as ddmatch re-use most of the strings from the core match question type and there are very few specific strings to translate (8 or 10 if I remember well).

Of course you are all invited to test the git version and submit suggestions and bug reports.


Average of ratings: -
Picture of Joseph Rézeau
Re: I need some javascript help
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Hi Jean-Michel (and Andrew). Just downloaded and tested the drag and drop matching question type from Jean-Michel's github. It's working fine. I am attaching a screenshot showing matching divers elements such as text, long text, image and audio. Basically it works quite smoothly and I only have a few minor remarks to make.

Tested on current Moodle 2.5 dev.

1.- When drag & dropping an element, just when the dragged element is on a target, the target box background turns dark blue, which makes the text underneath illegible (to me). That is not terribly important but I would suggest changing to a lighter color.

2.- When an element in the left column is a fairly long text, it is "squeezed" in its fixed width column. Does not look nice. This layout is made even more problematic because the quiz navigation block and question details block take up valuable horizontal space when taking the quiz.

3.- When reviewing a quiz with a drag and drop matching question, I do not see the need for displaying again the draggable elements to the right of the review screen.

4.- Something curious happens with the "flashplayer" for the audio elements. In review mode, the small flash player is replaced with the big one in the list of draggable elements (on the right)!

5.- Unfortunately we have the same problem as the Hot Potatoes match activity: if the list of elements is long and contains "large" elements such as long text, pictures, etc., it is not possible to drag an element further down than the current window, in order to reach a target sitting "out of view" to the bottom. The only way out of this blocked situation is to provisionally drop the element onto the lowest target visible at the bottom, then scroll down, pick the element, drag and drop it further down, etc. I have no idea if it's feasible to make the scroll bar automatically scroll down by holding a draggable element and "pushing" it down.

Nice job, I think all that needs to be done now is more thorough testing with as many diverse kinds of draggable elements as possible, not just plain text, and some finalizing of the display.



Average of ratings: -
Picture of Jean-Michel Védrine
Re: I need some javascript help
Core developersParticularly helpful MoodlersPlugin developers

Hello Joseph,

Thanks a lot for your review. As you know I want to submit it to the Moodle plugin database, so I need fedback like this to improve this released version.

  1. My fault. Andrew wrote in a mail "Some of the colour choices I've used are just to demonstrate how it can be done in the stylesheets.".
    But work on issues in the tracker and also my work to prepare lessons took all my time, and I didn't had the time to look at the styles. Additionally people around me keep saying that my choice for colors sucks wink so maybe it would be better if you or somebody else propose colors ?
  2. I don't know what to do, but maybe this is clear sign that not all matching questions benefit from a drag and drop UI ?
  3. That seems sensible. But if some of the draggable elements were distractors this is a loss in information.
  4. Question for Andrew big grin
  5. I hate auto scrolling ! It seems to have a mind of its own and never do what I want, or stop when I want smile. Andrew will surely know if it's feasible or not, but maybe this is also the sign that not all match questions should be ddmatch ones ?

Please can all Moodle users interested in ddmatch question type keep testing this version. Thanks.


Average of ratings: -
Picture of Andrew Nicols
Re: I need some javascript help
Core developersMoodle HQParticularly helpful MoodlersPlugin developersTesters

1: I'm also not great a choosing colours - I was passing the buck I'm afraid ;)

2: This one is difficult. At present, the question side is allowed 25% of space, and the answer 75%. I'm not a style guru by any means, but it will be very difficult to please everyone here. If you have any suggestions on an improvement, they'd be good to hear.

3: This could probably be turned off - I'm not familiar enough with the quiz engine to know about this side of things really, but it should be pretty easy with CSS.

4: If you have an example of this then I can have a play. As I say, I'm not massively familiar with the question engine or quizzes in general.

5: I had a play with auto-scrolling, but it seems that if we constrain the drag/drop (as we need to do so), then the scrolling breaks. That said, I've just had an alternative idea which I'm going ot have a play with.



Average of ratings: -
Picture of Marcus Green
Re: I need some javascript help
Core developersParticularly helpful MoodlersPlugin developersTesters

Many thanks to Andrew and Jean-Michel. I just tried the new code with my flag match demo question and it looks good.


Average of ratings: -