From: defacer Date: Fri, 19 Nov 2004 03:01:31 +0000 (+0000) Subject: Updated the configuration-handling logic to the same level as the new instance- X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a177631062a37ab3e2f58e330f07526edb4c32f1;p=moodle.git Updated the configuration-handling logic to the same level as the new instance- configuration handlers. Much more easy to use and precise. --- diff --git a/admin/block.php b/admin/block.php index 755a3c141e..def37dd39a 100644 --- a/admin/block.php +++ b/admin/block.php @@ -30,17 +30,30 @@ error('Problem in instantiating block object'); } -/// If data submitted, then process and store. + // Define the data we're going to silently include in the instance config form here, + // so we can strip them from the submitted data BEFORE handling it. + $hiddendata = array( + 'block' => $blockid, + 'sesskey' => $USER->sesskey + ); + + /// If data submitted, then process and store. if ($config = data_submitted()) { - unset($config->block); // This will always be set if we have reached this point - $block->handle_config($config); + if(!$block->has_config()) { + error('This block does not support global configuration'); + } + $remove = array_keys($hiddendata); + foreach($remove as $item) { + unset($config->$item); + } + $block->config_save($config); print_header(); redirect("$CFG->wwwroot/$CFG->admin/blocks.php", get_string("changessaved"), 1); exit; } -/// Otherwise print the form. + /// Otherwise print the form. $stradmin = get_string('administration'); $strconfiguration = get_string('configuration'); @@ -57,8 +70,14 @@ print_simple_box('
'.get_string('configwarning').'
', 'center', '50%'); echo '
'; - $block->print_config(); - + echo '
'; + echo '

'; + foreach($hiddendata as $name => $val) { + echo ''; + } + echo '

'; + $block->config_print(); + echo '
'; print_footer(); ?>