From 0ad439bb4218b2a6585f51e6a085b8a8aa82849b Mon Sep 17 00:00:00 2001 From: skodak Date: Fri, 23 Nov 2007 20:26:16 +0000 Subject: [PATCH] MDL-12221 custom themes revisited - fixed bug in previous commit, added more developer debug; merged from MOODLE_19_STABLE --- lib/weblib.php | 21 ++++++++++++++++++++- theme/standardwhite/header.html | 3 +-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 849c5a21abe9e..6174f4ef77531 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2797,6 +2797,11 @@ function print_footer($course=NULL, $usercourse=NULL, $return=false) { $menu = ''; } +/// there should be exactly one open container 'content' + if (open_containers() != 1) { + debugging('Unexpected number of open containers: '.open_containers().', expecting 1.', DEBUG_DEVELOPER); + } + /// Provide some performance info if required $performanceinfo = ''; if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) { @@ -3911,7 +3916,7 @@ function print_container_end($return=false) { global $THEME; if (empty($THEME->open_containers)) { - debugging('Incorrect closing of custom corners - no more open containers'); + debugging('Incorrect closing of custom corners - no more open containers.', DEBUG_DEVELOPER); $idbase = ''; } else { $idbase = array_pop($THEME->open_containers); @@ -3930,6 +3935,20 @@ function print_container_end($return=false) { } } +/** + * Returns number of currently open containers + * @return int number of open containers + */ +function open_containers() { + global $THEME; + + if (!isset($THEME->open_containers)) { + $THEME->open_containers = array(); + } + + return count($THEME->open_containers); +} + /** * Force closing of all open containers except the main content one. * @param boolean $return, return as string or just print it diff --git a/theme/standardwhite/header.html b/theme/standardwhite/header.html index 986fd4c921311..deb3ec5762e96 100644 --- a/theme/standardwhite/header.html +++ b/theme/standardwhite/header.html @@ -40,7 +40,6 @@


- +