diff --git a/mod/hotpot/iframe.js b/mod/hotpot/iframe.js index 472de858781..10f337e34f6 100644 --- a/mod/hotpot/iframe.js +++ b/mod/hotpot/iframe.js @@ -16,16 +16,16 @@ function px(i) { return i + "px"; } function setSize(obj, w, h) { - if (is.n4) with (obj) { - if (w) width = w; - if (h) height = h; - } else if (is.opera) with (obj.style) { + if (is.n4) { + if (w) obj.width = w; + if (h) obj.height = h; + } else if (is.opera) { // opera 5 needs pixelWidth/Height - if (w) pixelWidth = w; - if (h) pixelHeight = h; - } else with (obj.style) { - if (w) width = px(w); - if (h) height = px(h); + if (w) obj.style.pixelWidth = w; + if (h) obj.style.pixelHeight = h; + } else { + if (w) obj.style.width = px(w); + if (h) obj.style.height = px(h); } } function getElement(id, lyr) { @@ -37,13 +37,15 @@ is = new domSniffer(); function set_iframe_height(id) { var iframe = getElement(id); if (iframe) { - obj = iframe.document; - if (obj.body) { - obj = obj.body; - } - var h = getContentH(obj); - if (h) { - setSize(iframe, 0, h); + var obj = iframe.document || iframe.contentDocument || null; // IE || FireFox + if (obj) { + if (obj.body) { + obj = obj.body; + } + var h = getContentH(obj); + if (h) { + setSize(iframe, 0, h); + } } } } diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index 63fc4ee03e2..769db26465c 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -49,10 +49,10 @@ $HOTPOT_OUTPUTFORMAT = array ( HOTPOT_OUTPUTFORMAT_BEST => get_string("outputformat_best", "hotpot"), HOTPOT_OUTPUTFORMAT_V6_PLUS => get_string("outputformat_v6_plus", "hotpot"), HOTPOT_OUTPUTFORMAT_V6 => get_string("outputformat_v6", "hotpot"), - // HOTPOT_OUTPUTFORMAT_V5_PLUS => get_string("outputformat_v5_plus", "hotpot"), - // HOTPOT_OUTPUTFORMAT_V5 => get_string("outputformat_v5", "hotpot"), - // HOTPOT_OUTPUTFORMAT_V4 => get_string("outputformat_v4", "hotpot"), - // HOTPOT_OUTPUTFORMAT_V3 => get_string("outputformat_v3", "hotpot"), + HOTPOT_OUTPUTFORMAT_V5_PLUS => get_string("outputformat_v5_plus", "hotpot"), + HOTPOT_OUTPUTFORMAT_V5 => get_string("outputformat_v5", "hotpot"), + HOTPOT_OUTPUTFORMAT_V4 => get_string("outputformat_v4", "hotpot"), + HOTPOT_OUTPUTFORMAT_V3 => get_string("outputformat_v3", "hotpot"), // HOTPOT_OUTPUTFORMAT_FLASH => get_string("outputformat_flash", "hotpot"), // HOTPOT_OUTPUTFORMAT_MOBILE => get_string("outputformat_mobile", "hotpot"), ); @@ -1627,8 +1627,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree { } function insert_form($startblock, $endblock, $form_name, $form_fields, $center=false) { global $CFG; - $char = substr($endblock, 0, 1); - $search = '#(?<='.preg_quote($startblock).')'."[^$char]*".'(?='.preg_quote($endblock).')#'; + $search = '#(?<='.preg_quote($startblock).')(.+?)(?='.preg_quote($endblock).')#s'; $replace = '
'; if ($center) { $replace = '