summaryrefslogtreecommitdiff
path: root/public_html/js
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 /public_html/js
parent6ec6d398a0ee9379f24afea531fad7bf2ed36480 (diff)
downloadkolab-wap-81e7e4d134bc667ca224474acaad422ffd21911e.tar.gz
Add confirmation dialog on object deletion action (Bug #2299)
Diffstat (limited to 'public_html/js')
-rw-r--r--public_html/js/kolab_admin.js31
1 files changed, 19 insertions, 12 deletions
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)
{