From 0760ba2c40099e49c438e0f841ec0ad4ccb505c7 Mon Sep 17 00:00:00 2001
From: nicolasconnault <nicolasconnault>
Date: Mon, 5 Nov 2007 14:10:27 +0000
Subject: [PATCH] MDL-8992 Now only appearing once per page, and XHTML
 compliant. Also removed an ugly browser-sniffing css hack from the quicktime
 plugin, and applied the same browser detection as for the other plugins

---
 filter/mediaplugin/filter.php             |  6 +++++-
 mod/resource/type/file/resource.class.php | 17 ++++++-----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/filter/mediaplugin/filter.php b/filter/mediaplugin/filter.php
index c9708acbc2..ac925d48b3 100644
--- a/filter/mediaplugin/filter.php
+++ b/filter/mediaplugin/filter.php
@@ -20,6 +20,7 @@ require_once($CFG->libdir.'/filelib.php');
 
 function mediaplugin_filter($courseid, $text) {
     global $CFG;
+    static $eolas_fix_applied = false;
 
     include 'defaultsettings.php';
 
@@ -86,7 +87,10 @@ function mediaplugin_filter($courseid, $text) {
         $newtext = $text;
     }
     
-    $newtext .= '<script defer="defer" src="' . $CFG->wwwroot . '/filter/mediaplugin/eolas_fix.js" type="text/javascript"></script>';
+    if (!$eolas_fix_applied) {
+        $newtext .= '<script defer="defer" src="' . $CFG->wwwroot . '/filter/mediaplugin/eolas_fix.js" type="text/javascript">// <![CDATA[ ]]></script>';
+        $eolas_fix_applied = true;
+    }
 
     return $newtext;
 }
diff --git a/mod/resource/type/file/resource.class.php b/mod/resource/type/file/resource.class.php
index 12fcd92ddb..3e523224af 100644
--- a/mod/resource/type/file/resource.class.php
+++ b/mod/resource/type/file/resource.class.php
@@ -545,15 +545,6 @@ class resource_file extends resource_base {
                 echo '</div>';
 
             } else if ($resourcetype == "quicktime") {
-                echo '<style type="text/css">';
-                echo '/* class to hide nested objects in IE */';
-                echo '/* hides the second object from all versions of IE */';
-                echo '* html object.hiddenObjectForIE { display: none; }';
-                echo '/* display the second object only for IE5 Mac */';
-                echo '/* IE Mac \*//*/';
-                echo '* html object.hiddenObjectForIE { display: inline; }';
-                echo '/**/';
-                echo '</style>';
                 echo '<div class="resourcecontent resourceqt">';
 
                 echo '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
@@ -564,13 +555,17 @@ class resource_file extends resource_base {
                 echo '<param name="controller" value="true" />';
                 echo '<param name="scale" value="aspect" />';
 
-                echo "<object class=\"hiddenObjectForIE\" type=\"video/quicktime\" data=\"$fullurl\">";
+                echo '<!--[if !IE]>-->';
+                echo "<object type=\"video/quicktime\" data=\"$fullurl\">";
                 echo '<param name="controller" value="true" />';
                 echo '<param name="autoplay" value="true" />';
                 echo '<param name="loop" value="true" />';
                 echo '<param name="scale" value="aspect" />';
-                echo '</object>';
+                echo '<!--<![endif]-->';
                 echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
+                echo '<!--[if !IE]>-->';
+                echo '</object>';
+                echo '<!--<![endif]-->';
                 echo '</object>';
                 echo '</div>';
             }  else if ($resourcetype == "flash") {
-- 
2.39.5