summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-12-05 13:12:04 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2012-12-05 13:12:04 (GMT)
commit6f4f949f8f38df8ec8699da9cdb790aeb34d320b (patch)
tree8b0f5bdbe78c6610c12596123b459c2884a9af53
parent56928b74ebb2a24b425d24706d3302ca004249b2 (diff)
downloadroundcubemail-plugins-kolab-6f4f949f8f38df8ec8699da9cdb790aeb34d320b.tar.gz
Make optional ACL removal on delegate deletion, added checkbox in confirmation dialog
-rw-r--r--plugins/kolab_delegation/kolab_delegation.js28
-rw-r--r--plugins/kolab_delegation/kolab_delegation.php4
-rw-r--r--plugins/kolab_delegation/localization/en_US.inc4
-rw-r--r--plugins/kolab_delegation/skins/classic/style.css8
-rw-r--r--plugins/kolab_delegation/skins/classic/templates/settings.html5
-rw-r--r--plugins/kolab_delegation/skins/larry/style.css12
-rw-r--r--plugins/kolab_delegation/skins/larry/templates/settings.html5
7 files changed, 61 insertions, 5 deletions
diff --git a/plugins/kolab_delegation/kolab_delegation.js b/plugins/kolab_delegation/kolab_delegation.js
index 9b08dc9..2462fa3 100644
--- a/plugins/kolab_delegation/kolab_delegation.js
+++ b/plugins/kolab_delegation/kolab_delegation.js
@@ -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
diff --git a/plugins/kolab_delegation/kolab_delegation.php b/plugins/kolab_delegation/kolab_delegation.php
index 07be816..b388234 100644
--- a/plugins/kolab_delegation/kolab_delegation.php
+++ b/plugins/kolab_delegation/kolab_delegation.php
@@ -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');
diff --git a/plugins/kolab_delegation/localization/en_US.inc b/plugins/kolab_delegation/localization/en_US.inc
index fed8e4c..c445f7f 100644
--- a/plugins/kolab_delegation/localization/en_US.inc
+++ b/plugins/kolab_delegation/localization/en_US.inc
@@ -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.';
diff --git a/plugins/kolab_delegation/skins/classic/style.css b/plugins/kolab_delegation/skins/classic/style.css
index c01a70b..db22720 100644
--- a/plugins/kolab_delegation/skins/classic/style.css
+++ b/plugins/kolab_delegation/skins/classic/style.css
@@ -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;
+}
diff --git a/plugins/kolab_delegation/skins/classic/templates/settings.html b/plugins/kolab_delegation/skins/classic/templates/settings.html
index ac701ff..af75c32 100644
--- a/plugins/kolab_delegation/skins/classic/templates/settings.html
+++ b/plugins/kolab_delegation/skins/classic/templates/settings.html
@@ -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>
diff --git a/plugins/kolab_delegation/skins/larry/style.css b/plugins/kolab_delegation/skins/larry/style.css
index 41402aa..35c1bf6 100644
--- a/plugins/kolab_delegation/skins/larry/style.css
+++ b/plugins/kolab_delegation/skins/larry/style.css
@@ -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;
+}
diff --git a/plugins/kolab_delegation/skins/larry/templates/settings.html b/plugins/kolab_delegation/skins/larry/templates/settings.html
index 0446345..b0842f2 100644
--- a/plugins/kolab_delegation/skins/larry/templates/settings.html
+++ b/plugins/kolab_delegation/skins/larry/templates/settings.html
@@ -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>