Permalink
Browse files

Revert "MDL-32652 - Make block drag-drop work throughout Moodle"

This reverts commit d7c29c2.
  • Loading branch information...
danpoltawski committed Jan 25, 2013
1 parent a42a787 commit dec70f2599530ab36a39e67fc56ffd4cf6a97903
Showing with 11 additions and 41 deletions.
  1. +10 −0 course/lib.php
  2. +0 −14 lib/ajax/blocks.php
  3. +0 −15 lib/outputrequirementslib.php
  4. +1 −12 lib/yui/blocks/blocks.js
View
@@ -3832,6 +3832,16 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
)), null, true);
}
+ // Include blocks dragdrop
+ $params = array(
+ '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);
+
// Require various strings for the command toolbox
$PAGE->requires->strings_for_js(array(
'moveleft',
View
@@ -53,20 +53,6 @@
// Setting layout to replicate blocks configuration for the page we edit
$PAGE->set_pagelayout($pagelayout);
$PAGE->set_subpage($subpage);
-$pagetype = explode('-', $pagetype);
-switch ($pagetype[0]) {
- case 'admin':
- // Admin pages need to be in the system context, not Site Course context.
- $PAGE->set_context(context_system::instance());
- break;
- case 'my':
- // My Home page needs to be in user context, and to have 'content' block region set up.
- $PAGE->set_context(context_user::instance($USER->id));
- $PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
- $PAGE->blocks->add_region('content');
- break;
-}
-
echo $OUTPUT->header(); // send headers
switch ($action) {
@@ -282,21 +282,6 @@ protected function init_requirements_data(moodle_page $page, core_renderer $rend
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
-
- // Include block drag/drop if editing is on
- if ($page->user_is_editing()) {
- $params = array(
- 'courseid' => $page->course->id,
- 'pagetype' => $page->pagetype,
- 'pagelayout' => $page->pagelayout,
- 'subpage' => $page->subpage,
- 'regions' => $page->blocks->get_regions(),
- );
- if (!empty($page->cm->id)) {
- $params['cmid'] = $page->cm->id;
- }
- $page->requires->yui_module('moodle-core-blocks', 'M.core_blocks.init_dragdrop', array($params), null, true);
- }
}
/**
View
@@ -10,9 +10,7 @@ YUI.add('moodle-core-blocks', function(Y) {
LIGHTBOX : 'lightbox',
REGIONCONTENT : 'region-content',
SKIPBLOCK : 'skip-block',
- SKIPBLOCKTO : 'skip-block-to',
- MYINDEX : 'page-my-index',
- REGIONMAIN : 'region-main'
+ SKIPBLOCKTO : 'skip-block-to'
}
var DRAGBLOCK = function() {
@@ -28,15 +26,6 @@ YUI.add('moodle-core-blocks', function(Y) {
this.samenodeclass = CSS.BLOCK;
this.parentnodeclass = CSS.REGIONCONTENT;
- // Add relevant classes and ID to 'content' block region on My Home page.
- var myhomecontent = Y.Node.all('body#'+CSS.MYINDEX+' #'+CSS.REGIONMAIN+' > .'+CSS.REGIONCONTENT);
- if (myhomecontent.size() > 0) {
- var contentregion = myhomecontent.item(0);
- contentregion.addClass(CSS.BLOCKREGION);
- contentregion.set('id', CSS.REGIONCONTENT);
- contentregion.one('div').addClass(CSS.REGIONCONTENT);
- }
-
// Initialise blocks dragging
// Find all block regions on the page
var blockregionlist = Y.Node.all('div.'+CSS.BLOCKREGION);

0 comments on commit dec70f2

Please sign in to comment.