Conflicting anchors making mischief in QuizPort/JQuiz

Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Number of replies: 16
Hi Gordon,

I've run into a problem in JQuiz when I use Javascript "window.open" in the instructions div to create a link to a dictionary popup window, while at the same time including the flash MP3 player as an audio clue in a question.

Doing so creates a conflict such that neither the link nor the player appear; what's more, other elements on the page, such as the "Next" and "Previous" buttons and any linked images, also disappear.

Here are the anchors I'm trying to use:

  • In JQuiz instructions:
    <a onclick="//www.ldoceonline.com/', 'ldoce', 'width=635, height=450'); return false;" href="void(0)">Longman Online Dictionary</a>

I've tried combining these in other parts of my Moodle and they work fine together. It appears to be an issue in QuizPort.

Other possibly useful info: removing one element from the file will cause the other to appear. Plus, it only seems to be an issue when the Javascript tag is located in the instructions. If I put both elements in the question, they appear without a problem. Also, if I put them both in the instructions with the audio link FIRST, they both appear and function properly. Any idea what might be causing the problem? Jim

(Edited by Gordon Bateson - original submission Wednesday, 23 September 2009, 03:56 AM)

Average of ratings: -
In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Oops, sorry, I accidentally selected HTML format for that post.

The anchors I used were:

In JQuiz instructions:
<a href="javascript: void(0)" onclick="window.open('http://www.ldoceonline.com/', 'ldoce', 'width=635, height=450'); return false;">Longman Online Dictionary</a>

In JQuiz question:
<a href="http://mysite.net/file.php/1/audio/myaudio.mp3"></a>
In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Jim,
thanks for pointing this out. It was rather tricky to resolve, because I had to make a complicated pattern matching expression even more complex.

However, I think the QuizPort will now fix the problem you were having so please download the latest version of the software and see if it works better for you.
all the best
Gordon
In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Many thanks as always, Gordon.

Jim
In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Oops. There's a wrinkle, Gordon.

Now I'm getting a "Confirm navigation" notification when I answer a question correctly in JQuiz.

For example, in a JQuiz with 8 questions, on questions 2-7 I'm asked if I want to leave the page and told "Your results so far will be saved and you can redo 'Exercise X' later" after I input the correct response.




In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

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

looks like you have "Enable click reporting" set to "Yes" on that quiz. For a quick workaround please set "Enable click reporting" to "No" for all your quizzes. IN the meantime, I will think about how to fix things so that message doesn't appear at that time.

thanks
Gordon
In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Jim,
I think that wrinkle is fixed now too. Please update your QuizPort when you can:
many thanks again for reporting these issues. Please keep the feedback coming approve
Gordon
In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
I'm afraid something's seriously amiss, Gordon. I installed the latest update and now a lot of my QuizPort material has just stopped working. At first I noticed the MP3 player wasn't appearing, even in older quizzes that hadn't had problems before. Then, I noticed the JQuiz short-answer questions wouldn't allow me to check answers, and in JQuizzes with more than one M/C question, none of the questions appear. JMatch and JCross are also not working properly.

I tried to switch back to the previous version of QuizPort you provided yesterday, but am now have the same problems.

I turned on debugging/developer and selected "Display debugging messages," but there were no errors listed when I went into the broken quizzes and tried them.

This is happening in Firefox, IE, Safari and Chrome.

Please help!

In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Yikes, sorry about that little scare Jim. I had zipped up the wrong files. My apologies.

I have put the correct files in the zip download now, so please use install them when you next have the chance.

best regards
Gordon
In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Phew! Thank goodness. I thought I was a goner there for a moment.

Cheers, Gordon.
In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
> I thought I was a goner there for a moment

I was somewhat distraught myself. But I see you have installed the proper files now and are good to go!

By the way, on your site I tried the QuizPort called "ItDVL: Part I". I was intrigued how you have combined the JQuizzes and Camtasia training videos embedded in html files. The results are very effective and engaging. cool

I had one suggestion for the JQuiz files. You can get the audio player to start automatically if you do something like the following:
  • in the JQuiz file, locate the link to the mp3 file (Options -> Configure Output -> Titles/Intructions: Instructions)
    <a href="http://mywebsite/moodle/file.php/99/audio.mp3"></a>
  • Replace the above link with the following:
    [audio.mp3 moodle 0 0 waitForPlay=no autoPlay=yes]
  • Since "moodle" is the default player, I think you can leave it out, and the width and height values too, thus :
    [audio.mp3 waitForPlay=no autoPlay=yes]
  • Or if you want to enlarge the player a bit, try this:
    [audio.mp3 120 20 waitForPlay=no autoPlay=yes]
