MDL-19797 Added callback support to the confirm_dialog function, and to the add_confirm_action() method

This commit is contained in:
nicolasconnault 2009-08-27 10:12:44 +00:00
parent eef00ade8f
commit 5529f787bd
2 changed files with 23 additions and 8 deletions

View file

@ -193,10 +193,12 @@ class moodle_html_component {
* Shortcut for adding a JS confirm dialog when the component is clicked.
* The message must be a yes/no question.
* @param string $message The yes/no confirmation question. If "Yes" is clicked, the original action will occur.
* @param string $callback The name of a JS function whose scope will be set to the simpleDialog object and have this
* function's arguments set as this.args.
* @return void
*/
public function add_confirm_action($message) {
$this->add_action(new component_action('click', 'confirm_dialog', array('message' => $message)));
public function add_confirm_action($message, $callback=null) {
$this->add_action(new component_action('click', 'confirm_dialog', array('message' => $message, 'callback' => $callback)));
}
/**