Bug in Moodle ? (and some... productive critisism!)

Hi to all and greetings from Greece!

I am trying to develop a content type for a quiz game I need for my BA in CS dissertation. After a LOT of trial and error I managed to make a Greeting Card. I am emphasizing on A LOT cause there are some problems with the tutorial provided. I'll explain:

- First of all, if you download the greeting-card-with-task.h5p provided on the tutorial page and try to upload it either on moodle or on drupal then you get  a "Validating package failed" message cause there is no content folder or h5p.json file in it.

- If I add those according to the instructions provided on Package Definition page, the respective libraries needed are missing (Multiple Choice and Blanks)

- If I try to add the libraries via the CLI as instructed here -->https://www.youtube.com/watch?v=uLDxBH5osF0&t=1816s using the h5p get command, the downloaded folders contain a lot of files not supported (mainly the files in the .git folders) and therefore, I can't upload the greeting card.

- If I remove the unsupported files and try to upload it again, guess what... there are problems with the version numbers (and I am sure I have typed them right).

The only way I managed to upload the content type was by downloading some course presentations created by BV52 (thank you!) and getting ALL the libraries from there. However, when I upload it to my local moodle 3.3 site, it doesn't show the Fill in the Blanks or the Multiple Choice modules. Only on Drupal 7 it is showing fine.

Is this a bug in moodle's plugin? I am attaching the greeting-with-task.h5p that work on Drupal but not in moodle

____

PS.1: I believe there has to be another way to incorporate the dependencies (and the dependencies of the dependencies). If there is and I was blind, please, guide me to the right way.

PS.2: The video mentioned above is the ONLY video I could find giving some decent guidelines on how to start working on developing a content type but I understand it is outdated (its from a webinar in 2015). However, a big thank you to Pal Jorgensen (I believe he was the instructor) from the bottom of my heart! It is really sad to discover that there are dozens of videos on showcasing the use of the existing content types (which are more or less pretty straightforward) but not a single video or even a How-to document for someone who wants to code. For example, I am trying to understand how to incorporate the textual question editor from Multiple Choice in Quiz (Question Set) for Single Choice Set or incorporate the audio feedback and aesthetics from Single Choice Set for correct/wrong answers on Multiple Choice and... I am drowning in a sea of code!

Don't get me wrong; I am not bitching. I honestly think H5P is a great tool and sincerely, you deserve bravo for your creation. However, I get the feeling that it has a steep learning curve and only an experienced programmer can get his/her hands on developing and this is dissapointing for others like me (yes, I am newb in js!). I believe that, unless you want to keep development somehow obscure, by providing some up-to date guides/examples on it like the afomentioned video, the community will soon become huge!

thomasmars's picture

Hi,
I'm excited that you've tried your hands on some H5P development, sorry to see that this has proved difficult, but I hope you'll keep at it and I'll look forward to see how your content type turns out. 

The H5P development documentation is definitely lacking at the moment, and I hope we'll be able to improve them significantly in the near future.

For you feedback:
1) I assume this file is from the "Hello World - using other libraries" tutorial, and it is there to illustrate how to make a library that uses other libraries. The file is just a library, not content, like you pointed out, so it must be uploaded through the library administration page: https://h5p.org/library-administration. I can see that .h5p files with and without content can be difficult to separate between, I think we should emphasize the difference and point it out in the tutorial.

 2) When the tutorial added library dependencies those have to be already installed on your platform or included in the .h5p package for the package to be valid. You can get a working content example from https://h5p.org/node/885 as linked to at the bottom of the Hello world tutorial page.

 3) That video is quite outdated, not sure if it is relevant any more, but you should be able to use "h5p pack <package>" to create a .h5p package with the libraries from a github repository with only the valid and required library files. 

4) I'm not sure about why you're getting version number problems, I would have to look at the repository or .h5p package you've created to verify what is wrong. Make sure the repositories are up to date by using "git pull" or "h5p pull".

I don't think this is a bug in Moodle, I think this is a combination of a bloated .h5p package and preinstalled dependencies in the different environments. The .h5p file is bloated with dependencies that are not required and the content.json file does not match the semantics.json structure of Greeting Card, I assume this is part of the reason why it is not working. I suggest uploading the content example from https://h5p.org/node/885 and working your way from there.

 PS1) Typically you would use the Content Type Hub (https://h5p.org/hub-docs/getting-started) to download the content types you want before starting development, this will take care of all dependencies between content types for you. Then you can start to create your own content types that has dependencies to other content types. If you're just starting with H5P development I would suggest trying to make a library that has no dependencies work first.

PS2) I'm sorry about this, the documentation is not as good as it should be and not enough up to date. I have created an issue in the H5P issue tracker ( https://h5ptechnology.atlassian.net/browse/HFP-1966 ) for improving the development documentation, but we have limited resources, so I'm not sure when we'll be able to prioritize this. I hope that the community will come together and help us with the documentation here.

