Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -
Number of replies: 27

Hi, everyone

I wonder if anyone has ever raised the captioned problem before. I'm using moodle 1.6+ on my production server. I prepared a hotpot JQuiz exercise, and have a long passage typed and added as a reading text. I then prepared 10 questions and output the file as htm format.

I opened the hotpot module in moodle, upload the htm file and try to run the test. When I click "Show all questions" button, the whole reading text is shown on the left hand side of the page in full length.

But when I use the "Show questions one by one" button, the reading text is only shown in similar height in accordance with the question on the right hand side.

The remaining bottom part of the reading passage disappears somehow except when the mouse is moved over two buttons: either the "Show all questions" or the "next question" buttons. The passage seems to re-appear in full length again only for a very short time.

I wonder if it is a bug and if it has been fixed or not. Thanks

Cheers

James

Average of ratings: -
In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

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

Hi James,

I wonder version of Hot Potatoes you used to make the quiz? In particular, was it version 6.2? Also, please could you tell us what browser you are using to view the quiz and whether the quiz behaves the same in a different browser.

Would it be possible for you to attach the quiz to a message to this forum?

thanks
Gordon

 

In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi Gordon

BTW, it also doesn't work with JMix.

The browser I'm using is the IE 6.0.29. Windows 2000 professional and Windows XP have been tested.

The hotpotato is Verion 6.2 Version 0 Build 8.

The htm file is attached and is okay when viewed alone, but

  • not okay when used with Moodle navigation bar
  • okay when used with Moodle navigation frame
  • also okay with embedded iframe
  • okay too with Hotpot quiz button
  • wow, okay with give up button
  • okay with "none"

For Firefox 2.0.0.4, all are okay.

That's all. Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Martin Holmes -
There is a newer version of HotPot, 6.2.0.9, which has an IE-related bugfix in it, but I don't think it's the cause of this problem. One thing you might try is turning the literal ampersands into escapes (& -> &), but again, I don't think that's the cause of this problem either.

Cheers,
Martin
In reply to Martin Holmes

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Thanks Martin, I'll try to install the upgrade later today.

Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi, I've installed the latest version of Hotpotato 6.2.0.9, and output a new htm file. Upload it to the moodle 1.6+ and configure the Moodle navigation bar.

The result is the same as before. The passage shows half the text page only.

Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
HI James,
I am investigating this report.

My understanding is that a long reading is cut off under the following circumstances:
  • JQuiz or JMix quiz is viewed via Moodle as a HotPot activity
  • HotPot navigation is set to "Moodle navigation bar"
  • HotPot is viewed using IE
I am testing the quiz here:
My hunch is that the Moodle styles are interfering with the behavior of the quiz.

Please could you make the jqz source file for this quiz available?

thanks
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi Gordon,

The URL is not working. Do you have a direct link for me?

Thx. James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

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

Gosh, silly me. Here's the correct URL:

cheers
Gordon

In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi, Gordon,

I've already uploaded the file as James' Comprehension.

From my computer using IE, I can still find the error. Thanks for your investigation.

Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Thank you James.
Please could you make the jqz source file for this quiz available?
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Martin Holmes -
Hi there,

I've tested this on IE7 and I don't have any problem with it; the whole reading displays just fine. What version of IE are you using?

Cheers,
Martin
In reply to Martin Holmes

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Yes, this is a curious thing. IE7 works fine thoughtful

As far as I can tell, the reading is only truncated by IE6. I'll try a few things to see if I can isolate the cause.

Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
It seems to come down to the <?xml version="1.0"?> tag at the top of the document. Moodle doesn't add this, which breaks the functionality of the HotPot.

That is why the quiz works when the navigation is anything other than "Moodle navigation bar".

So all that is required is to add the following line to the top of the document that Moodle sends out:
<?xml version"1.0"?>

I wonder if there is an easy way to do that ... yes there is surprise

The solution is to add the following line to the top of the "header.html" file in your theme (e.g. "theme/standard/header.html"):

<?php echo '<'.'?xml version"1.0"?>' ?>

It seems that IE6 is fussy about having this tag, whereas the other browsers can handle it not being there. Don't know why, but that seems to fix it smile

all the best
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Oops, I forgot the "=" sign surprise

Here's the correct line to copy and paste to your "header.html"
<?php echo '<'.'?xml version="1.0"?>' ?>
regards
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Thanks a lot. Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi James,
it worked then? Great approve

I am considering entering this into the Moodle Tracker but I am not very sure of my ground. Does anyone know if it the <?xml version="1.0"?> is required for a document to be considered a well-formed, "correct" xhtml document?
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Martin Holmes -
Hi there,

The XML header is definitely not required in order for the document to be "correct" XHTML. We include it with the Hot Potatoes pages because it also identifies the document as XML, which can be handy in some contexts, but in this case I think IE6 is just flaky. If the document validates, but IE6 displays it wrongly, then it's just another example of poor standards support in IE6.

