Images in rate type questions no longer show when an exisiting questionnaire is copied

Images in rate type questions no longer show when an exisiting questionnaire is copied

Barbara Lawrence發表於
Number of replies: 8

Hi Joseph

I copied an existing questionnaire with a number of rate type questions, which each contain the same two images.  In the copied version the quotes in the html are all escaped.  Everything else seems to work but the images don't display.

Original:

before

Copy:

after  

Before and after html are in the attached file.

We are using Moodle 2.4.4, on Windows 2008, with  Apache 2.2.23, MySQL 5.1, PHP 5.3.22. 

Of course, I could edit all the questions to remove the escaping character, but there are a lot of questions and I'd rather avoid that if possible.This questionnaire is used twice a year so I would have to edit the questions every time I copied it.

I'd be grateful for any advice you can offer.

Thanks 

Barbara

評比平均分數: -
In reply to Barbara Lawrence

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Joseph Rézeau發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

@Barbara,

Which exact procedure did you use to insert images in your Rate question in the original questionnaire?

And which procedure did you use to "copy" the original questionnaire to other ones?

From the attached HTML file, it looks like you created the original questionnaire on your local machine then "copied" it to your institution's site. Is that right?

Joseph

In reply to Joseph Rézeau

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Barbara Lawrence發表於

Hi Joseph

The original questionnaire was created a few years ago on Moodle 1.9, but I'm pretty sure it was not created on my local machine. It has since been copied a number of times by adding a new questionnaire then selecting "copy existing". 

The site was migrated to 2.4 in the summer and this is the first time I have tried copying the questionnaire since then.  The example I attached was from my test site, I backed up the questionnaire from my live site and restored it on the test.  

If I copy and paste the question text from the "original" questionnaire it's fine.

Barbara

In reply to Barbara Lawrence

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Joseph Rézeau發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

Well, there have been many changes between 1.9 and 2.4, both in Moodle core files and in the Questionnaire add-on, so it's not surprising that something worked OK in 1.9 and not in 2.4.

I still do not know from your description HOW those images are inserted in your Rate questions "possible answers" choices. It is a rather tricky feature, and the final result really depends on the path for those images, especially whether it's relative or absolute.

Joseph

In reply to Joseph Rézeau

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Barbara Lawrence發表於

Hi Joseph

I've done it all again today, just to make sure that I'm giving you an accurate picture.

(in Chrome):

1. Added the two images in a label using the image button in html editor.

2. On the course page, right clicked each image to copy the url

3. Created a brand new questionnaire

4. Added the rate type question using image tags with src attributes containing the saved urls

5. Saved the questionnaire.

6. Previewed the questionnaire and the images were displayed.

7. Created a new questionnaire, copying the existing one just created

8. Previewed the new questionnaire, images now not displayed.

Actual text for the question (from both questionnaires) is in the attached file.

In my live moodle, since it was migrated from 1.9, the images are in the legacy files area for the course.

Regards
Barbara

 

 

In reply to Barbara Lawrence

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Joseph Rézeau發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

Hi again Barbara and thanks for the detailed scenario.

I confirm your findings and will try to work on the problem.

However, the way you use to insert images is not very safe. If you delete your original label (with the images), then the images will disappear from your questionnaire questions!

Joseph

EDIT.- Just noticed that if, instead of creating a new questionnaire and using the Content options Copy existing option you simply use the Duplicate activity icon when in Edit mode, the images URL is correctly copied!

screenshot #1

In reply to Joseph Rézeau

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Joseph Rézeau發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

Finally found the bug and a very easy fix. All references to addslashes should be removed from file questionnaire.class.php.

Fixed in versions 2.4 and 2.5 of Questionnaire, and committed to the github. CONTRIB-4706.

Thanks to Barbara for reporting this problem!

Joseph

In reply to Joseph Rézeau

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Marinda Faasen發表於

Hi

I have the same problem. I inserted images in some of the questions and they do not show anymore. (The question types differ, so it is not only for the rate type questions.

I upgraded the past weekend from Moodle 2.8 to Moodle 3.1. 

They showed before the upgrade, but they are gone now. When I go to edit, the image displays, but when I preview the question, it does not display.

I also changed the theme from BCU to Adaptable. (not sure if it is relevant)



In reply to Marinda Faasen

Re: Images in rate type questions no longer show when an exisiting questionnaire is copied

Mike Churchward發表於
Core developers的相片 Plugin developers的相片 Testers的相片

Hi -

I will take a look at this and see if I can find the problem.

mike