]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed MDL-6479 by adding two block columns on admin pages.
authormoodler <moodler>
Tue, 12 Sep 2006 09:22:27 +0000 (09:22 +0000)
committermoodler <moodler>
Tue, 12 Sep 2006 09:22:27 +0000 (09:22 +0000)
Also we now hide the blocks and headers completely until $SITE is properly
defined.

admin/index.php
admin/pagelib.php
admin/settings.php
lib/adminlib.php

index d60655fd2660c4f3ded933197ac869e0ad6a231e..3d69ba9067f1f8321b7deb858da351f4af7231be 100644 (file)
         echo '</div>';
     }
 
-    print_simple_box_end();
-
     
     if (optional_param('dbmigrate')) {               // ??? Is this actually used?
         print_simple_box_start('center','60%');
 
 
 
-?>
\ No newline at end of file
+?>
index fb4570e8a8f778cdb36d716f316f31d318f76c2c..e2fead88a1b172bba9772f06aeeed483fdce8fe7 100644 (file)
@@ -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 = '&nbsp;';
         }
         
-        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
+?>
index 500a7cdfc7a8ef52600beeec9f8f6977a794ae8c..dd9e8909b83887c0ccf49b35c1676b604ed239a7 100644 (file)
@@ -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 '<table id="layout-table"><tr>';
+    echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
+    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+    echo '</td>';
+    echo '<td id="middle-column" width="*">';
+} else {
+
+    print_header();
+    print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%');
+
+}
 
-// print header stuff
-$PAGE->print_header();
-echo '<table id="layout-table"><tr>';
-echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
-blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
-echo '</td>';
-echo '<td id="middle-column" width="*">';
 echo '<form action="settings.php" method="post" name="mainform">';
 echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
 echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
@@ -106,7 +117,13 @@ echo $root->output_html();
 echo '<center><input type="submit" value="' . get_string('savechanges','admin') . '" /></center>';
 print_simple_box_end();
 echo '</form>';
-echo '</td></tr></table>';
+
+if (!empty($SITE->fullname)) {
+    echo '</td>';
+    echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
+    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+    echo '</td></tr></table>';
+}
 
 print_footer();
 
index b3d242dcdf60481296611cf32ab5d982324a2ac2..89ec6b4373c2dd57c54c378de200715d0830718b 100644 (file)
@@ -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 '<table id="layout-table"><tr>';
-    echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
-    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
-    echo '</td>';
-    echo '<td id="middle-column" width="*">';
+        $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 
+                                               BLOCK_L_MAX_WIDTH);
+    
+        $PAGE->print_header();
+        echo '<table id="layout-table"><tr>';
+        echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
+        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+        echo '</td>';
+        echo '<td id="middle-column" width="*">';
+    } else {
+        print_header();
+    }
 
 }
 
 function admin_externalpage_print_footer($adminroot) {
 
-    echo '</td></tr></table>';
+    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 '</td>';
+        echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
+        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+        echo '</td></tr></table>';
+    }
+
     print_footer();
-    
 }
 
 function admin_get_root() {