Drag and Drop Question

Drag and Drop Question

by john Imbt -
Number of replies: 114

where can i get the drag and drop http://docs.moodle.org/en/Drag_and_Drop_question_tutorial 

question type?  I am not the Moodle administrator for our district, but I use it for teaching a 6th grade science course.  I would like for our admin. to install this question type but need to point him in the right direction as they have developed their own CMS that he must keep up to date so this is a favor to me.  Thanks... 

Average of ratings: -
In reply to john Imbt

Re: Drag and Drop Question

by Gustav W Delius -
The version that will work with Moodle 1.6 is under development in cvs:/contrib/dragdrop but it is not yet ready. (Also Sourceforge CVS is still down so noone can do any work on it until Sourceforge gets their act together).
In reply to Gustav W Delius

Re: Drag and Drop Question

by Ruben Stein -
Hello Gustav,
I tried to implement the version distributed via CVS, but faced a couple of problems. I'm not shure to post them or just wait until it gets official.

Anyway I'll post them, because I don't really know where to ask this questions instead.
Installing the Version the way described via README.TXT results in an PHP error. It says that the class "default_questiontype" cannot be found. So I corrected the "questiontype.php" of the dragdrop directory to:

/// QUESTION TYPE CLASS //////////////////
class dragdrop_qtype extends quiz_default_questiontype {

This way it passes the PHP error but gets stuck when adding a drag and drop type question. Here I get a moodle error saying question type 91 cannot be found, allthough it is defined in "locallib.php" like desribed in the readme.
Any ideas how to solve this? I know that maybe it is not final, but I really want to try this out because there are people bothering me for implementing sth. like that. ;)
In reply to Gustav W Delius

Re: Drag and Drop Question

by Jean-Michel Védrine -
I have continued Gustav's work and committed my changes (only small fixes) to CVS but I still get some errors. I must have forgotten something rouge
I can create the question, place the images and hotsports but after that I get "A required parameter (courseid) was missing" error message when I try to save the question.
During the attempt it is possible to drag the objects and the question seeems to work, viewing the results the objects are boxed with either a green or red line as they should but the mark is not correct.
If another programmer can have a look at it, maybe we can finish this very interesting questiontype.
Also we need to change the README.txt because in Moodle 1.6 the files to edit are differents (of course it would be better if we could avoid modifiying any Moodle core files but I don't see how)



In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Jean-Michel Védrine -
For those brave enought to test the current state of the dragdrop question type (of course NOT on a production server), here is a modified README.txt file giving the step to install it
But please note:
  • This is only for Moodle 1.6, not for Moodle 1.5x
  • It is not really working for the moment !!

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hello Jean-Michel
I wanted to test the dragdrop question but I can't even do STEP 1 of your readme.txt instructions!
I have downloaded (latest CVS) the dragdrop folder, I put it into my local install of moodle, in question/type/... Then, logged in as admin I visit Administration... but the dragdrop tables are NOT created in my mysql database (I have checked with phpMyAdmin).
I'm stuck!

These are the steps necessary to integrate the drag and drop questiontype with Moodle 1.6x:
**************
* STEP 1
**************
Copy all the dragdrop folder inside your question/type/ subdirectory on your Moodle serveer
Log in as admin and visit Administration to create the dragdrop tables.

Joseph
In reply to Joseph Rézeau

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello Joseph,
Sorry, I have added a version.php to test the question type, but forgot to add it to CVS !!
This is corrected now.
If you don't want for anonymous CVS to show the new file, just add a version.php file in the question/type/dragdrop/ subfolder containing :
<?php

$plugin->version = 2006032200;
$plugin->requires = 2006032200;

?>
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

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

Hello Jean-Michel,

I've got the version.php file and I could set up the tables. Will continue the testing tomorrow... Thanks.

Joseph

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Jean-Michel Védrine -
I am happy to report that it seems I managed to fix the most obvious bugs.
So a "basic" use (creating questions, submitting attempts, seeing graded responses) of the dragdrop question is now possible with Moodle 1.6.
Of course a lot of things are still missing
- I have added a delete function but there is currently no backup/restore functions
- currently the questions aren't included in item analysis or detailed responses reports.
I would be very interested if you can do some tests (on a test Moodle install only clin doeil) and reports any bug or problem.
You can download the question type at http://download.moodle.org/download.php/modules/dragdrop.zip but please wait a few hours because I only commited my last fix a few minutes ago (if the questiontype.php version is < 1.4 you definitely have an outdated download)
You can also browse CVS at http://moodle.cvs.sourceforge.net/moodle/contrib/dragdrop.
I repeat, please don't test on any producion server.
As stated at the top of this thread, the address of a how-tol to create dragdrop questions is http://docs.moodle.org/en/Drag_and_Drop_question_tutorial
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

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

The following is an exchange between Jean-Michel and myself about the current state of the drag&drop question type. We would very much like fellow moodlers to a) carry out their own testing of the module as it stands b) contribute their own comments to the discussion. Jean-Michel's comments are in dark-blue.

Joseph


*Install

*In Moodle 1.6, thanks to Gustav's invaluable work, the new question implementation theoretically allows for any new question type to be made available to Moodle simply by dropping a folder into \question\type\. However, the mechanism is not complete yet, and a number of (minor but indispensable) changes have to be made to various Moodle core files in order for a new question type to work. For dragdrop these changes are explained in Jean-Michel's readme.txt file.

J.-M. This is a great limitation in the way question types are now handled:: all question using a javascript lib lwill need to modify core files. I think we should solve this issue now creating a standard way for question to add the javascript code they need (and to add it once even if there are several questions of the same type on the page). I am interested to solve this issue because I plan to code a hotspot (select point interaction) question type this summer and I plan to use javascript.

Documentation

There is a short but sufficient tutorial available in the Moodle Docs wiki here.

Feature Requests

1- Preview

When a new dragdrop question has been created it is possible - as for all questions - to Preview it. However, the draggable objects are NOT draggable, and the question does not work. To see it in action one must put that question into an existing Quiz and Preview the Quiz.

J.-M. This was a mistake in my modified README.txt file : I forgot a core file to modify. The README.txt has been modified to correct this problem

2. Feedback

Feedback as to whether the draggable items have been dropped on their targets is given in 3 ways. (1) When authoring a dragdrop question, the teacher can provide an Overall Feedback (OK) and an Overall Feedback (missed). (2) The Quiz mechanism will also display an automatic feedback message, one of the three following "Correct", "Partially correct" or "Incorrect". (3) When quiz has been submitted, further feedback is displayed in the form of a red border around wrongly placed objects and a green border around correctly placed.

In a Quiz which has adaptative mode switched on, I would much prefer feedback #3 to be available to the student immediately upon clicking the Submit page button, rather than having to wait for the Quiz to be submitted in its entirety. Actually, I would prefer another system, see point 3.

J.-M. I agree

3. The green/red border feedback system is better than no feedback at all. However, I would much prefer a more obvious/standard feedback behavior (in Quiz adaptive mode, where the student can change their answer). When the student has dragged & dropped the draggable objects and cliked the Submit page button, I would like to see the wrongly placed draggable objects to immediately return to their original position (at the bottom of the target background image), ready for a new try.

J.-M. This is the way to go

4. At the moment it is possible to drop draggable objects *anywhere on the screen*. A routine should check for objects to be droppable only either on the background image target OR (better) on a hotspot target. Any object dropped some other place would be automatically returned to its original position.

J.-M. I am not sure the second solution will suit all questions, sometimes you may want the student to be able to drag an object anywhere on the background image.

5. As it stands, the dragdrop question type works with
  • a (unique) background image where hotspots can be placed
  • a series of (smaller) images which can be dragged and dropped on those hotspots (targets).

