Commit 76f57b52 authored by Nigel McNie's avatar Nigel McNie
Browse files

Added success/failure messages when configuring a block

parent 6aa2686f
......@@ -199,6 +199,8 @@ class BlockInstance {
}
public function instance_config_store(Pieform $form, $values) {
global $SESSION;
// Destroy form values we don't care about
unset($values['sesskey']);
unset($values['blockinstance']);
......@@ -209,6 +211,7 @@ class BlockInstance {
}
set_field('block_instance', 'configdata', serialize($values), 'id', $this->get('id'));
$SESSION->add_ok_msg(get_string('blockinstanceconfiguredsuccessfully', 'view'));
redirect('/view/blocks.php?id=' . $this->get('view'));
}
......@@ -240,6 +243,11 @@ class BlockInstance {
require_once('pieforms/pieform.php');
$pieform = new Pieform($form);
if ($pieform->is_submitted()) {
global $SESSION;
$SESSION->add_error_msg(get_string('errorprocessingform'));
}
// This is a bit hacky. Because pieforms will take values from
// $_POST before 'defaultvalue's of form elements, we need to nuke
// all of the post values for the form. The situation where this
......
......@@ -79,6 +79,7 @@ $string['success.removecolumn'] = 'Deleted column successfully';
$string['err.removecolumn'] = 'Failed to delete column';
$string['confirmdeleteblockinstance'] = 'Are you sure you wish to delete this block?';
$string['blockinstanceconfiguredsuccessfully'] = 'Block configured successfully';
$string['addnewblockhere'] = 'Add new block here';
$string['addcolumn'] = 'Add column';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment