Moodle

Export GIFT format changes html tags like <strong> to &lt;strong&gt; which causes a problem when you try re-import those questions

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9
  • Fix Version/s: None
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

If you export questions from a Quiz that contain html tags (like <strong>) in the GIFT format, the resulting ouput looks something like this:
// Exported as question# 1 Actual question# was 1
::TF-The sky is blue. True or False.::[html]The <strong>sky<strong> is blue. True or False.{
TRUE#INCORRECT. #CORRECT!
}

Note that the word 'sky' should be bold.

If you then try to re-import this GIFT file into a different quiz, instead of the the word 'sky' appearing in bold, you're question would look like this:
The <strong>sky</strong> is blue. True or False.

When exporting as GIFT, if the < and > are part of an html tag, they should NOT be converted to < and &rt;

Activity

Hide
Howard Miller added a comment - - edited

I just tried this in 1.9.4+ (latest STABLE) and it doesn't convert the < and > to entities. I used the HTML editor which creates "spans" and all sorts of junk but it comes out the other end without being transformed. Thoughts?

Just tried your exact example.... still can't reproduce the problem.

Show
Howard Miller added a comment - - edited I just tried this in 1.9.4+ (latest STABLE) and it doesn't convert the < and > to entities. I used the HTML editor which creates "spans" and all sorts of junk but it comes out the other end without being transformed. Thoughts? Just tried your exact example.... still can't reproduce the problem.
Hide
Jeff Sherk added a comment -

My version is 1.9 (2007101509) only, so is it possible it has been fixed?

Show
Jeff Sherk added a comment - My version is 1.9 (2007101509) only, so is it possible it has been fixed?
Hide
Howard Miller added a comment -

