"invisible" code

"invisible" code

by Ian Hunt -
Number of replies: 9
We have recently upgraded to 2.2.4 (build 20120726). Yesterday I noticed a problem with an imported question that I would like to fix. The question is a short answer match where I have embedded a JMOL in to the question stem. I have captured the code in the attached screen shot. Now when the question displays, the full code is hidden, so I toggled to the html editor, but the code remains hidden (?) which surprised me. In the broken question. it's that code I need to fix. I've tried a couple of things, but each time the code disappears making it tough to fix. Even in questions that work, if I go the the html editor in the qu editor, I can't see the code.
Average of ratings: -
In reply to Ian Hunt

Re: "invisible" code

by Ian Hunt -

Sorry, I forgot to add the screen capture yesterday.  Despite further attempts yesterday, I wasn't able to solve the issue. Currently it means I have a set of questions I can't edit / fix etc.

Attachment error_101712.gif
In reply to Ian Hunt

Re: "invisible" i.e. disappearing code

by Ian Hunt -

I apologise for doing this to bump this old qu but I never got a reply and I'm yet to solve the problem and it's happened again....

Essentially I have short answer questions created in an older moodle version (2.1 i think) that I now can't edit. If i try any sort of edit, then it cuts code and stops the question working.  I've tried different browsers and I've tried to import the question froma related database. Yet anytime I try to do any sort of edit, some of the code is lsot from the question. It's the question editor interface that is causing this it seems. I see the required code initially, but as things load it changes. Anyone have any suggestions or advice ?

In reply to Ian Hunt

Re: "invisible" i.e. disappearing code

by Jean-Michel Védrine -

Hello Ian,

Your screenshot is quite strange. You don't have the TinyMCE toolbar. Unfortunately your screenshot don't show the format under the textarea. Does it show "HTML format" or anything else. Is TinyMCE disbled in your profile or in site settings ?

I quite strange to try to edit a text with images or any other media embeded without the TinyMCE editor.

Also you say "I've tried to import the question from a related database". How can you do that for a question with an embeded java applet ? Using questions import/export and Moodle XML format ?

In reply to Jean-Michel Védrine

Re: "invisible" i.e. disappearing code

by Ian Hunt -

When my question editor loads, the MCE editor toolbar takes a few seconds to appear after the "text" appears.... I managed to do a quick screen capture during that process. If I wait until the toolbar appears, some of the question disappears and is gone.

I have related courses that share questions and as a result I have copies of the questions in those courses question bank. I tried to copy working version of the questions from those banks to replace the corrupted question. But as soon as I try to edit the questions they "break" and if I try to save them, I get the broken version.

Note that the questions are using the JMOL applet.  I made a little progress yesterday in terms of getting the applet to work when I editted the questions but I could not get the JMOLSCRIPT commands to work (I use these tio control the size of the image and the orientation of the molecule in the applet).

Hope that helps answer your questions.

In reply to Ian Hunt

Re: "invisible" i.e. disappearing code

by Jean-Michel Védrine -

Silly question: are you sure this syntax works without the jmol filter ?

I was unable to test : my Moodle test instal refuse to upload a .pdb file ! it says this filetyê can't be accepted.

In reply to Jean-Michel Védrine

Re: "invisible" i.e. disappearing code

by Jean-Michel Védrine -

Doh ! If I tell Moodle that a .pdb is an image of course he don't agree, but if I upload and link it works wonderfully if the jmol filter is enabled.

And it is not I just get a link but the queston is still editable.

In reply to Jean-Michel Védrine

Re: "invisible" i.e. disappearing code

by Ian Hunt -

To answer yor question.... Since the questions work, I infer that the syntax is correct. FYI, I have a pool of 18 questions, all based on the same code. All 18 used to work and were deployed and used mutliple times. 2 questions are now broken, the other 16 still work. But if I try to edit them, even if I just resave them without making any changes, the question "breaks".... the only way out of the editor to avoid breaking them is to cancel.

In reply to Ian Hunt

Re: "invisible" i.e. disappearing code

by Jean-Michel Védrine -

Switch debugging to Developer level to see if any error message is displayed when using or editing these questions (but cancel not to break more questions).

Try to export these questions (both broken and working) using moodle XML and look if you find anything curious. Is the .pdb file here (base64 encoded) ?

Try to look in the database to see if you find any difference between working and broken ones. If you know how the file system is working, try to see if the associated record in mdl_files table and file in the filepool are OK.

Look at the source code of a page when these questions are used in an attempt to see if you find differences.

This is all I can think of.

In reply to Jean-Michel Védrine

Re: "invisible" i.e. disappearing code

by Ian Hunt -

FYI problem solved... I tried turning on "debugging" but being an organic chemist, I wasn't able to work out where the messages were being sent sad

But I talked with another instructor here who is more IT savy than me. He had seen a similar problem in BB with the TinyMCE editor. So after a little probing and testing, we determined that we believe the the TInyMCE editor did not know what to make of the code and was making it's best guess at what it was supposed to do. The result was that this deleted some of the code and broke the questions.

The fix was to use the current version of the interface to reinsert the pdb file / applet and then edit the URL to include the display controls then the html editor it insert the JMOLSCRIPT commands.

Summary: remake the question using the current editor as the tinyMCE was corrupting the questions.