Skip to content
Browse files

remove duplicate id attribute from body tag; microincrement version t…

…o 2006091203 (release 2.2.2)
  • Loading branch information...
1 parent 9197627 commit 2f47a361ffa3a1bd7ac180d2f4e20783e1e2c882 gbateson committed May 4, 2007
Showing with 18 additions and 6 deletions.
  1. +1 −1 mod/hotpot/README.TXT
  2. +2 −2 mod/hotpot/version.php
  3. +15 −3 mod/hotpot/view.php
View
2 mod/hotpot/README.TXT
@@ -1,5 +1,5 @@
==================================================
-This is v2.2.1 of the HotPot module for Moodle 1.7
+This is v2.2.2 of the HotPot module for Moodle 1.7
==================================================
This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
View
4 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 = 2006091202; // release date of this version (see note below)
-$module->release = 'v2.2.1'; // human-friendly version name (used in mod/hotpot/lib.php)
+$module->version = 2006091203; // release date of this version (see note below)
+$module->release = 'v2.2.2'; // human-friendly version name (used in mod/hotpot/lib.php)
$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // period for cron to check this module (secs)
// interpretation of YYYYMMDDXY version numbers
View
18 mod/hotpot/view.php
@@ -262,6 +262,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 <head> tag
$head = '';
$pattern = '|<head([^>]*)>(.*?)</head>|is';
@@ -276,7 +282,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);
}
}
@@ -286,7 +294,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);
}
}
@@ -297,7 +307,9 @@
// HP6 and some HP5 (v6 and v4)
if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
$body = $matches[5]; // contents of first <body onload="StartUp()">...</body> 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 <body ...> tag
// if it is included in the theme/$CFG->theme/header.html,

0 comments on commit 2f47a36

Please sign in to comment.
Something went wrong with that request. Please try again.