This system is OK for a number of activities, such as:

  • a) drop an image of a flag on the corresponding country (background image is a map);
  • b) match a images of a butterflies and images of their favorite flowers (background image consists of x pictures of flowers);
  • c) produce an identikit portrait of a suspect by dropping various items (moustache, glasses, etc.) over a silhouette; etc.

However, there is a frequent activity (esp.) in language learning which consists of naming or labelling objects. The dragdrop tutorial in Moodle Docs shows such an example. However, it is not really ergonomic to have to create and save a background image consisting of ... words. Suppose one wants to modify this image (in order to correct a spelling mistake or to add a new word), the teacher has to start from scratch... It would be much better to use the Text field in each Drag & Drop question... if the program could handle text (<div>s) as drag-drop objects instead of images! This is certainly feasible, cf. the Hot Pototoes JMatch activity.

6. As mentioned by Jean-Michel, at the moment the dragdrop question type does not support export/import. This is of course necessary if this question type is to be actually used in Moodle in the future.

J.-M. Yes I see this as an important issue because currently some import/export formats are worked on (see threads on XML import/export and IMS QTI importer in this forum) and none will support third parties question types because no API to do so have been fixed (see Bug 5083)

Gustav has done a wonderful job transforming all question types to plugins. It's now up to us to bring this idea further by allowing complicated question types (javascript, java, flash, ...) without any core file modification and import/export capabilities (at least XML and IMS QTI) for all questions types.

We should also write a developer guide on how to write a new question type with for instance a complete description of the function of each method in the questiontype.php fille.

In reply to Joseph Rézeau

Re: Drag and Drop 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
In Moodle 1.6, thanks to Gustav's invaluable work, the new question implementation theoretically allows for any new question type to be made available to Moodle simply by dropping a folder into \question\type\. However, the mechanism is not complete yet, and a number of (minor but indispensable) changes have to be made to various Moodle core files in order for a new question type to work. For dragdrop these changes are explained in Jean-Michel's readme.txt file.

Getting question plugins to be completely self-contianed. is very important to me. You have done exactly the right thing: try to implement a new question type, document where the current plugin API is insufficient, and make sure I can get at what you document.

I will be implementing a new question type over the summer too, and so I really have a moditivation to work on this.
In reply to Tim Hunt

Re: Drag and Drop Question

by ned moltoya -
Hi,

can someone give me a status on this? Latest cvs update is 2 weeks old. Has any work been done in the meantime? I'd like to help out if I can.

Best,
Ned
In reply to ned moltoya

Re: Drag and Drop Question

by Brian King -
As you've probably noticed, there is a working version available (thanks completely to Jean-Michel!) in the cvs.

If you'd like help out with the development of the code, such as the feature requests noted in this discussion, your help would be very welcome.  I'm overbooked timewise for the forseeable future.  If you're working on improving on the code or documentation and have questions, feel free to ask me (email is better than forum posts for reaching me).

If you're going to get involved in the development, we can make a wiki entry someplace (and maybe a mailing list) for project communication.
In reply to Joseph Rézeau

Re: Drag and Drop Question

by N Hansen -
I just discovered this question type and really would like to test it, but I run into some errors when trying to use it.  When I click on the "position the hotspots" button, I get the following error:


Fatal error: Call to undefined function: session_drag_drop_js() in /home/xxx/public_html/question/type/dragdrop/dragdrop.php on line 305

The function doesn't seem to exist anywhere in the files.



In reply to N Hansen

Re: Drag and Drop 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 N Hansen,

Did you follow all of the install steps for the dragdrop plugin as explained in the readme.txt file? One of the install steps involves a modification of lib/questionlib.php.

And it is precisely there that the session_drag_drop_js() is defined.

I would really like as many people as possible to test this drag and drop plugin and to report bugs, feature requests, etc. so that the plugin can be made viable and possibly improved along the lines I suggested in my post in this thread.

ATB

Joseph

In reply to Joseph Rézeau

Re: Drag and Drop Question

by N Hansen -
No, I didn't read it-for these contrib things, I usually assume installation is standard unless otherwise informed. So thanks for the information. I will take a look at it and report back.

And another question-Is it possible to add more than ten images, even if it involves editing the database? To actually use this for what I need it for, I will need more than 10.
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
The instructions are not completely clear here. What I don't understand is where exactly to put the put_dragdrop_javascript();. Do I put it directly before print_footer or before all the listed lines?:

Add function calls to print out the dragdrop javascript at the appropriate time.

    - In each of the files mod/quiz/attempt.php, mod/quiz/review.php:
        - search for the lines
    if (empty($popup)) {
        print_footer($course);
    }
         Add the following line above each call to print_footer:
        put_dragdrop_javascript();
    - In each of the files question/review.php, mod/quiz/reviewquestion.php:
        - search for the text "print_footer".  Add the following line above each call to print_footer:
        put_dragdrop_javascript();
In reply to N Hansen

Re: Drag and Drop Question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
> ... where exactly to put the put_dragdrop_javascript();

There was a typo in the instructions for STEP 4 in the readme.txt file, and I have re-written the instructions in a - hopefully- more clear way:

**************
* STEP 4
**************

Add function calls to print out the dragdrop javascript at the appropriate time.
    - In each of the files mod/quiz/attempt.php, mod/quiz/review.php: change the lines
    if (empty($popup)) {
        print_footer($course);
    }
    to:
    if (empty($popup)) {
        put_dragdrop_javascript();
        print_footer($course);
    }

    - In each of the files question/preview.php, mod/quiz/reviewquestion.php: change the line:
       print_footer
    to:
        put_dragdrop_javascript();
        print_footer;

Joseph

PS. - Jean-Michel, if you read this, can you modify the relevant part of your readme.txt file in contrib?

In reply to N Hansen

Re: Drag and Drop Question

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

The maximum number of matching images is determined by the QUESTION_NUMANS constant, located in \lib\questionlib.php, line 60. It is default set at 10, and you can change this value. See this discussion.

/**
 * Constant determines the number of answer boxes supplied in the editing
 * form for multiple choice and similar question types.
 */
define("QUESTION_NUMANS", "10");

Joseph

PS It is a pity that this number is hard-coded. It should be made settable somewhere in questions edit...

In reply to Joseph Rézeau

Re: Drag and Drop 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
Actually, we should get rid of this and have some nice JavaScript that means you always have the just the right number of answer boxes, plus one spare, and if you fill in the spare, another one magically appears.
In reply to Joseph Rézeau

Re: Drag and Drop Question

by N Hansen -
But is there any risk that making too many questions will be a problem? For example, I needed to increase the number of matching question subquestions allowed for use with my flashcards to 78, but once I created above 64 subquestions, I had to change the type of one of the fields to accommodate more than 255 characters to be able to record all the information.
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
When I edit the hotspots with the visual editor, if I click "save and continue" I get the following message:

Couldn't find this course module

When I simply click "save and return" it returns me to the configuration page and seems to save the new settings.
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
My initial tests with using this were mostly successful. The tutorial in the Moodle docs for this is particularly good and made it really easy to figure out how to layout the images and hotspots. The only problem I noticed was that the black border around the background picture behaved strangely when I resized the page.

I'm going to go ahead and try and increase the number from 10 to 42 to convert to drag and drop some questions that haven't been as user friendly as my students would have liked them to be that involve ordering things. I'll let you know how it goes.

I think someone mentioned it before, but a feature that would be nice to have would be to be able to susbstitute text for the individual images. In some of the questions I want to create, the "images" are simply numbers. Perhaps you could have a field for entering the text you want in place of the image and a field for giving the size of the text.
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
I think I found a bug. I created a question, and ran a preview of the question. It involved moving numbers over particular hieroglyphs in a sentence. I placed the numbers over the correct glyphs, but it still marked some as wrong. My suspicion is that some were marked wrong because I had positioned some of the images at least partially outside of their hotspots. I wanted to be able to position the numbers outside of their hotspots because I preferred in some cases for them to be next to the hieroglyph they matched with, not on top of it, for legibility reasons.  When I moved the numbers back inside their hotspots, they were marked correctly.

