summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-12-22 12:37:04 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-12-22 12:37:04 (GMT)
commitfe1b62972aa0ec01b5a995b39f914cb2c50c8f31 (patch)
treeebd9e9fb445f08dc098051becd0bdbecdc111099
parent47b1217a1c494dc428f4ff16e026f44abd3f3ed3 (diff)
downloadkolab-wap-fe1b62972aa0ec01b5a995b39f914cb2c50c8f31.tar.gz
Fix bug where "loading..." message wasn't hidden on request validation errors
-rw-r--r--public_html/js/kolab_admin.js64
1 files changed, 33 insertions, 31 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 007c45c..ca06ed3 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -104,6 +104,9 @@ function kolab_admin()
$('li', $('#navigation')).removeClass('active');
$('li.'+task, ('#navigation')).addClass('active');
+ if (ret === false)
+ this.set_busy(false);
+
return ret === false ? false : obj ? false : true;
};
@@ -2312,12 +2315,12 @@ function kolab_admin()
this.domain_delete = function(id)
{
this.env.delete_domain_id = id;
- this.delete_handler(id, 'domain');
+ return this.delete_handler(id, 'domain');
};
this.domain_save = function(reload, section)
{
- this.save_handler('domain', reload, section);
+ return this.save_handler('domain', reload, section);
};
this.domain_delete_response = function(response)
@@ -2366,12 +2369,12 @@ function kolab_admin()
this.user_list = function(props)
{
- this.list_handler('user', props);
+ return this.list_handler('user', props);
};
this.user_delete = function(id)
{
- this.delete_handler(id, 'user');
+ return this.delete_handler(id, 'user');
};
this.user_save = function(reload, section)
@@ -2388,7 +2391,7 @@ function kolab_admin()
return data;
};
- this.save_handler('user', reload, section, validate);
+ return this.save_handler('user', reload, section, validate);
};
this.user_delete_response = function(response)
@@ -2413,17 +2416,17 @@ function kolab_admin()
this.group_list = function(props)
{
- this.list_handler('group', props);
+ return this.list_handler('group', props);
};
this.group_delete = function(id)
{
- this.delete_handler(id, 'group');
+ return this.delete_handler(id, 'group');
};
this.group_save = function(reload, section)
{
- this.save_handler('group', reload, section);
+ return this.save_handler('group', reload, section);
};
this.group_delete_response = function(response)
@@ -2448,17 +2451,17 @@ function kolab_admin()
this.ou_list = function(props)
{
- this.list_handler('ou', props);
+ return this.list_handler('ou', props);
};
this.ou_delete = function(id)
{
- this.delete_handler(id, 'ou');
+ return this.delete_handler(id, 'ou');
};
this.ou_save = function(reload, section)
{
- this.save_handler('ou', reload, section);
+ return this.save_handler('ou', reload, section);
};
this.ou_delete_response = function(response)
@@ -2483,17 +2486,17 @@ function kolab_admin()
this.resource_list = function(props)
{
- this.list_handler('resource', props);
+ return this.list_handler('resource', props);
};
this.resource_delete = function(id)
{
- this.delete_handler(id, 'resource');
+ return this.delete_handler(id, 'resource');
};
this.resource_save = function(reload, section)
{
- this.save_handler('resource', reload, section);
+ return this.save_handler('resource', reload, section);
};
this.resource_delete_response = function(response)
@@ -2518,17 +2521,17 @@ function kolab_admin()
this.role_list = function(props)
{
- this.list_handler('role', props);
+ return this.list_handler('role', props);
};
this.role_delete = function(id)
{
- this.delete_handler(id, 'role');
+ return this.delete_handler(id, 'role');
};
this.role_save = function(reload, section)
{
- this.save_handler('role', reload, section);
+ return this.save_handler('role', reload, section);
};
this.role_delete_response = function(response)
@@ -2553,17 +2556,17 @@ function kolab_admin()
this.sharedfolder_list = function(props)
{
- this.list_handler('sharedfolder', props);
+ return this.list_handler('sharedfolder', props);
};
this.sharedfolder_delete = function(id)
{
- this.delete_handler(id, 'sharedfolder');
+ return this.delete_handler(id, 'sharedfolder');
};
this.sharedfolder_save = function(reload, section)
{
- this.save_handler('sharedfolder', reload, section);
+ return this.save_handler('sharedfolder', reload, section);
};
this.sharedfolder_delete_response = function(response)
@@ -2606,11 +2609,7 @@ 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');
+ return this.delete_handler(this.type_id_parse(id), 'type');
};
this.type_save = function(reload, section)
@@ -2630,12 +2629,12 @@ function kolab_admin()
if (!this.check_required_fields(data)) {
this.display_message('form.required.empty', 'error');
- return;
+ return false;
}
if (data.key.match(/[^a-z_-]/)) {
this.display_message('attribute.key.invalid', 'error');
- return;
+ return false;
}
request.id = data.id;
@@ -2701,7 +2700,7 @@ function kolab_admin()
if (required.length) {
this.display_message(this.t('attribute.required.error').replace(/\$1/, required.join(',')), 'error');
- return;
+ return false;
}
this.set_busy(true, 'saving');
@@ -2766,13 +2765,16 @@ function kolab_admin()
};
// universal object delete handler
- this.delete_handler = function(id, type)
+ this.delete_handler = function(request, type)
{
if (!confirm(this.t(type + '.delete.confirm')))
- return;
+ return false;
+
+ if (typeof request != 'object')
+ request = {'id': request};
this.set_busy(true, 'deleting');
- this.api_post(type + '.delete', {'id': id}, type + '_delete_response');
+ this.api_post(type + '.delete', request, type + '_delete_response');
};
// universal form save handler