Modified HotPot activities as HTML?

Modified HotPot activities as HTML?

by Carly Born -
Number of replies: 12
We are doing some fairly extensive customization of Hot Potatoes templates for a particular prof and she wants to upload them to Moodle. I don't want to add the customizations to the HP templates on the Moodle server, since that would seemingly change the behaviors for anyone on campus using HP. So if we upload the HTML version of the HP exercises in the HP Module, does it still track the student work and grading as usual?

Is there any other way to deliver highly customized HP exercises over Moodle without changing the Moodle site template files?
Average of ratings: -
In reply to Carly Born

Re: Modified HotPot activities as HTML?

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
The htm file will still track the work if you upload in the usual way, yes.What kind of "highly customised" were you thinking of?
In reply to Mary Cooch

Re: Modified HotPot activities as HTML?

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Carly
welcome back smile

> if we upload the HTML version of the HP exercises in the HP Module,

> does it still track the student work and grading as usual?

Very probably. The important point is whether the customizations interfere with the javascript that collects results and sends them back to Moodle. Adding your own javascript and modifying the structure of html elements in the document will increase the chance of fatal interference, but the only way to know for sure is to try it and see.

> Is there any other way to deliver highly customized HP exercises
> over Moodle without changing the Moodle site template files?

Yes. I suggest, recommend and enthusiastically urge you to use QuizPort module, the successor to the HotPot module. You can create your own output formats. Each new output format can be use the standard template files, but you can substitute in as many of your own templates files as you like. Teachers will then be able to choose between the standard output formats and custom formats.

regards
Gordon
In reply to Gordon Bateson

Re: Modified HotPot activities as HTML?

by Carly Born -
Hi All!

Thanks for the suggestions, it occurred to me to just try to upload the HTML and so I see it working pretty well there.

We are making some modifications to the layout and the javascript, depending on what the prof is looking for. Some are simple layout changes, some are all out changes to the way the Javascript functions. The goal is to make it so the faculty can do all of the inputting of the exercise data using a familiar interface, but still get what they want. In all cases so far what they want isn't all that complicated.

@Gordon, Thanks! Good to be back.

I've been seeing the recent mention of QuizPort, and I've gotten a copy of the mod from a previous posting. Is there any other place of documentation, updates, etc that I should be looking at? Searched, but didn't find anything obvious. I'll see if I can get our Moodle admin to install it or let me install it.


In reply to Carly Born

Re: Modified HotPot activities as HTML?

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Carly,
  • the lastest version of QuizPort is available here.
  • The "Introduction to QuizPort" document is here.
all the best
Gordon
In reply to Gordon Bateson

Re: Modified HotPot activities as HTML?

by Denis Griffis -
Gordon,

I'm working with Carly on this, and have run into a few questions of my own (still plugging the HTML output of the quiz into Moodle). There are two main modifications requested by the relevant professor, neither of which work: namely, replacing the normal hint with an image, and revealing a hidden audio player when each question is answered correctly.

The audio player is a smallish problem: I want it to be invisible at the beginning of the exercise, but making every tag (inserted into the question line) associated with it to have visibility:hidden is completely ignored in the HotPot module.

