Show confirm dialog when deleting an invite (if the user has already entered an email address)
This commit is contained in:
parent
04a593487a
commit
84c8ffc28a
|
@ -248,11 +248,25 @@ class DomainWhitelistPlugin extends Plugin
|
||||||
*/
|
*/
|
||||||
function onStartShowInviteForm($action)
|
function onStartShowInviteForm($action)
|
||||||
{
|
{
|
||||||
|
$this->showConfirmDialog($action);
|
||||||
$form = new WhitelistInviteForm($action, $this->getWhitelist());
|
$form = new WhitelistInviteForm($action, $this->getWhitelist());
|
||||||
$form->show();
|
$form->show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showConfirmDialog($action)
|
||||||
|
{
|
||||||
|
// For JQuery UI modal dialog
|
||||||
|
$action->elementStart(
|
||||||
|
'div',
|
||||||
|
// TRANS: Title for invitiation deletion dialog.
|
||||||
|
array('id' => 'confirm-dialog', 'title' => _m('Confirmation Required'))
|
||||||
|
);
|
||||||
|
// TRANS: Confirmation text for invitation deletion dialog.
|
||||||
|
$action->text(_m('Really delete this invitation?'));
|
||||||
|
$action->elementEnd('div');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a bit of a hack. We take the values from the custom
|
* This is a bit of a hack. We take the values from the custom
|
||||||
* whitelist invite form and reformat them so they look like
|
* whitelist invite form and reformat them so they look like
|
||||||
|
|
|
@ -27,14 +27,41 @@ SN_WHITELIST.addRow = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
SN_WHITELIST.removeRow = function() {
|
SN_WHITELIST.removeRow = function() {
|
||||||
$(this).closest("li").hide("blind", "slow", function() {
|
|
||||||
$(this).remove();
|
var that = this;
|
||||||
SN_WHITELIST.updateButtons();
|
|
||||||
|
$("#confirm-dialog").dialog({
|
||||||
|
buttons : {
|
||||||
|
"Confirm" : function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
$(that).closest("li").hide("blind", "slow", function() {
|
||||||
|
$(this).remove();
|
||||||
|
SN_WHITELIST.updateButtons();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"Cancel" : function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($(this).closest('li').find(':input[name^=username]').val()) {
|
||||||
|
$("#confirm-dialog").dialog("open");
|
||||||
|
} else {
|
||||||
|
$(that).closest("li").hide("blind", "slow", function() {
|
||||||
|
$(this).remove();
|
||||||
|
SN_WHITELIST.updateButtons();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#confirm-dialog").dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
modal: true
|
||||||
|
});
|
||||||
|
|
||||||
$('.add_row').live('click', SN_WHITELIST.addRow);
|
$('.add_row').live('click', SN_WHITELIST.addRow);
|
||||||
$('.remove_row').live('click', SN_WHITELIST.removeRow);
|
$('.remove_row').live('click', SN_WHITELIST.removeRow);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ class WhitelistInviteForm extends Form
|
||||||
$this->showMultiControls();
|
$this->showMultiControls();
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMultiControls()
|
function showMultiControls()
|
||||||
{
|
{
|
||||||
$this->out->element(
|
$this->out->element(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user