summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-10-29 14:41:59 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-11-18 14:51:56 (GMT)
commit81e7e4d134bc667ca224474acaad422ffd21911e (patch)
tree36fdddcbbd485aef5c6145bc828e436705a5de78
parent6ec6d398a0ee9379f24afea531fad7bf2ed36480 (diff)
downloadkolab-wap-81e7e4d134bc667ca224474acaad422ffd21911e.tar.gz
Add confirmation dialog on object deletion action (Bug #2299)
-rw-r--r--lib/kolab_client_task.php2
-rw-r--r--lib/locale/en_US.php7
-rw-r--r--public_html/js/kolab_admin.js31
3 files changed, 27 insertions, 13 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 2aedb27..c845126 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1369,7 +1369,7 @@ class kolab_client_task
$this->output->set_env('autocomplete_min_length', $ac_min_len);
$this->output->add_translation('form.required.empty', 'form.maxcount.exceeded',
$name . '.add.success', $name . '.edit.success', $name . '.delete.success',
- 'add', 'edit', 'delete');
+ $name . '.delete.confirm', 'add', 'edit', 'delete');
return $form;
}
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index b9e2d6a..bc42754 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -48,6 +48,7 @@ $LANG['deleting'] = 'Deleting data...';
$LANG['domain.add'] = 'Add Domain';
$LANG['domain.add.success'] = 'Domain created successfully.';
$LANG['domain.associateddomain'] = 'Domain name(s)';
+$LANG['domain.delete.confirm'] = 'Are you sure, you want to delete this domain?';
$LANG['domain.delete.success'] = 'Domain deleted successfully.';
$LANG['domain.edit'] = 'Edit domain';
$LANG['domain.edit.success'] = 'Domain updated successfully.';
@@ -69,6 +70,7 @@ $LANG['form.maxcount.exceeded'] = 'Maximum count of items exceeded!';
$LANG['group.add'] = 'Add Group';
$LANG['group.add.success'] = 'Group created successfully.';
$LANG['group.cn'] = 'Common name';
+$LANG['group.delete.confirm'] = 'Are you sure, you want to delete this group?';
$LANG['group.delete.success'] = 'Group deleted successfully.';
$LANG['group.edit.success'] = 'Group updated successfully.';
$LANG['group.gidnumber'] = 'Primary group number';
@@ -128,6 +130,7 @@ $LANG['resource.add'] = 'Add Resource';
$LANG['resource.add.success'] = 'Resource created successfully.';
$LANG['resource.cn'] = 'Name';
$LANG['resource.delete'] = 'Delete Resource';
+$LANG['resource.delete.confirm'] = 'Are you sure, you want to delete this resource?';
$LANG['resource.delete.success'] = 'Resource deleted successfully.';
$LANG['resource.edit'] = 'Edit Resource';
$LANG['resource.edit.success'] = 'Resource updated successfully.';
@@ -144,6 +147,7 @@ $LANG['resource.uniquemember'] = 'Collection Members';
$LANG['role.add'] = 'Add Role';
$LANG['role.add.success'] = 'Role created successfully.';
$LANG['role.cn'] = 'Role Name';
+$LANG['role.delete.confirm'] = 'Are you sure, you want to delete this role?';
$LANG['role.delete.success'] = 'Role deleted successfully.';
$LANG['role.description'] = 'Role Description';
$LANG['role.edit.success'] = 'Role updated successfully.';
@@ -178,6 +182,7 @@ $LANG['sharedfolder.add'] = 'Add Shared Folder';
$LANG['sharedfolder.add.success'] = 'Shared folder created successfully.';
$LANG['sharedfolder.alias'] = 'Secondary Email Address(es)';
$LANG['sharedfolder.cn'] = 'Folder Name';
+$LANG['sharedfolder.delete.confirm'] = 'Are you sure, you want to delete this shared folder?';
$LANG['sharedfolder.delete.success'] = 'Shared folder deleted successfully.';
$LANG['sharedfolder.edit'] = 'Edit Shared Folder';
$LANG['sharedfolder.edit.success'] = 'Shared folder updated successfully.';
@@ -212,6 +217,7 @@ $LANG['type.add'] = 'Add Object Type';
$LANG['type.add.success'] = 'Object type created successfully.';
$LANG['type.attributes'] = 'Attributes';
$LANG['type.description'] = 'Description';
+$LANG['type.delete.confirm'] = 'Are you sure, you want to delete this object type?';
$LANG['type.delete.success'] = 'Object type deleted successfully.';
$LANG['type.domain'] = 'Domain';
$LANG['type.edit.success'] = 'Object type updated successfully.';
@@ -259,6 +265,7 @@ $LANG['user.contact'] = 'Contact';
$LANG['user.contact_info'] = 'Contact Information';
$LANG['user.country'] = 'Country';
$LANG['user.country.desc'] = '2 letter code from ISO 3166-1';
+$LANG['user.delete.confirm'] = 'Are you sure, you want to delete this user?';
$LANG['user.delete.success'] = 'User deleted successfully.';
$LANG['user.displayname'] = 'Display name';
$LANG['user.edit.success'] = 'User updated successfully.';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index af2463f..4df6339 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1405,8 +1405,7 @@ function kolab_admin()
this.domain_delete = function(id)
{
- this.set_busy(true, 'deleting');
- this.api_post('domain.delete', {'id': id}, 'domain_delete_response');
+ this.delete_handler(id, 'domain');
};
this.domain_save = function(reload, section)
@@ -1458,8 +1457,7 @@ function kolab_admin()
this.user_delete = function(id)
{
- this.set_busy(true, 'deleting');
- this.api_post('user.delete', {'id': id}, 'user_delete_response');
+ this.delete_handler(id, 'user');
};
this.user_save = function(reload, section)
@@ -1519,8 +1517,7 @@ function kolab_admin()
this.group_delete = function(id)
{
- this.set_busy(true, 'deleting');
- this.api_post('group.delete', {'id': id}, 'group_delete_response');
+ this.delete_handler(id, 'group');
};
this.group_save = function(reload, section)
@@ -1572,8 +1569,7 @@ function kolab_admin()
this.resource_delete = function(id)
{
- this.set_busy(true, 'deleting');
- this.api_post('resource.delete', {'id': id}, 'resource_delete_response');
+ this.delete_handler(id, 'resource');
};
this.resource_save = function(reload, section)
@@ -1625,8 +1621,7 @@ function kolab_admin()
this.role_delete = function(id)
{
- this.set_busy(true, 'deleting');
- this.api_post('role.delete', {'id': id}, 'role_delete_response');
+ this.delete_handler(id, 'role');
};
this.role_save = function(reload, section)
@@ -1678,8 +1673,7 @@ function kolab_admin()
this.sharedfolder_delete = function(id)
{
- this.set_busy(true, 'deleting');
- this.api_post('sharedfolder.delete', {'id': id}, 'sharedfolder_delete_response');
+ this.delete_handler(id, 'sharedfolder');
};
this.sharedfolder_save = function(reload, section)
@@ -1744,6 +1738,9 @@ function kolab_admin()
this.type_delete = function(id)
{
+ if (!confirm(this.t('type.delete.confirm')))
+ return;
+
this.set_busy(true, 'deleting');
this.api_post('type.delete', this.type_id_parse(id), 'type_delete_response');
};
@@ -1896,6 +1893,16 @@ function kolab_admin()
this.http_post(type + '.list', props);
};
+ // universal object delete handler
+ this.delete_handler = function(id, type)
+ {
+ if (!confirm(this.t(type + '.delete.confirm')))
+ return;
+
+ this.set_busy(true, 'deleting');
+ this.api_post(type + '.delete', {'id': id}, type + '_delete_response');
+ };
+
// Parses object type identifier
this.type_id_parse = function(id)
{