Many users actually remove the XML declaration from their HotPot source files, because badly-configured servers sometimes try to process it as PHP (if they're set up to pass all processing instructions to PHP, instead of just actual PHP ones such as <?php ...?>).

Cheers,
Martin
In reply to Martin Holmes

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

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

Hi Martin,
thanks very much for the information. It seems that <?xml version="1.0"?> should be optional, but IE6 requires it to make sense of the world smile

I will try a few more things including trying to find a way to make IE6 behave without requiring <?xml ...?> and also asking on the tracker to see if the Moodle Themes can have this line added. There may be a reason why this line is not already in the "header.html" files in Moodle's standard themes.

best regards
Gordon

In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Over on this page:

It says:
An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol.

However, I also found quite a few pages which say that including the XML declaration in a page will send IE6 into "quirks" mode, even if the <!DOCTYPE> specifies strict mode.

Wikipedia explains it better:

Maybe this is why the Moodle themes do not have the XML declaration.

But in our case, it seems that we want to send IE6 into quirks mode. Actually it seems that any line before the <!DOCTYPE> tag will send IE6 into quirks mode, so maybe I could add a check to the HotPot module, so that if the browser is IE6, a blank line will be sent first of all, so then we don't need to worry about the XML declaration.

If you see what I mean mixed

Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
A little further investigation has revealed that a blank line, is not enough to make IE6 do the write thing. It has to be either an HTML comment, <!-- like this -->, or an XML declaration.

IE7 seems to display the quiz as expected in strict mode. It is quite happy with an XML declaration, but a comment would throw it into "quirks" mode, which is not what we want I think. Therefore, if we stick to sending out the XML declaration, it will send IE6 into "quirks" mode, which is what we want, and it will leave all other browsers in "strict" mode, which is also what we want.

The browser identification string that is sent to the server is not 100% reliable, so I don't think I will add a check in the PHP scripts to say "if this browser is IE6". Instead, the hotpot module will send out the XML declaration in all cases where the "header.html" does not already do so.

I will do some testing on Safari to make sure this doesn't break anything, and then add this improvement to the HotPot module in due course.

regards
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi Gordon

Sorry for a short reply last time. The year-final exams really exhausted everyone.

Regarding the code, I tried on a few header.html

The passage becomes the actual length only for a short time, and then it returns to a short one --- the problem continues.

I'm not sure why it behaved like that.

Thanks in advance.

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
> the problem continues

The problem does not continue on the Moodle 1.6 site on my server, in which I have modified the "theme/standard/header.html" as explained earlier in this thread.

Please confirm that you have added the following line to the top of "theme/yourtheme/header.html":
<?php echo '<'.'?xml version="1.0"?'.'>' ?>

When you view the quiz via Moodle and view the source of the page, can you see the <?xml version="1.0"?> line at the top of the source?

While viewing the quiz, what happens if you copy and paste the following to the address bar of your browser and hit return?
javascript:alert('ua='+navigator.userAgent + '\ncompatMode=' + document.compatMode)
Also, do you have problems viewing the following quiz, which is an exact copy of the quiz you sent me earlier:
If you are really positive that you have carried out the required modifications, and you cannot reproduce the behavior when the quiz is run on my server, please send me log in details of how I can access your site, and i will come and take a look.

regards
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Thanks Gordon,

I wrongly put it here: (the bolded one)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html<?php echo $direction ?>>
<head>

 <?php echo '<'.'?xml version="1.0"?'.'>' ?>

    <?php echo $meta ?>
    <meta name="keywords" content="WebClass, <?php echo $title ?> " />
    <title><?php echo $title ?></title>.....

I re-locate it as below:

 <?php echo '<'.'?xml version="1.0"?'.'>' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html<?php echo $direction ?>>
<head>
    <?php echo $meta ?>
    <meta name="keywords" content="WebClass, <?php echo $title ?> " />....

and everything works.

Thanks again.

Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Great, well done, James. approve

The <?xml ...> line must be right at the very top of the page, even before the <!DOCTYPE ...> tag and <html ..> tag

all the best
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi Gordon,

One strange problem is found after I added the statement, <?xml ...> line .

Two tables within http://mywebsite.com/moodle/admin/ is shifted to the left hand side.

They include: blocks.php and filters.php

Do you know about the reasons?

Cheers

James

In reply to J. Chan

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
> Do you know about the reasons?

Yes - more or less.

Moodle tries to use XHTML, in other words strict HTML. This allows you to get a more uniform look across browsers, but the HTML has to confirm to certain specifications.

The <?xml ...> line is part of the XHTML specification, so browsers should not worry about it. However, IE6 does not like it. It panics when it sees this line, and switches itself to non-strict mode. Most people would agree this is non-standard, non-desirable and unreasonable behavior, i.e. a "bug".

In order to get your Hot Potatoes quiz to behave in the way in which you expect, we added the <?xmx ...> line to the Moodle themes. This has the effect of switching IE6 into non-strict mode, which is what we want for Hot Potatoes quizzes.

However, all your other Moodle pages also include this line. This switches IE6 into non-strict mode for all pages, so some pages appear differently from what you have come to expect.

What you want to do is add the <?xml ...> line only to the HotPot pages. Perhaps you could change your "header.html" to something like the following:
<?php
if (strpos($_SERVER['REQUEST_URI'], '/mod/hotpot/view.php') !== false) {
echo '<'.'?xml version="1.0"?'.'>';
}
?>
all the best
Gordon
In reply to Gordon Bateson

Re: Reading Text from JQuiz not displaying the whole passage when"Show questions one by one"

by J. Chan -

Hi Gordon

Great! It works. Thanks

Cheers

James