From 46cf70cc8c193819a3c0cd8c4a57e7d3b1ea372f Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 27 Jan 2011 18:03:35 +0000 Subject: [PATCH] MDL-20636 Bug 11408 JME and applet components don't work in IE. --- question/type/opaque/locallib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/question/type/opaque/locallib.php b/question/type/opaque/locallib.php index 162afd0182d..420c30d0448 100644 --- a/question/type/opaque/locallib.php +++ b/question/type/opaque/locallib.php @@ -568,6 +568,16 @@ function qtype_opaque_extract_stuff_from_response($opaquestate, $response, $reso } // Process the resources. + // TODO remove this. Evil hack. IE cannot cope with : and other odd characters + // in the name argument to window.open. Until we can deploy a fix to the + // OpenMark servers, apply the fix to the JS code here. + foreach ($response->resources as $key => $resource) { + if ($resource->filename == 'script.js') { + $response->resources[$key]->content = preg_replace( + '/(?<=window\.open\(\"\", idprefix|window\.open\(\"\",idprefix)\+(?=\"\w+\"\+id,)/', + '.replace(/\W/g,"_")+', $resource->content); + } + } $resourcecache->cache_resources($response->resources); // Process the other bits.