You're welcome to submit suggestions for changes or complete tutorials that you think would've helped you in this situation or you think can help future H5P developers.

Thank you for pointing out these limitations, we'll definitely look into improving our documentation in the near future, it is a very important part of getting more developers interested in making new content types.

Best regards, Thomas.

Hi Thomas! Thanks a lot for your reply and for creating an issue in the tracker. I hope somebody will bother to make an updated webinar on developing. 

I am still having issues on including other libraries. I made another attempt with the attached h5p (greet-with-task-2-4.h5p) which I believe is not bloated. If I upload it in Drupal 7 it works fine (it shows the image, the greeting and the task chooser (fill in the blanks or multiple choice). However, if I upload in moodle 3.4 or here in my h5p account, it shows no task. I can't find out what goes wrong and how to resolve it. I would very much appreciate it if you or someone else verifies this and explain to me what is the problem and how to fix it. It will be much appreciated if there is a link with a similar package (has an image, a greeting and a task to choose from) that works on Moodle.

Another (new?) issue is in using the content example from https://h5p.org/node/885 and adding an el.json file in language folder for greek localization. The contents of el.json are:

{
  "semantics": [
    {
      "label": "Μύνημα χαιρετισμού",
      "default": "Γεια σου κόσμε!",
      "description": "Ο χαιρετισμός που εμφανίζεται στον τελικό χρήστη."
    },
    {
      "label": "Εικόνα κάρτας",
      "description": "Η εικόνα που εμφανίζεται στην κάρτα. Προαιρετική."
    }
  ]
}

The problem is that, in Drupal 7 it shows the localized label and description BUT NOT the localized default greeting and in moodle ignores localization (both moodle and drupal are using the official greek tranlations).

Any suggestions?

 

 

thomasmars's picture

Hi, I've had a closer look at the .h5p file you've created and found that the folder and content structure is not well defined. Images should be within the images folder within the content folder. I've fixed this and attached the fixed file to this post. Drupal allows this, but Moodle does not. I've tested the modified .h5p in both Drupal and Moodle and it works well.

The translations in "el.json" works just fine here. Be aware that default language texts will only show when you create new content, and the languages are stored in the database the first time the library is installed or when it is updated, so if you previously installed the library without the el language file it will not have registered it. In this case you have to either uninstall the content type and reinstall it or increase its patch version.

Hope that helps. Best regards, Thomas

Thomas, thanks a lot for your help. You are most helpful.

By increasing the patch version I was able to see the task and the greek translation with one small hiccup: It seems like it everything is translated EXCEPT the default message. I tried stating in greetingcard.js greeting: null thinking that this will make it read the el.json for the default greeting text but nothing changed. Any ideas why? (I am reattaching the corrected .h5p greet-with-task-2-4 - Corrected01.h5p  that includes el.json and the new greetingcard.js)

Another thing is that I don't know how to uninstall a content type (there's no such option in libraries settings' page in moodle). Am I missing something or that's how it works so far and the only option I have is by increasing the patch number?

Finally, is there any document that describes the content types' folders layout for moodle?

Best regards,

Rigo

PS: I hope I am not tiring you with my questions.

thomasmars's picture

Hi,

As stated, the default text will only be available when creating new content, not when uploading your existing content. Are you not able to see the default text when creating new content either ? You can check your database to see whether the language translation has been updated for el.json.

You can uninstall a content type in library administration, read more at https://h5p.org/library-administration. You may also enable developer mode if you're on Drupal 7, this will allow you to overwrite the libraries every time you upload them, which means you don't have to increase the minor version, you just have to upload the library, see https://h5p.org/development-environment for more info.

The H5P plugin for Moodle use the Moodle Data API, which stores files depending on hashing of the file name and content, so browsing these files directly is not easy. You can use their API for searching for content folders though.

Best regards, Thomas

Again, thank you very much for your help. I believe, any other question I have I'll post it at the content creation topic.

Best regards,

Rigo