]> git.mjollnir.org Git - moodle.git/commitdiff
blocks: MDL-19946 bugfixes for my previous commit.
authortjhunt <tjhunt>
Wed, 29 Jul 2009 03:19:43 +0000 (03:19 +0000)
committertjhunt <tjhunt>
Wed, 29 Jul 2009 03:19:43 +0000 (03:19 +0000)
lib/blocklib.php

index a2d221e2f7d4fb0cf928f238657f634dc9b46418..a880f988a0b77f48afc224dc362cdf5ccfe7cc08 100644 (file)
@@ -792,7 +792,7 @@ class block_manager {
 
         $block = $this->page->blocks->find_instance($blockid);
 
-        if (!$block->user_can_edit() || !$this->page->user_can_edit_blocks() || !$block->user_can_addto($page)) {
+        if (!$block->user_can_edit() || !$this->page->user_can_edit_blocks() || !$block->user_can_addto($this->page)) {
             throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('deleteablock'));
         }
 
@@ -859,7 +859,7 @@ class block_manager {
         $editpage = new moodle_page();
         $editpage->set_generaltype('form');
         $editpage->set_course($this->page->course);
-        $editpage->set_context($this->page->context);
+        $editpage->set_context($block->context);
         $editurlbase = str_replace($CFG->wwwroot . '/', '', $this->page->url->out(true));
         $editurlparams = $this->page->url->params();
         $editurlparams['bui_editid'] = $blockid;