The images have had some very strange behavior. A few of the images have been set as absolute links of slightly different formats, the rest as relative; all of them work when the page is opened as an HTML page from the files menu (in Moodle 1.9.2; in 1.9.5, to which we're switching in the coming year, I don't believe any of the relative links work), but none of the relative links work when the page is made into a HotPot exercise. Even more confusing, the three absolute links have varying numbers of backslashes before the relevant folder (...//Reading_Cyrillic/ vs. .../Reading_Cyrillic/ vs ...///Reading_Cyrillic), and behavior differs depending on in which version of Moodle the pictures being called are stored.

https://moodle.carleton.edu/course/view.php?id=12472 is a public course on Moodle 1.9.2, containing only the exercise in question, if you'd like to take a look. (Interestingly, when I logged in as a guest, none of the images worked at all.) I realize asking for help with this is a little crazy without giving you the actual files to look at--where can I upload them?

Thanks,
-Denis
In reply to Denis Griffis

Re: Modified HotPot activities as HTML?

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

Hi Denis,
of course I would love to teacher access to your Moodle courses and have a go at fixing up the HotPots, because I am sure all those urls and can be made to work as required.

If that's not possible though, please could you upload a sample HotPot to my server, so I can investigate:

thanks
Gordon

In reply to Gordon Bateson

Re: Modified HotPot activities as HTML?

by Denis Griffis -
Gordon,

The relevant files should be available to you on our servers, and they've also been uploaded to yours (under a folder of my name). There's a formatting_notes.txt file in there that's a description of what's been done so far, as well.

Also, the two alerts that come up when the hint button is clicked are 1) the URL of the image and 2) an indication that the ShowElements() function was run on the feedback.

Thanks,
-Denis
In reply to Denis Griffis

Re: Modified HotPot activities as HTML?

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Thanks Denis, I'll take a a look
Gordon
In reply to Gordon Bateson

Re: Modified HotPot activities as HTML?

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
I had a look at the second HotPot activity called "Reading Cryllic" that you created on my site.

The HotPot module can convert relative urls to absolute urls, but it needs to be told where to look. It has been told look for <img> <object> <script> and <style> tags, as well as url(...) used in stylesheets and window.open(...) used in javascript.

However, HotPot doesn't know anything about your PicsList array, so we will have to convert those urls ourself:
  • // HotPot module will convert the following relative URL to an absolute URL
    var img = '<img src="image.jpg" />';
    if (img=='<' + 'img src="image.jpg"' + ' />') {
    // not a Moodle site
    var filesroot = '';
    } else {
    // a Moodle site
    var i = img.indexOf('http');
    var ii = img.indexOf('image.jpg');
    var filesroot = img.substr(i, ii - i);
    }

    // prepend filesroot to convert relative urls to absolute urls on Moodle sites
    var PicsList=new Array();
    PicsList[0] = filesroot + "Reading_Cyrillic/mat.png"
You can hide all the media players, if you add the following javascript just before the </body> tag:
  • <script type="text/javascript">
    //<![CDATA[
    // hide all media players
    var obj = document.getElementsByTagName('object');
    for (var i in obj) {
    obj[i].style.display = 'none';
    }
    obj = null;
    //]]>
    </script>
Then you can reveal the player thus:
  • replace this:
    //Display relevant audio player
    var name = "Audio_Q_" + QNum;
    ShowElement(name);
  • with this:
    //Display relevant audio player
    var obj = document.getElementById('Q_' + QNum).getElementsByTagName('object');
    for (var i in obj) {
    obj[i].style.display = '';
    }
    obj = null;
I have modified the Reading Cryllic on my site to behave in this way, so please have a look to see the above code in action.

best regards
Gordon
In reply to Gordon Bateson

Re: Modified HotPot activities as HTML?

by Denis Griffis -
Gordon,

Thanks a lot. The audio players are working fine now, but there's still a problem with the images. The URLs are being constructed properly thanks to your code, but the ShowMessage() function still seems to be acting up, in that the image sometimes either doesn't load at all, or takes a long time/many tries to load. It happens both on your servers and on ours, and running both Windows and Mac, as well as Firefox and Chrome, so it doesn't seem to be an OS/browser problem. Do you know what's wrong with it?

-Denis
In reply to Denis Griffis

Re: Modified HotPot activities as HTML?

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

> the image sometimes either doesn't load at all
> or takes a long time/many tries to load

Oh dear, I have not had this happen to me. If yuo add the images to the PreloadImages function, I am sure you'll have no problem. Could you tell me one particular question, on the "Reading Cryllic" quiz I linked to earlier on which the Hint image did not appear for you.

-Gordon
In reply to Gordon Bateson

Re: Modified HotPot activities as HTML?

by Denis Griffis -
Gordon,

Thanks, that's just what I needed. Everything is working fine now.

-Denis