From 3cb6bd2c35635a7da1bec9433e8b792f4fdb313c Mon Sep 17 00:00:00 2001 From: gbateson Date: Fri, 4 May 2007 02:50:18 +0000 Subject: [PATCH] remove duplicate id attribute from body tag; microincrement version to 2007020202 (release 2.3.2) --- mod/hotpot/README.TXT | 2 +- mod/hotpot/version.php | 4 ++-- mod/hotpot/view.php | 18 +++++++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/mod/hotpot/README.TXT b/mod/hotpot/README.TXT index b0165b337db..8128e1727af 100644 --- a/mod/hotpot/README.TXT +++ b/mod/hotpot/README.TXT @@ -1,5 +1,5 @@ ================================================== -This is v2.3.1 of the HotPot module for Moodle 1.8 +This is v2.3.2 of the HotPot module for Moodle 1.8 ================================================== This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle. diff --git a/mod/hotpot/version.php b/mod/hotpot/version.php index e7fa71f520b..1102784f559 100644 --- a/mod/hotpot/version.php +++ b/mod/hotpot/version.php @@ -3,8 +3,8 @@ /// Code fragment to define the version of hotpot /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2007020201; // release date of this version (see note below) -$module->release = 'v2.3.1'; // human-friendly version name (used in mod/hotpot/lib.php) +$module->version = 2007020202; // release date of this version (see note below) +$module->release = 'v2.3.2'; // human-friendly version name (used in mod/hotpot/lib.php) $module->requires = 2007020200; // Requires this Moodle version $module->cron = 0; // period for cron to check this module (secs) // interpretation of YYYYMMDDXY version numbers diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index 375d9fab63e..648e28c9f38 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -260,6 +260,12 @@ } // insert hot-potatoes.js $hp->insert_script(HOTPOT_JS); + // get Moodle pageid and pageclass + $pageid = ''; + $pageclass = ''; + if (function_exists('page_id_and_class')) { + page_id_and_class($pageid, $pageclass); + } // extract first tag $head = ''; $pattern = '|]*)>(.*?)|is'; @@ -274,7 +280,9 @@ if (preg_match_all($pattern, $head, $matches)) { $count = count($matches[0]); for ($i=0; $i<$count; $i++) { - $styles .= $matches[0][$i]."\n"; + if ($pageid) { + $styles .= str_replace('TheBody', $pageid, $matches[0][$i])."\n"; + } $head = str_replace($matches[0][$i], '', $head); } } @@ -284,7 +292,9 @@ if (preg_match_all($pattern, $head, $matches)) { $count = count($matches[0]); for ($i=0; $i<$count; $i++) { - $scripts .= $matches[0][$i]."\n"; + if ($pageid) { + $scripts .= str_replace('TheBody', $pageid, $matches[0][$i])."\n"; + } $head = str_replace($matches[0][$i], '', $head); } } @@ -295,7 +305,9 @@ // HP6 and some HP5 (v6 and v4) if (preg_match('|]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)|is', $hp->html, $matches)) { $body = $matches[5]; // contents of first ... block - $body_tags = $matches[1]; + if ($pageid) { + $body_tags = str_replace(' id="TheBody"', '', $matches[1]); + } // workaround to ensure javascript onload routine for quiz is always executed // $body_tags will only be inserted into the tag // if it is included in the theme/$CFG->theme/header.html,