From b1ce7811ad31316b1fb1730db49e77a6bff689b5 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 12 Sep 2006 09:22:27 +0000 Subject: [PATCH] Fixed MDL-6479 by adding two block columns on admin pages. Also we now hide the blocks and headers completely until $SITE is properly defined. --- admin/index.php | 4 +--- admin/pagelib.php | 21 ++++++++++++++++++--- admin/settings.php | 41 +++++++++++++++++++++++++++++------------ lib/adminlib.php | 39 +++++++++++++++++++++++++++------------ 4 files changed, 75 insertions(+), 30 deletions(-) diff --git a/admin/index.php b/admin/index.php index d60655fd26..3d69ba9067 100644 --- a/admin/index.php +++ b/admin/index.php @@ -630,8 +630,6 @@ echo ''; } - print_simple_box_end(); - if (optional_param('dbmigrate')) { // ??? Is this actually used? print_simple_box_start('center','60%'); @@ -645,4 +643,4 @@ -?> \ No newline at end of file +?> diff --git a/admin/pagelib.php b/admin/pagelib.php index fb4570e8a8..e2fead88a1 100644 --- a/admin/pagelib.php +++ b/admin/pagelib.php @@ -4,6 +4,11 @@ require_once($CFG->libdir.'/pagelib.php'); define('PAGE_ADMIN', 'admin'); +define('BLOCK_L_MIN_WIDTH',160); +define('BLOCK_L_MAX_WIDTH',210); +define('BLOCK_R_MIN_WIDTH',160); +define('BLOCK_R_MAX_WIDTH',210); + page_map_class(PAGE_ADMIN, 'page_admin'); class page_admin extends page_base { @@ -77,13 +82,22 @@ class page_admin extends page_base { } function blocks_get_positions() { - return array(BLOCK_POS_LEFT); + return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT); } function blocks_default_position() { return BLOCK_POS_LEFT; } + function blocks_move_position(&$instance, $move) { + if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) { + return BLOCK_POS_RIGHT; + } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) { + return BLOCK_POS_LEFT; + } + return $instance->position; + } + // does anything need to be done here? function init_quick($data) { parent::init_quick($data); @@ -105,7 +119,8 @@ class page_admin extends page_base { $buttons = ' '; } - print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, implode(" -> ",$this->visiblepathtosection),'', '', true, $buttons, ''); + print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, + implode(" -> ",$this->visiblepathtosection),'', '', true, $buttons, ''); } function get_type() { @@ -113,4 +128,4 @@ class page_admin extends page_base { } } -?> \ No newline at end of file +?> diff --git a/admin/settings.php b/admin/settings.php index 500a7cdfc7..dd9e8909b8 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -9,8 +9,6 @@ if ($site = get_site()) { require_login(); } -define('BLOCK_L_MIN_WIDTH',160); -define('BLOCK_L_MAX_WIDTH',210); page_map_class(PAGE_ADMIN, 'page_admin'); @@ -83,17 +81,30 @@ if ($data = data_submitted()) { // --------------------------------------------------------------------------------------------------------------- -$pageblocks = blocks_setup($PAGE); -$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); +if (!empty($SITE->fullname)) { + $pageblocks = blocks_setup($PAGE); + + $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), + BLOCK_L_MAX_WIDTH); + $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), + BLOCK_R_MAX_WIDTH); + + // print header stuff + $PAGE->print_header(); + + echo ''; + echo ''; + echo ''; + echo '
'; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); + echo ''; +} else { + + print_header(); + print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%'); + +} -// print header stuff -$PAGE->print_header(); -echo ''; -echo ''; -echo '
'; -blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); -echo ''; echo '
'; echo ''; echo ''; @@ -106,7 +117,13 @@ echo $root->output_html(); echo '
'; print_simple_box_end(); echo '
'; -echo '
'; + +if (!empty($SITE->fullname)) { + echo '
'; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); + echo '
'; +} print_footer(); diff --git a/lib/adminlib.php b/lib/adminlib.php index b3d242dcdf..89ec6b4373 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -2240,26 +2240,41 @@ function admin_externalpage_setup($section, $adminroot) { function admin_externalpage_print_header($adminroot) { - global $CFG, $PAGE; + global $CFG, $PAGE, $SITE; - $pageblocks = blocks_setup($PAGE); + if (!empty($SITE->fullname)) { + $pageblocks = blocks_setup($PAGE); - $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); - - $PAGE->print_header(); - echo ''; - echo ''; - echo ''; + echo '
'; - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); - echo ''; + $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), + BLOCK_L_MAX_WIDTH); + + $PAGE->print_header(); + echo ''; + echo ''; + echo '
'; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); + echo ''; + } else { + print_header(); + } } function admin_externalpage_print_footer($adminroot) { - echo '
'; + global $CFG, $PAGE, $SITE; + + if (!empty($SITE->fullname)) { + $pageblocks = blocks_setup($PAGE); + $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), + BLOCK_R_MAX_WIDTH); + echo '
'; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); + echo '
'; + } + print_footer(); - } function admin_get_root() { -- 2.39.5