| Server IP : 195.134.90.114 / Your IP : 216.73.216.86 Web Server : Apache/2.4.58 System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/public_html/lib/pkp/js/controllers/modal/ |
Upload File : |
/**
* @file js/controllers/modal/JsEventConfirmationModalHandler.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class JsEventConfirmationModalHandler
* @ingroup js_controllers_modal
*
* @brief A confirmation modal that generates a JS event.
*/
(function($) {
/**
* @constructor
*
* @extends $.pkp.controllers.modal.ConfirmationModalHandler
*
* @param {jQueryObject} $handledElement The clickable element
* the modal will be attached to.
* @param {Object} options Non-default options to configure
* the modal.
*
* Options are:
* - remoteUrl string A URL to be redirected to when the confirmation
* button has been clicked.
* - All options from the ConfirmationModalHandler and ModalHandler
* widgets.
* - All options documented for the jQueryUI dialog widget,
* except for the buttons parameter which is not supported.
*/
$.pkp.controllers.modal.JsEventConfirmationModalHandler =
function($handledElement, options) {
this.parent($handledElement, options);
// Configure the event to be generated when
// the modal closes.
this.jsEvent_ = options.jsEvent;
this.extraArguments_ = options.extraArguments;
};
$.pkp.classes.Helper.inherits(
$.pkp.controllers.modal.JsEventConfirmationModalHandler,
$.pkp.controllers.modal.ConfirmationModalHandler);
//
// Private properties
//
/**
* An event to be generated when the confirmation button
* has been clicked.
* @private
* @type {?string}
*/
$.pkp.controllers.modal.JsEventConfirmationModalHandler.prototype.
jsEvent_ = null;
/**
* An array of extra information to be passed along with the event.
* @private
* @type {?Array}
*/
$.pkp.controllers.modal.JsEventConfirmationModalHandler.prototype.
extraArguments_ = null;
//
// Protected methods
//
/** @inheritDoc */
$.pkp.controllers.modal.JsEventConfirmationModalHandler.prototype.
checkOptions = function(options) {
// Check the mandatory options of the ModalHandler handler.
if (!this.parent('checkOptions', options)) {
return false;
}
// Check for our own mandatory options.
// The cancel button and event are mandatory.
return typeof options.cancelButton === 'string' &&
typeof options.jsEvent === 'string';
};
//
// Public methods
//
/**
* Callback that will be activated when the modal's
* confirm button is clicked.
*
* @param {HTMLElement} dialogElement The element the
* dialog was created on.
* @param {Event} event The click event.
*/
$.pkp.controllers.modal.JsEventConfirmationModalHandler.prototype.
modalConfirm = function(dialogElement, event) {
this.trigger(/** @type {string} */ (this.jsEvent_),
/** @type {Array} */ (this.extraArguments_));
this.modalClose(dialogElement);
};
}(jQuery));