var $target = $(event.target);
if ($target.data('confirmMessage')) {
- if (confirm($target.data('confirmMessage'))) {
- this.proxy.showSpinner($target);
- this._sendRequest($target);
- }
+ WCF.System.Confirmation.show($target.data('confirmMessage'), $.proxy(this._execute, this), { target: $target });
}
else {
this.proxy.showSpinner($target);
this._sendRequest($target);
}
+ },
+
+ /**
+ * Executes deletion.
+ *
+ * @param string action
+ * @param object parameters
+ */
+ _execute: function(action, parameters) {
+ if (action === 'cancel') {
+ return;
+ }
+ this.proxy.showSpinner(parameters.target);
+ this._sendRequest(parameters.target);
},
_sendRequest: function(object) {
*/
_dialog: null,
+ /**
+ * callback parameters
+ * @var object
+ */
+ _parameters: null,
+
/**
* dialog visibility
* @var boolean
*
* @param string message
* @param object callback
+ * @param object parameters
*/
- show: function(message, callback) {
+ show: function(message, callback, parameters) {
if (this._visible) {
console.debug('[WCF.System.Confirmation] Confirmation dialog is already open, refusing action.');
return;
}
this._callback = callback;
+ this._parameters = parameters;
if (this._dialog === null) {
this._createDialog();
}
this._visible = false;
this._dialog.wcfDialog('close');
- this._callback(action);
+ this._callback(action, this._parameters);
},
/**