Bug: Book Module is eating flash content

Bug: Book Module is eating flash content

by N Hansen -
Number of replies: 6
I have a book on my site. Some of my chapters (example here) contain flash movies. Before, I could edit these already existing chapters containing the flash movies and the flash movies remained intact. Now if I open them up to edit them, the flash movies and their surrounding tags are stripped out completely, as if they were never there to begin with. I upgraded to version 2005010100 of the book module recently. Before this upgrade this wasn't happening.
Average of ratings: -
In reply to N Hansen

Re: Bug: Book Module is eating flash content

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Did you update your Moodle at the same time?

Could you please test it with the html editor turned off?
In reply to N Hansen

Re: Bug: Book Module is eating flash content

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You may need to enable this parameter on the Admin >> Configure >> Variables page:

    allowobjectembed


In reply to Martin Dougiamas

Re: Bug: Book Module is eating flash content

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Flash must work in books, resoruces, lessons (and other content created only by teachers) without this allowobjectembed=true...

Anyway I am going to review the flash/java embedding throughout all modules and Moodle core now.
In reply to Petr Skoda

Re: Bug: Book Module is eating flash content

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Here is the patch, the problem was that the text was always "cleaned" before loading it into editor. Only text from students must be cleaned before displaying.

I am going to commit it tonight if there are no objections..

Index: weblib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/weblib.php,v
retrieving revision 1.469.2.9
diff -u -r1.469.2.9 weblib.php
--- weblib.php	1 Jul 2005 03:52:59 -0000	1.469.2.9
+++ weblib.php	4 Jul 2005 17:38:02 -0000
@@ -2973,9 +2973,6 @@
 
     if ($usehtmleditor) {
 
-        // cleanup bad html that may have made it to the db
-        $value = clean_text($value);
-
         if (!empty($courseid) and isteacher($courseid)) {
             echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/htmlarea.php?id='. $courseid .'"></script>'."\n" : '';
         } else {

In reply to Petr Skoda

Re: Bug: Book Module is eating flash content

by N Hansen -
I changed the setting as Martin suggested (although I don't think that was a problem as I was able to restore the flash by simply copying the source code and pasting it back in after it was removed), and added your hack, but it doesn't solve the problem. I'm the admin, in addition to being the teacher. I don't know if that has any effect?
In reply to N Hansen

Re: Bug: Book Module is eating flash content

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I am 100% sure it was the cause of problem. The patch is correct.