In any case, this really is one of the coolest Moodle features ever! I'm opening my hieroglyphs courses to anyone who wants to enroll in about two days, and I am going to replace my really awkward questions in the first quiz with this right now because it will make things so much easier for my students. Thanks a lot!
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
Another thing that I think would be helpful would be if the correct/incorrect answers were indicated by making the border of the entire hotspot red or green and putting the image in its location within that hotspot. As is, my number images are very small and when you put a green or red border around them they are illegible. Also, by highlighting the image, instead of the hotspot, you are not telling the student what the correct answer is, just the incorrect one. This might not be helpful in adaptive question situations, but where there is only one attempt, it is essential.
In reply to N Hansen

Re: Drag and Drop Question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
>Another thing that I think would be helpful would be if the correct/incorrect answers were indicated by making the border of the entire hotspot red or green and putting the image in its location within that hotspot.

I don't understand what you mean by that. The hotspot is only meant to be used by the drag&drop mechanism, not to be displayed to the student.

>As is, my number images are very small and when you put a green or red border around them they are illegible.

Any way to make your number-images a bit bigger? I suppose not, because then they would hide the hieroglyph underneath?

>Also, by highlighting the image, instead of the hotspot, you are not telling the student what the correct answer is, just the incorrect one.

I don't understand what you mean by that. Of course by highlighting an image (or rather giving it a green border) you are telling the student that that image has been correctly placed.

Anyway, I maintain that the best way to show the student without any doubt their results would be to leave the correctly placed images in place and to move the incorrectly placed ones back to their original position (at the bottom left of the background image). See my previous post about this. I hope some programmer will answer this challenge.

Joseph

See enclosed European countries drag&drop question in submitted state, showing 3 correctly placed countries and 2 incorrectly placed ones (France and Spain).

Attachment image-0000.jpg
In reply to Joseph Rézeau

Re: Drag and Drop Question

by N Hansen -
Yours looks very nice with the borders. Here's what mine looks like sad. I think I have a workaround for it though. I'm just going to hack out the red and green borders altogether, and then if someone gets it wrong I will just include a correct image in the automatic feedback.

I can't really make the numbers bigger. I have other sentences longer than this, and if I make the glyphs bigger, they won't fit on the screen, and since I can't increase glyph size, I need to keep the image size small as well.

By the way, why is the comment above the question? Is this because it is a preview?


Attachment exampleprob2.jpg
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
Hi, does anyone know how alternative hotspots work? I've got a situation that I think needs one but since I don't know exactly what they are and what to put in the alternative hotspot box, I'm not sure.
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
One more feature request for this-Make an option to put the images along the bottom (as they are now) or on the side. I've got some hieroglyph questions like the examples I posted above that run vertically, rather than horizontally, and it would be nice if the numbers for them ran down the side instead of the bottom. 
In reply to N Hansen

Re: Drag and Drop Question

by Brian King -
if you want one of the drag'n'droppable images to be correct if dropped on more than one hotspot, then you can specify alternative hotspots.  you do this by providing a comma-seperated list of the ids (that you see on the screen, i.e. 1-10) of the other drag'n'drop image(s) whose hotspot you want it to match.

clear as mud?

for example, if you have 3 drag'n'drop images, and you want the first and third to be marked correct if they are dropped on the hotspot of either the first or third drag'n'drop image, then you would put 3 in the in the "alternative hotspots" of the drag'n'drop image 1, and put 1 in the "alternative hotspots" of the drag-n-drop image 3.

if you wanted the second drag'n'drop image to also match the other two hotspots, you would put 1,3 in "alternative hotspots".

In reply to Brian King

Re: Drag and Drop Question

by N Hansen -
Thanks for the explanation, but what if you want to have a single image match with two hotspots, and no other image match with those hotspots? It doesn't sound like it would work, would it?
In reply to N Hansen

Re: Drag and Drop Question

by Brian King -
no, unfortunately not.   

