]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes for bug 1485:
authordefacer <defacer>
Tue, 1 Jun 2004 13:47:55 +0000 (13:47 +0000)
committerdefacer <defacer>
Tue, 1 Jun 2004 13:47:55 +0000 (13:47 +0000)
Now the site has blocks by default. Also, block panel width is restricted even
if there are no blocks to display.

admin/site.php
index.php

index 81e80f49db07e5943f8fae1674edc98d843ad3e4..ba9fe99f1fb0ab7e3d558f8822f77fbbe1630c41 100644 (file)
                     error("Serious Error! Could not update the site record! (id = $form->id)");
                 }
             } else {
+                // [pj] We are about to create the site, so let's add some blocks...
+                // calendar_month is included as a Moodle feature advertisement ;-)
+                require_once('../lib/blocklib.php');
+                $form->blockinfo = blocks_get_default_blocks(NULL, 'site_main_menu,admin,course_list:course_summary,calendar_month');
+
                 if ($newid = insert_record("course", $form)) {
                     $cat->name = get_string("miscellaneous");
                     if (insert_record("course_categories", $cat)) {
index 8f6311637a96edbcbd13ce48e88df2d6a1700597..4ddf7f75b87aa7b9f1773ec684d82cdab2d1cf8f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,6 +1,12 @@
 <?PHP  // $Id$
        // index.php - the front page.
 
+    // Bounds for block widths
+    define('BLOCK_L_MIN_WIDTH', 160);
+    define('BLOCK_L_MAX_WIDTH', 210);
+    define('BLOCK_R_MIN_WIDTH', 160);
+    define('BLOCK_R_MAX_WIDTH', 210);
+
     require_once("config.php");
     require_once("course/lib.php");
     require_once('lib/blocklib.php');
         $preferred_width_right = $SESSION->blockcache->width->{$site->id}->right;
     }
 
+    $preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
+    $preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
+    $preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
+    $preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
+
 ?>