The oldest active 1.9 site I have is 1.9.2+. It still works fine in that. 1.9.0 (if that's what you have) is old now. I would recommend you upgrade anyway regardless of this problem.

Show
Howard Miller added a comment - The oldest active 1.9 site I have is 1.9.2+. It still works fine in that. 1.9.0 (if that's what you have) is old now. I would recommend you upgrade anyway regardless of this problem.
Hide
Jeff Sherk added a comment -

I'm going to install a test site with 1.9.4 and see what happens, and then I'll get back to on whether I can reproduce it in 1.9.4 or not.

I am waiting to upgrade our production site to 2.0... I have too many custom mods to continually upgrade to the latest and greatest, so I need to space them out a bit.

Show
Jeff Sherk added a comment - I'm going to install a test site with 1.9.4 and see what happens, and then I'll get back to on whether I can reproduce it in 1.9.4 or not. I am waiting to upgrade our production site to 2.0... I have too many custom mods to continually upgrade to the latest and greatest, so I need to space them out a bit.
Hide
Jeff Sherk added a comment -

I did an install of 1.9.4 and I can reproduce the problem from this as well.

From the QUIZ moduel, Go to Questions -> Create a new question -> Multiple Choice

When you write the question name, highlight one word and make it bold, then highlight another word and underline it, then save the question.

Now Export the question (or the category that it is in) as GIFT format.

The resulting test file looks this in both Notepad and PSPad editors:

<pre><p>// question: 1548 name: What color is the sky?
::What color is the sky?::[html]What <span style\="font-weight\: bold;">color</span> is the <span style\="text-decoration\: underline;">sky</span>?{
=blue
~red
~green
}
</p></pre>

If you immediately re-import this file (unmodified) that you just exported, it will not display correctly.

Show
Jeff Sherk added a comment - I did an install of 1.9.4 and I can reproduce the problem from this as well. From the QUIZ moduel, Go to Questions -> Create a new question -> Multiple Choice When you write the question name, highlight one word and make it bold, then highlight another word and underline it, then save the question. Now Export the question (or the category that it is in) as GIFT format. The resulting test file looks this in both Notepad and PSPad editors: <pre><p>// question: 1548 name: What color is the sky? ::What color is the sky?::[html]What <span style\="font-weight\: bold;">color</span> is the <span style\="text-decoration\: underline;">sky</span>?{ =blue ~red ~green } </p></pre> If you immediately re-import this file (unmodified) that you just exported, it will not display correctly.
Hide
Howard Miller added a comment -

Just to be clear - do you really mean the question name or the question text?

Show
Howard Miller added a comment - Just to be clear - do you really mean the question name or the question text?
Hide
Jeff Sherk added a comment -

Sorry... I meant the Question Text!

Show
Jeff Sherk added a comment - Sorry... I meant the Question Text!
Hide
Howard Miller added a comment -

Tried exactly what you said and got....

::test::[html]These <span style\="font-weight\: bold;">are</span> some <span style\="text-decoration\: underline;">words</span>.{
=1
~2
}

I checked it in a couple of different editors and no difference

Show
Howard Miller added a comment - Tried exactly what you said and got.... ::test::[html]These <span style\="font-weight\: bold;">are</span> some <span style\="text-decoration\: underline;">words</span>.{ =1 ~2 } I checked it in a couple of different editors and no difference
Hide
Howard Miller added a comment -

Thinking... after you have selected the export options and pressed 'go', can you tell me exactly what you do to view the results? I've just noticed those "pre" tags. Those shouldn't be in the file!! You are viewing it via something I think. Are you clicking the download link immediately after the export is complete and looking at the file downloaded to your desktop or something else?

Show
Howard Miller added a comment - Thinking... after you have selected the export options and pressed 'go', can you tell me exactly what you do to view the results? I've just noticed those "pre" tags. Those shouldn't be in the file!! You are viewing it via something I think. Are you clicking the download link immediately after the export is complete and looking at the file downloaded to your desktop or something else?
Hide
Jeff Sherk added a comment -

Well that's very interesting... I guess if you can't reproduce it and nobody else has complained about it, then it's not a problem!!

Thanks

Show
Jeff Sherk added a comment - Well that's very interesting... I guess if you can't reproduce it and nobody else has complained about it, then it's not a problem!! Thanks
Hide
Jeff Sherk added a comment -

Just got your last reply... yes, I thought it was strange that there were pre tags in it, but I did not think anything of it... let me check and I'll get back to you in a few minutes.

Show
Jeff Sherk added a comment - Just got your last reply... yes, I thought it was strange that there were pre tags in it, but I did not think anything of it... let me check and I'll get back to you in a few minutes.
Hide
Jeff Sherk added a comment -

Here's what I do...

Go to Export questions, and choose GIFT format, choose the category I want to export, uncheck the Write Category To File, and change the filename to something I understand, then hit Export Questions To File.

It then shows all the questions on the screen with a Continue button at the bottom of the screen, but just above the Continue button after the last question, it says Click To Download The Exported Category File. I click on this and it asks me for a file name and I hit save.

Show
Jeff Sherk added a comment - Here's what I do... Go to Export questions, and choose GIFT format, choose the category I want to export, uncheck the Write Category To File, and change the filename to something I understand, then hit Export Questions To File. It then shows all the questions on the screen with a Continue button at the bottom of the screen, but just above the Continue button after the last question, it says Click To Download The Exported Category File. I click on this and it asks me for a file name and I hit save.
Hide
Howard Miller added a comment -

In the last step... I don't get asked for a filename. I am using Firefox on a Mac. I tried right-clicking and then I do get asked but it doesn't make any difference.

I'll go and find a PC - sigh! - and see what happens in IE on Windows.

Show
Howard Miller added a comment - In the last step... I don't get asked for a filename. I am using Firefox on a Mac. I tried right-clicking and then I do get asked but it doesn't make any difference. I'll go and find a PC - sigh! - and see what happens in IE on Windows.
Hide
Howard Miller added a comment -

....or I could get it to ask me for a filename by turning slasharguments off. It was still ok though.

I think this is some weird file.php issue (downloading the file) rather than anything to do with quiz. The <pre> tags are normally added by file.php if it displays a text file to maintain the layout. That seems to be what's happening but why it is in your case I have no idea. It must be something to do with your configuration.

Show
Howard Miller added a comment - ....or I could get it to ask me for a filename by turning slasharguments off. It was still ok though. I think this is some weird file.php issue (downloading the file) rather than anything to do with quiz. The <pre> tags are normally added by file.php if it displays a text file to maintain the layout. That seems to be what's happening but why it is in your case I have no idea. It must be something to do with your configuration.
Hide
Jeff Sherk added a comment -

I am using Win XP Pro sp2 with FIrefox 3.

Okay, if I go to Moodledata and download the file from there, there is no problem.

I also tried it using IE7 and there is no problem with the Click To Download The Exported Category File.

It is only when I click the 'Click To Download The Exported Category File' link from FIREFOX... now that's a new one, because usually Firefox does everything fine and it's IE that I have the problems with!!!

Show
Jeff Sherk added a comment - I am using Win XP Pro sp2 with FIrefox 3. Okay, if I go to Moodledata and download the file from there, there is no problem. I also tried it using IE7 and there is no problem with the Click To Download The Exported Category File. It is only when I click the 'Click To Download The Exported Category File' link from FIREFOX... now that's a new one, because usually Firefox does everything fine and it's IE that I have the problems with!!!
Hide
Tim Hunt added a comment -

I am pretty sure this is fixed in Moodle 2.1. Can anyone still reproduce this?

Show
Tim Hunt added a comment - I am pretty sure this is fixed in Moodle 2.1. Can anyone still reproduce this?

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: