diff --git a/course/lib.php b/course/lib.php index 0029b8056fe..f844bc564df 100644 --- a/course/lib.php +++ b/course/lib.php @@ -4493,6 +4493,7 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules = 'courseid' => $course->id, 'pagetype' => $PAGE->pagetype, 'pagelayout' => $PAGE->pagelayout, + 'subpage' => $PAGE->subpage, 'regions' => $PAGE->blocks->get_regions(), ); $PAGE->requires->yui_module('moodle-core-blocks', 'M.core_blocks.init_dragdrop', array($params), null, true); diff --git a/lib/ajax/blocks.php b/lib/ajax/blocks.php index 041190ad91b..470106d071c 100644 --- a/lib/ajax/blocks.php +++ b/lib/ajax/blocks.php @@ -30,6 +30,7 @@ require_once(dirname(__FILE__) . '/../../config.php'); $courseid = required_param('courseid', PARAM_INT); $pagelayout = required_param('pagelayout', PARAM_ALPHAEXT); $pagetype = required_param('pagetype', PARAM_ALPHAEXT); +$subpage = optional_param('subpage', '', PARAM_ALPHANUMEXT); $cmid = optional_param('cmid', null, PARAM_INT); $action = optional_param('action', '', PARAM_ALPHA); // Params for blocks-move actions @@ -51,6 +52,7 @@ require_sesskey(); // Setting layout to replicate blocks configuration for the page we edit $PAGE->set_pagelayout($pagelayout); +$PAGE->set_subpage($subpage); echo $OUTPUT->header(); // send headers switch ($action) { diff --git a/lib/yui/blocks/blocks.js b/lib/yui/blocks/blocks.js index 0975b879f9f..edb655fa048 100644 --- a/lib/yui/blocks/blocks.js +++ b/lib/yui/blocks/blocks.js @@ -99,7 +99,13 @@ YUI.add('moodle-core-blocks', function(Y) { }, get_block_region : function(node) { - return node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region/i, 'side'); + var region = node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region-/i, ''); + if (Y.Array.indexOf(this.get('regions'), region) === -1) { + // Must be standard side-X + return 'side-' + region; + } + // Perhaps custom region + return region; }, get_region_id : function(node) { @@ -207,6 +213,7 @@ YUI.add('moodle-core-blocks', function(Y) { courseid : this.get('courseid'), pagelayout : this.get('pagelayout'), pagetype : this.get('pagetype'), + subpage : this.get('subpage'), action : 'move', bui_moveid : this.get_block_id(dragnode), bui_newregion : this.get_block_region(dropnode) @@ -262,6 +269,9 @@ YUI.add('moodle-core-blocks', function(Y) { pagetype : { value : null }, + subpage : { + value : null + }, regions : { value : null }