YUI.add('moodle-core-notification-confirm', function (Y, NAME) { /* eslint-disable no-unused-vars, no-unused-expressions */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, CONFIRMNO, TITLE, QUESTION, CSS; DIALOGUE_PREFIX = 'moodle-dialogue', BASE = 'notificationBase', CONFIRMYES = 'yesLabel', CONFIRMNO = 'noLabel', TITLE = 'title', QUESTION = 'question', CSS = { BASE: 'moodle-dialogue-base', WRAP: 'moodle-dialogue-wrap', HEADER: 'moodle-dialogue-hd', BODY: 'moodle-dialogue-bd', CONTENT: 'moodle-dialogue-content', FOOTER: 'moodle-dialogue-ft', HIDDEN: 'hidden', LIGHTBOX: 'moodle-dialogue-lightbox' }; // Set up the namespace once. M.core = M.core || {}; /* global CONFIRMYES, CONFIRMNO, QUESTION, BASE, TITLE, DIALOGUE_PREFIX */ /** * A dialogue type designed to display a confirmation to the user. * * @module moodle-core-notification * @submodule moodle-core-notification-confirm */ var CONFIRM_NAME = 'Moodle confirmation dialogue', CONFIRM; /** * Extends core Dialogue to show the confirmation dialogue. * * @param {Object} config Object literal specifying the dialogue configuration properties. * @constructor * @class M.core.confirm * @extends M.core.dialogue */ CONFIRM = function(config) { CONFIRM.superclass.constructor.apply(this, [config]); }; Y.extend(CONFIRM, M.core.notification.info, { /** * The list of events to detach when destroying this dialogue. * * @property _closeEvents * @type EventHandle[] * @private */ _closeEvents: null, /** * A reference to the yes button. * * @property _yesButton * @type Node * @private */ _yesButton: null, /** * A reference to the No button. * * @property _noButton * @type Node * @private */ _noButton: null, /** * A reference to the Question. * * @property _question * @type Node * @private */ _question: null, initializer: function() { this._closeEvents = []; this.publish('complete'); this.publish('complete-yes'); this.publish('complete-no'); this._yesButton = Y.Node.create(''); this._noButton = Y.Node.create(''); this._question = Y.Node.create('
'); var content = Y.Node.create('') .append(this._question) .append(Y.Node.create('') .append(this._yesButton) .append(this._noButton)); this.get(BASE).addClass('moodle-dialogue-confirm'); this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); this.setStdModContent(Y.WidgetStdMod.HEADER, '