Merge branch 'MDL-43538-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Sam Hemelryk 2014-02-04 14:17:39 +13:00
commit 5c876ed21f
3 changed files with 14 additions and 5 deletions

View File

@ -256,12 +256,12 @@ M.util.show_confirm_dialog = function(e, args) {
simpledialog.hide();
if (args.callback) {
// args comes from PHP, so callback will be a string, needs to be evaluated by JS
var callback = null;
if (Y.Lang.isFunction(args.callback)) {
callback = args.callback;
} else {
callback = eval('('+args.callback+')');
Y.log('Callbacks to show_confirm_dialog must now be functions. Please update your code to pass in a function instead.',
'warn', 'M.util.show_confirm_dialog');
}
if (Y.Lang.isObject(args.scope)) {

View File

@ -93,13 +93,19 @@ class confirm_action extends component_action {
*
* @param string $message The message to display to the user when they are shown
* the confirm dialogue.
* @param string $callback The method to call when the user confirms the action.
* @param string $callback Deprecated since 2.7
* @param string $continuelabel The string to use for he continue button
* @param string $cancellabel The string to use for the cancel button
*/
public function __construct($message, $callback = null, $continuelabel = null, $cancellabel = null) {
if ($callback !== null) {
debugging('The callback argument to new confirm_action() has been deprecated.' .
' If you need to use a callback, please write Javascript to use moodle-core-notification-confirmation ' .
'and attach to the provided events.',
DEBUG_DEVELOPER);
}
parent::__construct('click', 'M.util.show_confirm_dialog', array(
'message' => $message, 'callback' => $callback,
'message' => $message,
'continuelabel' => $continuelabel, 'cancellabel' => $cancellabel));
}
}
@ -197,4 +203,4 @@ class popup_action extends component_action {
return $jsoptions;
}
}
}

View File

@ -29,6 +29,9 @@ YUI:
JavaSript:
* The findChildNodes global function has been deprecated. Y.all should
be used instead.
* The callback argument to confirm_action and M.util.show_confirm_dialog has been deprecated. If you need to write a
confirmation which includes a callback, please use moodle-core-notification-confirmation and attach callbacks to the
events provided.
* New locking api and admin settings to configure the system locking type.