Make optional ACL removal on delegate deletion, added checkbox in confirmation dialog

This commit is contained in:
Aleksander Machniak 2012-12-05 14:12:04 +01:00
parent 56928b74eb
commit 6f4f949f8f
7 changed files with 61 additions and 5 deletions

View file

@ -130,10 +130,32 @@ rcube_webmail.prototype.delegate_add = function()
// handler for delete commands
rcube_webmail.prototype.delegate_delete = function()
{
if (this.env.active_delegate && confirm(this.gettext('delegatedeleteconfirm', 'kolab_delegation'))) {
var lock = this.set_busy(true, 'kolab_delegation.savingdata');
this.http_post('plugin.delegation-delete', {id: this.env.active_delegate}, lock);
if (!this.env.active_delegate)
return;
var $dialog = $("#delegate-delete-dialog").addClass('uidialog'),
buttons = {};
buttons[this.gettext('no', 'kolab_delegation')] = function() {
$dialog.dialog('close');
};
buttons[this.gettext('yes', 'kolab_delegation')] = function() {
$dialog.dialog('close');
var lock = rcmail.set_busy(true, 'kolab_delegation.savingdata');
rcmail.http_post('plugin.delegation-delete', {id: rcmail.env.active_delegate,
acl: $("#delegate-delete-dialog input:checked").length}, lock);
}
// open jquery UI dialog
$dialog.dialog({
modal: true,
resizable: false,
closeOnEscape: true,
title: this.gettext('deleteconfirm', 'kolab_delegation'),
close: function() { $dialog.dialog('destroy').hide(); },
buttons: buttons,
width: 400
}).show();
};
// submit delegate form to the server

View file

@ -51,7 +51,7 @@ class kolab_delegation extends rcube_plugin
$this->register_action('plugin.delegation-autocomplete', array($this, 'controller_action'));
if ($this->rc->action == 'plugin.delegation' || empty($_REQUEST['_framed'])) {
$this->add_texts('localization/', array('tabtitle', 'delegatedeleteconfirm', 'savingdata'));
$this->add_texts('localization/', array('tabtitle', 'deleteconfirm', 'savingdata', 'yes', 'no'));
$this->include_script('kolab_delegation.js');
$skin_path = $this->local_skin_path();
$this->include_stylesheet("$skin_path/style.css");
@ -221,7 +221,7 @@ class kolab_delegation extends rcube_plugin
// Delegate delete
if ($this->rc->action == 'plugin.delegation-delete') {
$id = get_input_value('id', RCUBE_INPUT_GPC);
$success = $engine->delegate_delete($id, true);
$success = $engine->delegate_delete($id, (bool) get_input_value('acl', RCUBE_INPUT_GPC));
if ($success) {
$this->rc->output->show_message($this->gettext('deletesuccess'), 'confirmation');

View file

@ -10,12 +10,16 @@ $labels['contact'] = 'Address Books';
$labels['event'] = 'Calendars';
$labels['task'] = 'Tasks';
$labels['note'] = 'Notes';
$labels['yes'] = 'Yes';
$labels['no'] = 'No';
$labels['adddelegate'] = 'Add delegate';
$labels['deletedelegate'] = 'Delete delegate';
$labels['savingdata'] = 'Saving data...';
$labels['delegatedeleteconfirm'] = 'Do you really want to delete this delegate?';
$labels['delegateremoveacl'] = 'remove access rights on folders assigned to this user';
$labels['deleteconfirm'] = 'Confirmation';
$labels['deletesuccess'] = 'The delegate was successfully removed.';
$labels['deleteerror'] = 'Could not remove delegate.';
$labels['updatesuccess'] = 'The delegate was successfully updated.';

View file

@ -84,3 +84,11 @@ div.foldersblock h3.note {
overflow: auto;
margin-top: 0.5em;
}
#delegate-delete-dialog {
display: none;
}
#delegate-delete-dialog p {
font-weight: bold;
}

View file

@ -35,5 +35,10 @@
</div>
<div id="delegate-delete-dialog">
<p><roundcube:label name="kolab_delegation.delegatedeleteconfirm" /></p>
<span><input type="checkbox" value="1" checked="checked" /><roundcube:label name="kolab_delegation.delegateremoveacl" /></span>
</div>
</body>
</html>

View file

@ -102,3 +102,15 @@ div.foldersblock h3.note {
overflow: auto;
margin-top: 0.5em;
}
#delegate-delete-dialog {
display: none;
}
#delegate-delete-dialog p {
font-weight: bold;
}
#delegate-delete-dialog input {
vertical-align: middle;
}

View file

@ -44,5 +44,10 @@
</script>
<div id="delegate-delete-dialog">
<p><roundcube:label name="kolab_delegation.delegatedeleteconfirm" /></p>
<span><input type="checkbox" value="1" checked="checked" /><roundcube:label name="kolab_delegation.delegateremoveacl" /></span>
</div>
</body>
</html>