Then you will need to switch the "Use media player" setting on QuizPort's "Editing a quiz" page to use the QuizPort media player filter (see attached screenshot) ... and you're done.

Or you can just leave things as they are, and that'll work fine too approve

all the best
Gordon
Attachment quizport.mediafilter.png
In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Thanks for the tip, Gordon. Actually I'd been wondering how to do that with the audio player (not for this project but for another research-oriented application).

While we're on the subject, is there a way to:

*make the audio player invisible, so users only hear the file play automatically?
*delay automatic playback of the file for 1 or 2 seconds?
*configure the player so users can only hear the recording once?

Jim

In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

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

> make the audio player invisible, so users only hear the file play automatically?

Set the width and height each to 1. Like this:
[audio.mp3 1 1 waitForPlay=no autoPlay=yes]

> delay automatic playback of the file for 1 or 2 seconds?
> configure the player so users can only hear the recording once?

I don't think the standard Moodle player has this functionality, but there may be Flash based media players that do have the extra controls. If you find such a player, that is open-source and could be added to QuizPort, please let me know.

Be aware though, although the teacher requesting these features may be wanting to control the learning environment, tech-savvy students will often be able to locate the URL of the media file in the source of their web-page, download the mp3 file and listen to it to their heart's content.

A more effective strategy for controlling the learning environment might be to add a time limit to the *quiz*, and make sure the time limit gives students time to listen once to the sound file before the quiz disappears.

regards
Gordon
In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Gordon,

I'm having trouble getting the player to work using QuizPort's media filter. I've made the changes in the "Editing a quiz page" and put a bracketed link into the page as you suggested. Although the player appears in the right dimensions, it doesn't play the file. I tried taking out the auto-play instructions just in that was causing the problems, but still no dice.

Could it be a problem with the path? If my mp3 file is in a folder called "audio", should my path look like this?

[audio/audiofile.mp3 moodle 120 20]

Best,

Jim
In reply to Jim Ranalli

Re: Conflicting anchors making mischief in QuizPort/JQuiz

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

Hi Jim,

the path is relative to the quiz file, so if they are in the same folder it should be enough to just specify the audio file name. If all the audio files are in a subfolder fo the the folder containing the quizzes, then a path such as the one you gave in your example should do fine.

Anyway, if I may, I'll come and set one up on your site so you can see what I mean.

regards
Gordon

In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Jim,
I had another look at your site and realized that your audio paths are not relative to the quizzes. They are relative to the course files root. That's OK, we can handle that.

Although the default is for media files paths to be relative to the quiz file, you can also specify that paths are to be treated relative to the root of the course files folder.

For example, in the case of your "leisure" quiz, the player for the audio file can be inserted using the following [square bracket notation] :
  • [%coursefiles%/audio/somefolder/leisure.mp3]
QuizPort will replace "%coursefiles%" with the url to of the "Files" folder for your course.

If we add the size and auto-play switches then it becomes ...
  • [%coursefiles%/audio/somefolder/leisure.mp3 120 20 waitForPlay=no autoPlay=yes]
FYI, if you wanted to put all your media files into the site files folder, so they can be easily shared between courses, then you could use the "%sitefiles%" string like this:
  • [%sitefiles%/audio/somefolder/leisure.mp3]
And for your further delight, I have just added a "hide" switch, so that if you want to have the player be hidden and start automatically, you can use:
  • [%coursefiles%/audio/somefolder/leisure.mp3 hide]
The "hide" switch works by setting the width and height to 1, and for the Moodle player it will also set waitForPlay=no autoPlay=yes.

You will see I have added a quiz to your site "something_leisure.gordon.jqz" which is set up using the %coursefiles% technique.

have fun!
Gordon

P.S. The "hide" feature was added just now, so you will need to download the very latest QuizPort zip file to get it

In reply to Gordon Bateson

Re: Conflicting anchors making mischief in QuizPort/JQuiz

by Jim Ranalli -
Terrific stuff, Gordon. Thanks as always.

Jim