Upload Hotpot file using drag and drop

Upload Hotpot file using drag and drop

by Florian Bayer -
Number of replies: 2

Hello!

I use HotPot exercises a lot for my students in Moodle. When I want to upload more exercises/files, it takes very long as I need to do for every single exercise a lot of steps: 1) click on “add an activity or resource”, 2)  scroll down, 3) click on “HotPot”, 4) click on “Add”, 5) drag and drop the file into “source file”, 6) click on “Save and return to course”. So if you want to upload 10 exercises, you have to do 60 steps.

Because of this I wanted to ask, if there is a faster way to upload the HotPot files; and maybe more files at once.

Would it be possible for the developers of the HotPot plugin to make it possible to upload the files dragging and dropping the files directly into the course? In the case of image files, it is also possible (see the image in the attachment): Moodle asks you after dropping the file:

“What do you want to do with the file '20160716_144406.jpg'?
Add media to course page
Create file resource”

If you drop a HotPot file on the course page, it is automatically included as a “file resource”: so it can be downloaded as a file by the students, but they can’t use it as an exercise. Would it be possible that Moodle asks also in the case of HotPot files, if you want to “create a file resource” or if you want to include it as an exercise? (Anyway Moodle takes the settings of the last exercise you created/changed if you don’t change anything manually)

 

This would help me to save a lot of time!

Attachment dragdrop.jpg
Average of ratings: -
In reply to Florian Bayer

Re: Upload Hotpot file using drag and drop

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hello Florian,
You ask an interesting question. Thank you!

I looked at the Moodle code, and discovered that it is possible!
For my future reference, I will note here that we need to add the following two functions to "mod/hotpot/lib.php":

  • hotpot_dndupload_register()
  • hotpot_dndupload_handle($uploadinfo)

For examples of how these functions operate, have a look at how the following modules handle drag-and-drop:

  • mod/page/lib.php
  • mod/folder/lib.php
  • mod/label/lib.php
  • mod/url/lib.php
  • mod/scorm/lib.php
  • mod/resource/lib.php

I don't know when I will be able to do this, but if you can find some funding, that will speed up the process.

Kins regards,
Gordon

In reply to Gordon Bateson

Re: Upload Hotpot file using drag and drop

by Florian Bayer -

Hello Gordon,

I'm glad that it would be possible to enable the drag and drop for HotPot files and I'm happy because of your fast and positive reaction.

(As I don't know a lot of PHP, I don't understand well the scripts...)

I can add a new entry for crowd funding on "https://moodle.org/mod/data/view.php?id=8090#_=_", if you mean this. But - although I don't think that it would be a lot of work to do - I don't know how much work it will be and which price to put...

Kind regards,
Florian

(P.S.: I'm new on this forum and still don't know well how everything works her. I just used the moodle of my school before.)