it would be a good improvement to the code to be able to freely add or remove hotspots associated with a particular image.  the database table implementation already allows for such an association, but the code would need to be changed.  the user interface would also need to be changed (a good idea anyway, it's a bit of an ugly duckling).
In reply to Brian King

Re: Drag and Drop Question

by N Hansen -
I found another thing that might be considered a bug. When reviewing a student's drag and drop answer, I noticed that one of the images was nowhere to be found on screen. I looked in the database record for this student's answer and found it there, but the coordinates seemed to be so far away that it isn't showing up at all onscreen during the review. There needs to be a restricted area to which students can move images-in other words, some sort of warning maybe should be displayed when a student doesn't drop all the images onto the background image.
In reply to N Hansen

Re: Drag and Drop Question

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

The behavior you describe is not a bug; the drag & drop mechanism works as expected and will only recognize as correctly placed those images which have been dropped on their hotspot target. In order to achieve what you want, i.e. that the "image-numbers" should be dropped not on top of the individual hieroglyphs but somewhere next to them you might consider various options, amongst which I suggest the following.

In your quiz instructions, make it clear to the student that you are expecting the "image-numbers" to be dragged and dropped e.g. immediately under a matching hieroglyph; when authoring your drag&drop question, position the hotspot targets accordingly, just underneath each hieroglyph.

Hope that helps,

Joseph

PS Looking forward to seeing your hieroglyphs course online.

In reply to Joseph Rézeau

Re: Drag and Drop Question

by N Hansen -
I don't think I made myself clear. I don't want the students to drop their numbers in next to the glyphs, but I want to put them there in the teacher version so that I can show them what is right and wrong in the review in a legible manner.

I've attached an image of my arrangement page to show you what the problem is. The blue numbers are the images (they are gifs with clear backgrounds). Note in the lower left corner that the image 17 is not entirely enclosed by its hotspot. Now, if the student were to put his 17 entirely in the related hotspot, it will be marked as wrong, because I didn't put my image entirely inside the hotspot. While an image should be associated with a particular hotspot, it shouldn't have to fit entirely within the hotspot. Does that make more sense?
Attachment exampleprob.jpg
In reply to Joseph Rézeau

Re: Drag and Drop Question

by Jean-Michel Védrine -
Well, in fact to be recognized as correct the object don't need to be dropped exactly on top of the corresponding hotspot.
The rule is that the 2 rectangular zones (the object one and the hotspot one) must intersect in order for the response to be graded as correct.
For instance if we define the hotspot to be the big red rectangle (sorry for Corsica), left and center are correct and right is not :
hotspot
This behavior is coded in the overlaps function of the questiontype.php file
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Jean Michel and Joseph,

I think I found another bug.  I took a map graphic like yours and changed the actual question so it now reads:  

Which country will win the World Cup of soccer?


Unfortunately, now no matter how I set up the answers, the only correct one allowed is France!   I am OK with that, but I have some Italian friends who are trying furiously to fix it before Sunday.  wink
In reply to Don Hinkelman

Re: Drag and Drop Question

by N Hansen -
It's hard coded for four years, and then cron allows you to choose another correct answer.

Seriously, there's another issue-the page for editing the dragdrop question takes so long to load. I don't know if it is because it has to load a lot of little fields all over the place, but it really takes longer to load than any other page I have ever seen in Moodle (before I increased the number of pictures from 10 too).
In reply to N Hansen

Re: Drag and Drop Question

by Eduardo Hernandez -
Hello, I have the same problem reported by N Hansen

" When I edit the hotspots with the visual editor, if I click "save and continue" I get the following message:

Couldn't find this course module

When I simply click "save and return" it returns me to the configuration page and seems to save the new settings. "

I'm running Moodle 1.6.3+

Eduardo
In reply to Eduardo Hernandez

Re: Drag and Drop Question

by Jean-Michel Védrine -
Well,
Here is the "expected behavior" (and this is also what is happening on my Moodle 1.7.1+ test site)
- If you click the "save and return to question" button, you are returned to the first screen of the dragdrop question editing (where you specify the images and media names, ands you see the dragdrop hotspots as data fields), all moves done in the "Position the hotspots" screen should be translated as changed data in that screen. Internally this is called the "savereturn" process.
- If you click the "save and continue" button, you are returned to the current quiz editing screen. Internally this is called the "savecontinue" process
The relevant code is in dragdrop.php and is :
if ($process == 'savecontinue') {
redirect("{$this->cfg->wwwroot}/mod/quiz/edit.php");
} else {
redirect("{$this->cfg->wwwroot}/question/question.php?id=$id");
}
Of course, this assume that you are editing the dragdrop question from inside a quiz ! This is because this code was written before questions were moved out of the quiz module and this is obviously no more working if you are editing the dragdrop question from the question bank !
So this is why you are getting the error message but as I always tend to edit questions from inside quizes I never saw this message and was unaware of the problem sourire

I will fix it.


In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Jean-Michel Védrine -
Just to report that while working on the upgrade of the dragdrop question type for Moodle 1.9 (not finished and not commited to CVS yet, contact me if you want to participate in beta testing) I have solved the bug of the "Save and return to question" and "Save and continue" buttons not working correctly if you were adding of editing dragdrop questions from the question bank (these buttons were working correctly when adding or editing a question from inside a quiz).
Unfortunately to solve this small bug I had to modify quite a lot of files (namely arrange.php, dragdrop.php, questiontype.php and templates/arrange.tpl) so I only did it for Moodle 1.8 versions and not for older ones.
All dragdrop & moodle 1.8x users can upgrade and report.
Moodle 1.9 users, please wait for the upcoming version because in the current state of CVS dragdrop will not (yet) work with Moodle 1.9.

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Jean-Michel Védrine -

While working with the dragdrop question type in Moodle 1.7 1.8 and 1.9, I just discovered something that I think you should be aware of :

Under Moodle 1.8 and 1.9 (but not under Moodle 1.7) setting debugging to DEVELOPPER level (in Administration > Server > Debugging) crash the dragdrop question type : you are no more able to drag drop the images on the hotspots targets (both in preview and in attempt)

This is because some lines are added at the begining of the page.

<?xml version='1.0' encoding='utf-8'?>
<!--
DEBUG: Content-Type: application/xhtml+xml
-->

I doesn't understand why this inactivate the DHTML used by the javascript library but this is a matter of fact : DEVELOPPER debugging and dragdrop are not compatible for the moment.

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Christophe Leville -

Hi Jean-Michel!
I just downloaded 1.9 and was wondering when I'll be abble to use the drag&drop plugin?
thanks.

In reply to Joseph Rézeau

Re: Drag and Drop Question

by Matt Campbell -
Very cool question type that fits a need we've got in our school to place components in a diagram, etc.  Could you look into a few possibilities?

Ability to rotate the graphic to be placed - both when creating the question and when taking the quiz.  On some issues, it's not just that the student is able to place the component in the right location, but that they're able to place it correctly.

Backup and restore.  I seem to remember reading that this is not ready yet.  We really need this feature for this question type to go on a production site - as soon as instructors start making them, they'll want to share!

Images - some images just don't show up.  Is anyone else having this issue? 

Resizing - I think N Hansen pointed this out, also - resizing the quiz display box can cause some issues - the background border and the 'container' for the images don't stay aligned, and the quiz navigation controls can get covered up.

I know I picked on a few issues, but a very cool question type. 

Thanks,
Matt
In reply to Matt Campbell

Re: Drag and Drop Question

by Jean-Michel Védrine -
Yes adding backup/restore is a priority.
I started coding the backup side but the restore side is unfinished due to a lot of work at the end of the academic year.
I hope to be able to finish this before the end of july.
For your teachers wanting to share dragdrop questions it would be interesting to modify xml import/export format to include dragdrop questions. Unfortunately for the moment format aren't extensible so you will need to replace original question/format/xml/format.php file with a modified one !
In reply to Joseph Rézeau

Re: Drag and Drop Question issues

by Ben Struthers -

A couple issues ive had with the drag and drop question.

Ive put the question into a quiz and when i go and do the quiz it will not allow me to drag the images.

the second issues is when i complete the quiz and view the answers to the questions, the background image for the drag and drop questions displays in the top left hand corner of the screen.

If anyone knows how to fix these issues, the help would be appreciated.

 

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Bug report in the drag and drop question type.

In file \question\type\dragdrop\questiontype.php, around line 500        // global feedback

the lines for displaying feedbackok and feedbackmissed have been inverted. To correct this bug, simply invert:

                echo $question->options->feedbackmissed;
and
                echo $question->options->feedbackok;

Joseph

In reply to Joseph Rézeau

Re: Drag and Drop Question

by Jean-Michel Védrine -
Joseph,
Are you sure of this ? Because the line
if ($state->raw_grade >= $question->options->feedbackfraction) {
will only be true if all responses are correct and in this case we want feedbackok to be displayed
And in the case $state->raw_grade is less than $question->options->feedbackfraction we want feedbackmissed to be displayed.

So I am unsure there is any bug here, but maybe I am missing something ?
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by N Hansen -
I didn't implement Joseph's "fix" and it seems to work fine so if there is a bug I am missing it too.
In reply to Joseph Rézeau

Re: Drag and Drop Question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Oops, I must have fooled around with the code in that file, because now I must admit there was not bug concerning the feedbackok and feedbackmissed.
Sorry!
Joseph blush
In reply to Joseph Rézeau

Re: Drag and Drop Question

by N Hansen -
Joseph-Actually I think the reason you thought these should be switched is because you probably were seeing odd behavior that  you attributed to this, but in actuality the bug is in a different nearby line:

if ($state->raw_grade >= $question->options->feedbackfraction)

As long as your maximum raw grade is 1, it works properly, but if it is anything more, it will give correct feedback for some questions that are only partialy correct. I'll see if I can fix this now, if no one else fixes it first. It seems we need to change $state->raw_grade to $state->raw_grade divided by whatever the possible points are for the question.
In reply to N Hansen

Re: Drag and Drop Question

by N Hansen -
OK, I changed line 501 to:

            if ($state->raw_grade/$question->maxgrade >= $question->options->feedbackfraction) {

And it seems to fix the problem. Please test this more thouroughly.
In reply to N Hansen

Re: Drag and Drop Question

by Jean-Michel Védrine -
So, after all, Joseph was right, there is a bug  smile
I have changed the line to :

if ($state->raw_grade >= $question->options->feedbackfraction * $question->maxgrade) {

(Just my old feeling that you should avoid division if possible because you don't know when something can become zero and after that people will complain when they receive a divide by zero error message ...)
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by N Hansen -
Found another problem. I created a question using 42 items to be dragged and dropped. They are small, but still they don't all fit on the screen and a student would have to scroll over to see all of them. There needs to be some kind of wrap possible.
In reply to Gustav W Delius

Re: Drag and Drop Question

by Stuart Purvis -

Trying to use Drap and Drop on  Moodle 1.6.xxx but I am getting the following Error can anyone help please

 

Could not insert dragdrop subquestion

Stuart

In reply to Stuart Purvis

Re: Drag and Drop Question

by Jean-Michel Védrine -
I have recently upgraded my production website to 1.6.2+ and use the drag drop question with no problem.
Are you sure you visited Moodle's administration to create the tables ?
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Steph Foerst -
I'm having the same issue, also on a 1.6.2+. I visited the admin page and the tables were created (I checked my database).

When I edit the question later, I get:
question_dragdrop 12 record not found

I would love to get this question type working, let me know what I can try.

Thanks!
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by N Hansen -
There are a couple issues with drag and drop questions that I want to ask about. Several people here have asked whether this is going to be upgraded for 1.7 but no answer has been given yet. I use drag and drop so I'd like to see it upgraded.

Also, one of my students today discovered a problem with drag and drop. She was reviewing her submitted and graded exercise on screen and then wanted to print it out. Her answer to drag and drop did not appear at all. I notice that the images have
style="visibility: hidden;"

I'm wondering whether this style is necessary as it seems to only have an effect on printing, not on viewing on screen.

In reply to N Hansen

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello,
I have uploaded a new version to CVS/contrib
This version should be Moodle 1.7 compatible and support global feedback
Also new in this version is the fact that backup method is included so when you backup a quiz dragdrop questions are included in the backup.
Unfortunately, as backup restore is a brand new area for me, I am not very productive and the restore method is not finished.
I hope to be able to finish it in the first january week.
I had never noticed the printing problem but unfortunately I can confirm it.
Can some CSS guru explain to me why hidden visibility is used here ?

In reply to Jean-Michel Védrine

Re: Drag and Drop 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
Great, thank you very much for doing that.

If you tell me where to look in which CSS file, I will see if I can explain.

I have some bad news for you, which is that the question type interface is going to change again in Moodle 1.8. There are a few reasons for this.

  1. There is a new library for creating editing forms in 1.8. It lets you create forms that work better for the user, and they are also nicer to work with as a programmer. So I am going to have to change how question editing works.
  2. I have had a good idea that will massively reduce the amount of code you have to write to make a new question type. Most question types have very similar code to do the boring stuff like backup and restore, and loading and saving questions to the database, and I have thought of a way for most of the hard work can be done in the base class, so people writing question types can concentrate on the interesting bits.
  3. Finally, and sadly, very few people have written question types so far, so I feel justified in changing the question type interface to make it easier for people who will make question types in future, even though it makes more work for those who have already made question types - even though people who have made question types deserve all the encouragement they can get.
In reply to Tim Hunt

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello Tim,
I will look in the code where are the styles used and report here so that you can look at it.
Evolving with Moodle is not a problem for me and i would certainly not vote to freeze questiontype APi as it is now !
But please can you look at the dragdrop questiontype before making your changes so that there is a way for me to upgrade my code
  • dragdrop use quite a lot of tables to store its data, countrary to core questionstypes, be sure questionstypes authors aren't restained to do so.
  • dragdrop use several screens (and forms) during question creation. this is because we not only have to enter data in fields but also to define each image's place and each hotspot rectangle. Be sure the way entering questions is done in 1.8 don't prevent that.
  • Of course I would prefer to be able to install the dragdrop questiontype without modifying core files as it is now !!

In reply to Jean-Michel Védrine

Re: Drag and Drop 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
Actually, I have just realised that the changes I have made so far will not break questions that work in 1.7. They will just provide new and better ways of doing some things, which questions can either use or not. Some time after 1.8 is released, I will take out support for old-style question editing forms, becuase that will simplify the code, but I will leave support there in 1.8, so there is plenty of time to change the question types.

About storing stuff in the database: The new stuff is entirely optional. Question types still have complete freedom. It will just be the case that if the question type does not need anything complicated, it can use some new helper functions to do everthing in a few lines of code, rather than having to re-implement it all itself.

About forms. One of the features claimed for the new forms library is the ability to handle multi-page forms nicely. However, I have not experimented with this yet. So far, I have only done a couple of single-page forms, and for those, it is really nice.

I would like to make further changes to the API so that question types can be installed without touching any core files. I am tracking this by linking relevant issues to MDL-2727. If you think I am missing anything there, please let me know. I'm afraid 2727 is a long-term goal. Don't hold your breath.
In reply to Tim Hunt

Re: Drag and Drop Question

by N Hansen -
The source of the printing problem appears to be on line 626 of the file wz_dragdrop.js. There's just too many obscure abbreviations in that file for me to figure out what it is supposed to apply to (or maybe it's just javascript!).
In reply to Tim Hunt

Re: Drag and Drop Question

by Pierre Pichet -
Hi Tim,
OK for the changes as long as you allow for complex questions like the calculated ones with there datasets and dataitemssmile
Perhaps you could start another thread on the quiz to explain more completely your plans although you mentioned some of them before.
Don't forget that I need a special interface for calculated question even in the "standard" part of the question. You said before that the new code for this "standard" part could be somewhat intercepted and modified before display. I imagine that there will be clear indications of how to insert additional items like the display of common category datasets already created.

Pierre

In reply to Pierre Pichet

Re: Drag and Drop 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
All the sorts of things you want will be possible, but I don't really have time to document the new forms library, and anyway, I don't need to because the people working on it have: http://docs.moodle.org/en/Development:lib/formslib.php (remember both the code and docs are work in progress). Note that this is build on top of the HTML Quickform library http://pear.php.net/package/HTML_QuickForm/. So there are tutorials out there on the web which Google will find for you.
In reply to Tim Hunt

Re: Drag and Drop Question

by Pierre Pichet -
Thanks
and back to work in 2007...

Pierre
P.S. I will have to find how to improve the 1.6.3 which will be the version used by UQÀM in fall 2007 and winter 2008 and follow the improvements of 1.8-2.0 versions.


In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello,
Unfortunately I must report that the first version of dragdrop questiontype updated for Moodle 1.7 wasn't working because 4 lines of code were unexpectably missing from the ditquestion.html file.
I have uploaded a corrected version to CVS.
so if you have already downloaded this version, please download a corrected one before trying to test it !
Also I have enabled other media types (flash, quicktime, video, ...) than images but not fully tested this new feature (the code to handle other media types was already there, thanks to Brian King, but only images were selectable from the drop down menus)
Please test and report.
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Steve Bilton -
Hi Jean-Michel,

I am using moodle 1.6.3, I downloaded the drag & drop module fresh today.

I have made the changes specified in the readme.txt.
tables are created fine and everything seems as it will work until .....

When i create a new quiz then 'create new question' --> 'Drag & Drop' ,moodle takes me to the editing page.....

but

before the page is loaded correcly it spits out this error:
Fatal error: Call to undefined function: print_question_form_start() in /srv/www/vhosts/mysite.com/httpdocs/student/question/type/dragdrop/editquestion.html on line 2

I'm pretty sure i've done everything correctly as stated in the readme.txt

Can you help me in fixing this problem please, i'd be very greatful.

Perhaps i'm missing something simple - do you know what might cause this error?

Many Thanks

Steve B
In reply to Steve Bilton

Re: Drag and Drop Question

by Steve Bilton -
Hello

Regarding my previous post - To test what the problem could be to get my previous error:

Fatal error: Call to undefined function: print_question_form_start() in /srv/www/vhosts/mysite.com/httpdocs/student/question/type/dragdrop/editquestion.html on line 2

I deleted the first part of the html document between <?php and ?> from first 10 lines which contained:
$QTYPES[$question->qtype]->print_question_form_start($question, array(),$course, $usehtmleditor,
array('image'));

(and a little bit more code aswell)

and i takes me to the editing form - GREAT! but the 'save changes', 'position the hotspots', 'All done continue' and 'cancel' buttons don't work.

I then simply put only this part of the php code back in the editquestion.html
$QTYPES[$question->qtype]->print_question_form_start($question, array(),$course, $usehtmleditor,
array('image'));

with out any of the extra code below it and closed the php ?>

I get the same error, its asif it doesn't recognise the 'print_question_form_start' or something as i've also removed some of the code in brackets i.e i removed everything but ($question) ---> still the same error

I've tried many ways to test the problem, I even changed the part '->print_question_form_start' to '->print_question_form_end'.

Which lets you onto the edit page but then none of the buttons are working yet again.

So why does the '->print_question_form_start' not work and kick out the undeclared call to function error?

Help would be mucho appriciated

Steve B
In reply to Steve Bilton

Re: Drag and Drop 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
That missing function only exists in Moodle 1.7.

The new version of the drag and drop question that Jean-Michel made is only compatible with Moodle 1.7 and later. If you are using Moodle 1.6.x you need to get the old, 1.6-compatible version of this question type.
In reply to Tim Hunt

Re: Drag and Drop Question

by Jean-Michel Védrine -
Yes this is obviously a problem with the "Modules and plugins" Moodle section : only the last version is available on Download directly from the CVS.
If you know how to use a CVS client like turtoise, you can of course retreive any version but as not all Moodle users are familiar with CVS use, I will zip the last 1.6 version and put it here in that thread.
Was any 1.7 user brave enought to test this version ?
Also Tim did you know how I can request some changes and additions to the page in Modules and plugins about dragdrop (and also the detailed responses quiz report plugin !) ?

In reply to Jean-Michel Védrine

Re: Drag and Drop 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
Quite high on Martin D's list is sorting out the contrib area of CVS, and the download building system, so that it can cope with multiple versions like this. The only problem is that it keeps getting nudged aside by even more important work. Anyway, that problem will be solved eventually.

If you created an entry in the Modules and plugins database, you can edit it yourself. In this case, someone helfully created the entries about your plugins for you. I don't know if these entries can be re-attributed to you, then you can edit them yourself. I think you need to message Martin through Moodle's messaing interface, and ask him.
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Steve Bilton -
Hi Jean-Michel,

I took your advice and managed to figure out CVS. I downloaded a Drap & Drop version from the 23rd November 06, as i noticed you posted you were working on the new 1.7 compatible version on the 13th? December.

So Drap & Drop works ok now with one rather large problem.
When the test has been attempted and compeleted, no score is given as a result, i.e. gives a score of zero.

Is there a way round this? Do i have to get another version of DD from CVS? If i do could you please tell me which date would be the best to download from. I'm using Moodle 1.6.3.

Thanks for your help.

Steve B
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Guy Broster -
"I will zip the last 1.6 version and put it here in that thread."

here in what thread? I have no idea what you mean by this and am having problems locating the last 1.6 version? Can you help me locate this zip file Jean-Michel?

Thanks
In reply to Guy Broster

Re: Drag and Drop Question

by Jean-Michel Védrine -
Oops, sorry, I forgot about that rouge !!
Here it is. I hope I didn't missed anything in extracting an old version from CVS.
The only thing I changed from the 1.6 version downloadable before I started to upgrade thsi questiontype for Moodle 1.7 is that I have included the latest version of Walter Zorn javascript dragdrop library because it include many bugfixes.
Warning to other users coming to this thread : I repeat that this file is for Moodle 1.6x only !! If you are using Moodle 1.7x, read the other messages in this discussion and you will learn where you can download the 1.7 version !!
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Guy Broster -
Ahh...many thanks for that! I thought I was being extremely dim, or losing my mind. I considered using CVS, but to be fair didn't really know what I was doing so decided to avoid spending many wasted hours achieving nothing.

I'll be using this in my new Moodle set-up I am using on a teaching practice as a trainee teacher. My research project is based around the effectiveness of using a VLE for assessment in ICT and every quiz type I can use will come in handy.

Thanks again.
In reply to Guy Broster

Re: Drag and Drop Question

by Steve Bilton -
Ah HA!

I knew it wasn't me being stupid!

Thanks for the working Drag & Drop for 1.6


Many Thanks!

Steve B
SHEilds Ltd
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Rorschach Vision -
Jean thanks for your 1.7 updates. The drag & drop activity works in Firefox, but is totally unusable in internet explorer.

I'm attaching a zip file with an image of the problem, and the code where the error is happening.

It looks like the dhtml is using 'absolute positioning' and not 'relative', although I'm not totally sure. Also the pics have all disappeared but they do appear in the 'source code' which I'm attaching in another reply post.

Any ideas? sad
Attachment drag_drop_msie_error.jpg
In reply to Rorschach Vision

Re: Drag and Drop Question

by Rorschach Vision -
Preview output of the drag/drop positioning error.
In reply to Rorschach Vision

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello,
Unfortunately, I am unable to reproduce your problem.
I tested D&D questions with IE6, IE7 and Firefox with no problem both in taking the quiz and viewing the solutions.
Hundreds of my students have taken quizes with D&D questions and I suppose various browsers (these quizes were practice quizes so attempted at their home).
Nobody reported any odd behavior.
Did you tested that on several computers ?

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Rorschach Vision -
Thanks for that confirmation Jean-Michel. With your clarification that 1.7 is 100% working, I realised that I had find the only thing different between your install and mine, which was the theme.

I've changed it from the clouds theme to the standard, and now it works perfecto! big grin Cheers mate!
In reply to john Imbt

Re: Other projekt of Drag and Drop Question?

by Jürg Hoerner -

Mediagonal made   drag and drop question. Is this not the same Drag and Drop Question?

Which one would become a standard of moodle quiz?

http://opensource.mediagonal.ch/moodle/patches/qti-export/

In reply to Jürg Hoerner

Re: Other projekt of Drag and Drop Question?

by Jean-Michel Védrine -
Brian King from Mediagonal is the Drag and Drop questiontype"s author.
Brian's code was written for Moodle 1.5x
Gustav Delius and myself just ported this work to Moodle 1.6 wich was necessary because questions are now separated from quiz (and can be used by other modules).
For the moment this is just a contribution and not a standard questiontype.
I started working on it because I think it's a wonderfull addition to quizes and very interesting for a lot of teachers.
Re-reading the readme.txt file I realize it is not apparent who is the questiontype's author so I will modify it to give Brian due credit.
In reply to Jean-Michel Védrine

Re: Other projekt of Drag and Drop Question?

by Urs Hunkler -
Picture of Core developers

The Drag and Drop Question type is great and as I see from a short test it works with the actual Moodle 1.6.1.

I try to use flash movies as drag objects, but swf files do not show in the selection list. Looking at the source code shows me, that not only images but also media files like swf, mpeg, avi etc. seam to be supported. I searched for the filter, which throws swf files out. I had no success.

Can someone please tell me why media files are disabled and if I can enable them?

Thank you very much for your help
Urs

In reply to john Imbt

Re: Drag and Drop Question

by Peter Kupfer -
I am trying to use the question type in 1.8 and when I click position the hot spots it just returns me to the edit quiz page. Am I doing something wrong?
In reply to Peter Kupfer

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello,
The difficult thing is that all the servers I know are still using Moodle 1.7 so all 1.8 developpment of the drag&drop questiontype have only been tested on my developpment server.
Does anybody else have the same problem ?
Anyway I will try to install a fresh Moodle 1.8 and test to see if I can reproduce your problem.

In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Vernon Spain -
Picture of Plugin developers Picture of Testers

Having the same issue after upgrade to 1.8 with drag n drop. Drops me right out to the question creation area.

Previously created questions wont allow you to drag and show the pics as firmly fixed in place.

Cheers,

Vernon

In reply to Vernon Spain

Re: Drag and Drop Question

by Vernon Spain -
Picture of Plugin developers Picture of Testers
Problem solved.
Just do the full reinstall procedure for the Drag n Drop installation. The files and updates don't survive the upgrade.

V
In reply to Vernon Spain

Re: Drag and Drop Question

by Deleted user -
Unfortunately this didn't work for me. I had a fresh 1.8 Installation and followed the installation instruction precisely.
I have the some bug as Peter has.

As a workaround I entered the coordinates and dimension for the hotspots directly in the firstpage, but this can be quite annoying over a long period of time smile
In reply to Deleted user

Drag and Drop Question

by Nic Freeman -
I am using windows 2000 and Moodle 1.7.1+, PHP 5.2.0 and mysql  5.0.27. I can create drag and drop questions, I can preview the questions after creating them and they work fine, images drag and drop and when you click submit it marks it correctly, but when you try to attempt the quiz either as a student or in teacher role the drag and drop question displays properly but will not actually drag and drop. I have followed the instructions to install the question properly (as far as I can tell). Can any one advise on how to fix this problem?
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by elena caldirola -
Hi Jean-Michel,
same problem as Peter.
I've a fresh Moodle 1.8 installation (NO upgrade from 1.7).
I've also tried to re-install entire D&D module, but no way.

Some suggestions...?
Thank you
Elena
In reply to elena caldirola

Re: Drag and Drop Question

by Jean-Michel Védrine -
Here are some things you can try to diagnoze draganddrop question type problems :
  1. Were the DD tables correctly created at installation ?
    Check you database, you shoud see 3 tables :
    • question_dragdrop
    • question_dragdrop_hotspot
    • question_dragdrop_media
  2. Is the javascript library correctly included in the page ?
    For instance suppose you can't drag and drop items during a teacher or student attempt. Use your browser to navigate to the quiz and start an attempt. When the DD question is displayed on the page and not working, display the html page sourcecode in your browser and verify that the line :
    <script type="text/javascript" src="http://your_moodle_website_url/question/type/dragdrop/wz_dragdrop.js"></script>
    appear near the end of the page
  3. is the javascript code correctly created for the page ?
    Just after the previous line you should see :
    <script language="JavaScript">
    (or
    <script language="text/javascript">
    in recent drag and drop versions) then some lines of javascript code then
    </script>
For instance here is the javascript generated for one of my quizes with a drag and drop question on the page :
<script language="JavaScript">
SET_DHTML(CURSOR_MOVE, RESIZABLE, SCROLL, "background11"+NO_DRAG, "gapimage1_0", "container1_0", "gapimage1_1", "container1_1", "gapimage1_2", "container1_2", "gapimage1_3", "container1_3");
dd.elements.container1_0.formId = 'resp32_12';
dd.elements.container1_0.setResizable(false);
dd.elements.container1_0.background="background11";
dd.elements.gapimage1_0.positioned = 0;
dd.elements.container1_0.mainchild = dd.elements.gapimage1_0;
dd.elements.container1_1.formId = 'resp32_13';
dd.elements.container1_1.setResizable(false);
dd.elements.container1_1.background="background11";
dd.elements.gapimage1_1.positioned = 0;
dd.elements.container1_1.mainchild = dd.elements.gapimage1_1;
dd.elements.container1_2.formId = 'resp32_14';
dd.elements.container1_2.setResizable(false);
dd.elements.container1_2.background="background11";
dd.elements.gapimage1_2.positioned = 0;
dd.elements.container1_2.mainchild = dd.elements.gapimage1_2;
dd.elements.container1_3.formId = 'resp32_15';
dd.elements.container1_3.setResizable(false);
dd.elements.container1_3.background="background11";
dd.elements.gapimage1_3.positioned = 0;
dd.elements.container1_3.mainchild = dd.elements.gapimage1_3;
dd.elements.background11.setZ(0);

 function set_all_form_values()
 {
 var length = containers.length;
 for (var i = 0; i < length; i++) {
 if (containers[i].mainchild.positioned) {
 set_form_values(containers[i].mainchild, false);
 set_form_values(containers[i].mainchild.hotspot, true);
 }
 }
 }

 function setValueById(id, val) {
 var obj = document.getElementById(id);
 obj.value = val;
 }

 //dd.elements.background11.setZ(0);

 // create the list of containers, so we don't need to search through all the elements every time
 //var containers = new Array(4);
 var containers = new Array();

 var j = 0;
 for (var i = 0; i < dd.elements.length; i++)
 {
 if (dd.elements[i].mainchild != null) {
 containers[j] = dd.elements[i];
 if (containers[j].mainchild.hotspot != null) {
 containers[j].mainchild.hotspot.hide();
 }
 containers[j].borderwidth = containers[j].mainchild.is_media ? 2 : 0;
 containers[j].resizeTo(containers[j].mainchild.w + 2*containers[j].borderwidth, containers[j].mainchild.h + 2*containers[j].borderwidth);
 containers[j].moveTo(containers[j].mainchild.x - containers[j].borderwidth, containers[j].mainchild.y - containers[j].borderwidth);
 containers[j].addChild(containers[j].mainchild);
 containers[j].mainchild.setZ(1);
 containers[j].mainchild.show();
 containers[j].setZ(2);
 j++;
 }
 }
 function isDefined(variable)
 {
 return typeof(window[variable]) == 'undefined' ? false : true;
 }
 //bk: to resolve overlib ie problem (causes dragged image to drop prematurely):
 //tip from: http://groups.yahoo.com/group/overlibmws/message/541
 if ((isDefined('OLie4') && OLie4) && (!isDefined('OLopr') || !OLopr)) document.Xonmousemove=null;

 function my_DropFunc()
 {
 if (dd.obj.mainchild != null) {
 var bg = dd.elements[dd.obj.background];
 var fieldvalue = (dd.obj.mainchild.x - bg.x) + ',' + (dd.obj.mainchild.y - bg.y) + ',' + dd.obj.mainchild.w + ',' + dd.obj.mainchild.h;
 //eval(dd.obj.formfieldname + '.value = "' + fieldvalue + '"');
 setValueById(dd.obj.formId, fieldvalue);
 }
 }

</script>
Your javascript code will not be the same (depending on how many images and hotspots in your DD question for instance) but it should look quite similar.
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Stéphane Goussault -
Hi,

Same problem as Peter with moodle 1.8.1+
When I click position the hot spots it just returns me to the edit quiz page.
My first installation with moodle 1.7 worked very well.

Did someone succeed with Moodle 1.8.1 ?

Help will be appreciate because i need this plugin.

Stephane
In reply to Stéphane Goussault

Re: Drag and Drop Question

by S Santos -
Same problem here.

I have 1.8.2 and drag and drop stopped working when upgrading from 1.7.

When I click position the hot spots it just returns me to the edit quiz page.

Any new version?
In reply to S Santos

Re: Drag and Drop Question

by Ray Lawrence -
Plans to introduce a drag and drop question are underway here.
In reply to Ray Lawrence

Re: Drag and Drop Question

by S Santos -
Thanks a lot. But what about my old questions created with the other tool? I am not able to upgrade or modify them anymore... sad.

Besides, the ddmatch needs the most most most latest version of moodle...
In reply to Ray Lawrence

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello Ray,
The DDmatching question about to be introduced in core is another story.
This 2 questiontypes doesn't serve the same pupose at all. The one we are speaking about in this thread permit a lot of things you can't do with DDmatching.
Unfortunately it's code is much more complex and I am rather alone to maintain it.
As there have been several reports of problems with Moodle 1.8x I need to investigate.
Unfortunately I can't convert it to use the same javascript library as DDmatching and order because I need several functions not (yet ?) available in this library.
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Ray Lawrence -
Hi Jean-Michel,

Ok, thanks. Best wishes with the continuing development of this question type.
In reply to S Santos

Re: Drag and Drop Question

by Jean-Michel Védrine -
Beware ! When you upgrade Moodle you have to redo all the files modifications as if it was a new install of the DD questiontype !! This is because the old modified files are overwritten during Moodle upgrade.
If you have redone all the procedure then I don't understand why it is not working.
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by S Santos -
Modifications are done... in fact, old exercices work perfectly, but I can not create new or edit old ones.
In reply to S Santos

Re: Drag and Drop Question

by Jean-Michel Védrine -
I just installed a Moodle 1.8.2+ test site and you are right there is a problem that wasn't there when I tested the dragdrop questiontype with Moodle 1.8 some time ago.
To correct the problem open the question/type/dragdrop/editquestion.html file and change the line near the end of the file from:
<input type="submit" value="<?php print_string('hotspotspecify', 'qtype_dragdrop') ?>" onClick="document.theform.arrange.value='true'" />
to :
<input type="submit" value="<?php print_string('hotspotspecify', 'qtype_dragdrop') ?>" onClick="document.forms['theform'].arrange.value='true'" />
(precisely you only need to change theform to forms['theform'])
This should correct the problem.
Please report any other issues with Moodle 1.8.2+
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by S Santos -

Great.. that made it work!

Thanks. I will.

In reply to Jean-Michel Védrine

Ang: Re: Drag and Drop Question

by Brian Hahn -

I have just installed Moodle 1.8.2+, inserted dragdrop as descriped in readme.txt and also made the change in editquestion.html.

I haved tried to follow the tutorial:

When I press "Position the hotspots" I get the error:
"Could not insert dragdrop background media!"

The image is a jpg-file size 505x399

When I continue, I leave the question, and when I edit it again the textfields in the start are ok, but non of the selected pictures are selected any more. They are still in the files to be selected again and I can use the pictures in other questions as normal figures together with text.

I'm using the latest version of xampp as local host.

Please help me. I really want to use this feature.

In reply to Brian Hahn

Re: Ang: Re: Drag and Drop Question

by Patrick Gosetti-Murrayjohn -
Same problem here, same Moodle version. I see below that your devel environment is now 1.9beta -- does that mean that support for this question type will skip right over 1.8.2?

If anyone else has this working in 1.8.2 -- or at least doesn't get the "Could not insert dragdrop background media!" error -- could I ask for guesses about why it might work? (a particular image size, format, file size? a particular sequence to creating the question? a particular song playing in the background? smile )

Thanks much.
In reply to Patrick Gosetti-Murrayjohn

Re: Ang: Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello Patrick and Brian,
I have not skipped Moodle 1.8.2+ at all I did the last bugfix on August the 6th in response to Markus (see my message in that thread, unfortunately as I was on summer holidays I was unable to commit this fix to CVS at that date but it is now done, so downloading the latest version from CVS should give you a version of dragdrop working with Moodle 1.8.2+)
After that fix I was thinking that all was working fine for the dragdrop questiontype under Moodle 1.8.2+
Maybe there is another problem now, I will check again.
Fortunately Moodle 1.8.x is not a big deal for questiontype coders, you only need to do small adjustments if your code was running fine with Modle 1.7 to make it Moodle 1.8.x compatible
So I will continue to support the dragdrop questiontype with Moodle 1.7 and 1.8 correcting bugs when they are reported to me (of course if I manage to reproduce them !)
But Moodle 1.9 is another story and I need to rewrite parts of the code so that dragdrop users can still use their dragdrop questions when they upgrade to 1.9.
I am also more and more thinking that it would be better if dragdrop could use the same javascript libraries used by other wonderfull questiontypes released this summer but it will require quite a lot of work.
In reply to Jean-Michel Védrine

Re: Ang: Re: Drag and Drop Question

by Patrick Gosetti-Murrayjohn -
Outstanding! Thanks so much! I'll give it a whirl.

We're just starting to explore Moodle at my institution (University of Mary Washington) and starting with 1.8.2---I hope to get a handle on the coding structures and conventions as quickly as I can...I'm mostly at a coding-skill level of doing quick (and sometimes dirty) hacks, up to now with Wordpress and Drupal, but can't wait to dive into Moodle, too.

Thanks again
In reply to Patrick Gosetti-Murrayjohn

Re: Ang: Re: Drag and Drop Question

by Patrick Gosetti-Murrayjohn -
Alas, no dice with the CVS version....is there a part of the code that I could dig into on my end to try to hunt down the source of the error?
In reply to Jean-Michel Védrine

Re: Ang: Re: Drag and Drop Question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Jean-Michel > I am also more and more thinking that it would be better if dragdrop could use the same javascript libraries used by other wonderfull questiontypes released this summer

I agreeapprove

... but it will require quite a lot of work.

That's true.sad

Joseph

PS.- Bonne rentrée!

In reply to Jean-Michel Védrine

Re: Ang: Re: Drag and Drop Question

by N Hansen -
I just upgraded to 1.6.5 from 1.6 and upgraded drag and drop in the process. The language strings aren't showing up. Where should qtype_dragdrop.php be placed?
In reply to Jean-Michel Védrine

Re: Drag and Drop Question

by Markus Knierim -
Hello Jean-Michael,

Thanks for your quick fix to this problem smile

I just discovered, though, that drag and drop questions will only work if the quiz is delivered in a non-secure window. Is this a known limitation?

Cheers,
Markus
In reply to Markus Knierim

Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello Markus,
In fact I never use quizes in "secure" window. I don't even remember if I tested the drag and drop questiontype in a secure window.
But I did tested it this afternoon on my Moodle 1.7+ production site and, to my surprise it does work !!!
I can't test it with Moodle 1.8x version because my developpment website is 1.9beta (I am trying to upgrade renderedmatch and draganddrop questiontypes for Moodle 1.9 because they are no more working with that release)
So either something has changed in the secure window feature between Moodle 1.8 and Moodle 1.9
Or another possibility is that it works on my website because on this site I use a code slightly different from the one given in the README :
In each of the files mod/quiz/attempt.php and mod/quiz/review.php, rather than changing the lines :
 if (empty($popup)) {
 print_footer($course);
 }
to:
 if (empty($popup)) {
 put_dragdrop_javascript();
 print_footer($course);
 }
I now change these lines to :
 put_dragdrop_javascript();
 if (empty($popup)) {
 print_footer($course);
 }
As you see the only diffrence is the place where the put_dragdrop_javascript(); line is added.
You can try this change to see if it work better.
In any case I will test on Moodle 1.8.2+ as soon as I can.
In reply to Jean-Michel Védrine

Tárgy: Re: Drag and Drop Question

by Deni Nagy -
Dear Jean Michel,

I'm trying to set up Drag&drop type for a moodle 1.9.

Please help me what parametres shall I specify for the MySQL tables in the PhpMyadmin! The other steps seems to be OK to me.


Thanks in advance!
Deni
In reply to Deni Nagy

Re: Tárgy: Re: Drag and Drop Question

by Jean-Michel Védrine -
Hello,
As long as you have a correct question/type/dragdrop/db/install.xml file there is no problem with dragdrop questiontype tables creation and Moodle 1.9 : the tables are created when you visit Moodle administration. There is no need to use phpMyAdmin (tested with MySQL 4 and 5)
You can find the correct install.xml in contrib CVS
The current code of the dragdrop is not entirely compatible with Moodle 1.9 : your existing dragdrop question continue to work and are correctly graded but You can't create new ones or edit the existing ones.
To correct this problem I need to write a new question/type/dragdrop/edit_dragdrop_form.php file to replace the old question/type/dragdrop/editquestion.php and question/type/dragdrop/editquestion.html
I have started this task and the code is somewhat working but :
- it needs further tests
- the appearance on screeen is not good
- I need to verify there is no problem with roles and the modifications made in 1.9 to the question bank.
If you have a test install of Moodle 1.9 and want to help I can send you this beta version so that you can report the bugs you found.
But you should not use it yet on a production server (particulary if you have a lot of existing dragdrop questions) because I don't want to be responsable of any question loss.

In reply to Jean-Michel Védrine

Re: Tárgy: Re: Drag and Drop Question

by Christophe Leville -
Hi!
I actually downloaded 1.9 because I read on the D&D's page that it requires Moodle 1.9 or later. It looks like it can be used with other moodle's versions though, which one may I use?

thanks
In reply to Jean-Michel Védrine

Re: Tárgy: Re: Drag and Drop Question

by Susanne Höfer -

hi

this is an old thread, I know, but I have a problem with this question type. I really like it very much but it shows no red or green borders around right or wrong answers. Do you have an idea why? Where can I realize this?