diff -Naur precenterblocks/course/format/topics/format.php postcenterblocks/course/format/topics/format.php --- precenterblocks/course/format/topics/format.php 2011-08-25 10:29:10.000000000 -0400 +++ postcenterblocks/course/format/topics/format.php 2011-08-25 11:36:33.873764267 -0400 @@ -13,18 +13,26 @@ // Bounds for block widths // more flexible for theme designers taken from theme config.php + /// denton: defined centre variables + $lmin = (empty($THEME->block_l_min_width)) ? 100 : $THEME->block_l_min_width; $lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width; + $cmin = (empty($THEME->block_c_min_width)) ? 400 : $THEME->block_c_min_width; + $cmax = (empty($THEME->block_c_max_width)) ? 600 : $THEME->block_c_max_width; $rmin = (empty($THEME->block_r_min_width)) ? 100 : $THEME->block_r_min_width; $rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width; define('BLOCK_L_MIN_WIDTH', $lmin); define('BLOCK_L_MAX_WIDTH', $lmax); + define('BLOCK_C_MIN_WIDTH', $cmin); + define('BLOCK_C_MAX_WIDTH', $cmax); define('BLOCK_R_MIN_WIDTH', $rmin); define('BLOCK_R_MAX_WIDTH', $rmax); - + $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); + $preferred_width_center = bounded_number(BLOCK_C_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_CENTER]), + BLOCK_C_MAX_WIDTH); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); @@ -89,7 +96,9 @@ case 'middle': /// Start main column echo ''; + print_container_start(); + echo skip_main_destination(); print_heading_block(get_string('topicoutline'), 'outline'); @@ -140,6 +149,12 @@ echo ''; } + if (blocks_have_content($pageblocks, BLOCK_POS_CENTER) || $editing) { + echo ''; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_CENTER); + echo ''; + echo ''; + } /// Now all the normal modules by topic /// Everything below uses "section" terminology - each "section" is a topic. diff -Naur precenterblocks/course/format/weeks/format.php postcenterblocks/course/format/weeks/format.php --- precenterblocks/course/format/weeks/format.php 2011-08-25 10:29:10.000000000 -0400 +++ postcenterblocks/course/format/weeks/format.php 2011-08-25 11:36:46.120052505 -0400 @@ -8,21 +8,30 @@ // Bounds for block widths // more flexible for theme designers taken from theme config.php + /// denton: defined centre variables $lmin = (empty($THEME->block_l_min_width)) ? 100 : $THEME->block_l_min_width; $lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width; + $cmin = (empty($THEME->block_c_min_width)) ? 400 : $THEME->block_c_min_width; + $cmax = (empty($THEME->block_c_max_width)) ? 600 : $THEME->block_c_max_width; $rmin = (empty($THEME->block_r_min_width)) ? 100 : $THEME->block_r_min_width; $rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width; + /// denton: added BLOCK_C_MIN_WIDTH and BLOCK_C_MAX_WIDTH define('BLOCK_L_MIN_WIDTH', $lmin); define('BLOCK_L_MAX_WIDTH', $lmax); + define('BLOCK_C_MIN_WIDTH', $cmin); + define('BLOCK_C_MAX_WIDTH', $cmax); define('BLOCK_R_MIN_WIDTH', $rmin); define('BLOCK_R_MAX_WIDTH', $rmax); + /// denton: added $preferred_width_center $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); - + $preferred_width_center = bounded_number(BLOCK_C_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_CENTER]), + BLOCK_C_MAX_WIDTH); + if ($week != -1) { $displaysection = course_set_display($course->id, $week); } else { @@ -127,7 +135,13 @@ echo ''; } - + + if (blocks_have_content($pageblocks, BLOCK_POS_CENTER) || $editing) { + echo ''; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_CENTER); + echo ''; + echo ''; + } /// Now all the normal modules by week /// Everything below uses "section" terminology - each "section" is a week. diff -Naur precenterblocks/index.php postcenterblocks/index.php --- precenterblocks/index.php 2011-08-25 08:49:04.000000000 -0400 +++ postcenterblocks/index.php 2011-08-25 15:47:38.167489484 -0400 @@ -29,7 +29,7 @@ header('Location: install.php'); die; } - + require_once('config.php'); require_once($CFG->dirroot .'/course/lib.php'); require_once($CFG->dirroot .'/lib/blocklib.php'); @@ -37,16 +37,20 @@ if (empty($SITE)) { redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php'); } - + // Bounds for block widths // more flexible for theme designers taken from theme config.php $lmin = (empty($THEME->block_l_min_width)) ? 100 : $THEME->block_l_min_width; - $lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width; - $rmin = (empty($THEME->block_r_min_width)) ? 100 : $THEME->block_r_min_width; - $rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width; + $lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width; + $cmin = (empty($THEME->block_c_min_width)) ? 400 : $THEME->block_c_min_width; + $cmax = (empty($THEME->block_c_max_width)) ? 600 : $THEME->block_c_max_width; + $rmin = (empty($THEME->block_r_min_width)) ? 100 : $THEME->block_r_min_width; + $rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width; define('BLOCK_L_MIN_WIDTH', $lmin); define('BLOCK_L_MAX_WIDTH', $lmax); + define('BLOCK_C_MIN_WIDTH', $cmin); + define('BLOCK_C_MAX_WIDTH', $cmax); define('BLOCK_R_MIN_WIDTH', $rmin); define('BLOCK_R_MAX_WIDTH', $rmax); @@ -107,6 +113,8 @@ $editing = $PAGE->user_is_editing(); $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); + $preferred_width_center = bounded_number(BLOCK_C_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_CENTER]), + BLOCK_C_MAX_WIDTH); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); print_header($SITE->fullname, $SITE->fullname, 'home', '', @@ -132,8 +140,15 @@ } break; case 'middle': - echo ''. skip_main_destination(); - + echo '';//. skip_main_destination(); +/* + /// aartiles: Added a center blocks position + if (blocks_have_content($pageblocks, BLOCK_POS_CENTER) || $editing) { + //echo ''; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_CENTER); + //echo ''; + } +*/ print_container_start(); /// Print Section @@ -253,7 +268,13 @@ } echo '
'; } - + + /// aartiles: Added a center blocks position + if (blocks_have_content($pageblocks, BLOCK_POS_CENTER) || $editing) { + //echo ''; + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_CENTER); + //echo ''; + } print_container_end(); echo ''; diff -Naur precenterblocks/lib/blocklib.php postcenterblocks/lib/blocklib.php --- precenterblocks/lib/blocklib.php 2011-08-25 13:20:30.963526986 -0400 +++ postcenterblocks/lib/blocklib.php 2011-08-25 11:37:08.918608567 -0400 @@ -9,6 +9,7 @@ define('BLOCK_CONFIGURE', 0x10); define('BLOCK_POS_LEFT', 'l'); +define('BLOCK_POS_CENTER', 'c'); define('BLOCK_POS_RIGHT', 'r'); define('BLOCKS_PINNED_TRUE',0); diff -Naur precenterblocks/lib/pagelib.php postcenterblocks/lib/pagelib.php --- precenterblocks/lib/pagelib.php 2011-08-25 08:48:47.000000000 -0400 +++ postcenterblocks/lib/pagelib.php 2011-08-25 11:37:15.593012810 -0400 @@ -500,7 +500,7 @@ // directly to the first item of the array you return here, the second to the next one and so on. This way, // you can add more positions in the future without interfering with legacy textual representations. function blocks_get_positions() { - return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT); + return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT, BLOCK_POS_CENTER); } // When a new block is created in this page, which position should it go to? @@ -562,9 +562,13 @@ // modify its data in any way, this will actually confuse blocklib!!! function blocks_move_position(&$instance, $move) { if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) { + return BLOCK_POS_CENTER; + } else if($instance->position == BLOCK_POS_CENTER && $move == BLOCK_MOVE_RIGHT) { return BLOCK_POS_RIGHT; - } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) { + } else if ($instance->position == BLOCK_POS_CENTER && $move == BLOCK_MOVE_LEFT) { return BLOCK_POS_LEFT; + } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) { + return BLOCK_POS_CENTER; } return $instance->position; }