summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-31 12:44:48 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-31 12:44:48 +0200
commita8cb5e9802720d8d1b5931154f25f3afd3b96d5d (patch)
tree509039e7e682ed8fcc17f177955f4de607415230
parent4884ed6a5424034daff81dad0b09234a7303baed (diff)
downloadwebadmin-a8cb5e9802720d8d1b5931154f25f3afd3b96d5d.tar.gz
Update kolab_admin.js to realize the difference between selecting to add a user, and submitting a form to add a user
Same for groups
-rw-r--r--public_html/js/kolab_admin.js70
1 files changed, 68 insertions, 2 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 8279b0c..fe398f8 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1024,6 +1024,72 @@ function kolab_admin()
this.command('user.list', {page: page});
};
+ this.user_add = function(reload, section)
+ {
+ var data = this.serialize_form('#'+this.env.form_id);
+
+ if (reload || reload == '') {
+ // TODO: Not needed?
+ data.section = section;
+
+ this.http_post('user.add');
+ return;
+ }
+
+ this.form_error_clear();
+
+ // check password
+ if (data.userpassword != data.userpassword2) {
+ this.display_message('user.password.mismatch', 'error');
+ this.form_value_error('userpassword2');
+ return;
+ }
+
+ this.set_busy(true, 'saving');
+ this.api_post('user.add', data, 'user_add_response');
+ };
+
+ this.user_add_response = function(response)
+ {
+ if (!this.api_response(response))
+ return;
+
+ this.display_message('user.add.success');
+ this.command('user.list', {page: this.env.list_page});
+ };
+
+ this.user_edit = function(reload, section)
+ {
+ var data = this.serialize_form('#'+this.env.form_id);
+
+ if (reload) {
+ data.section = section;
+ this.http_post('user.edit', {data: data});
+ return;
+ }
+
+ this.form_error_clear();
+
+ // check password
+ if (data.userpassword != data.userpassword2) {
+ this.display_message('user.password.mismatch', 'error');
+ this.form_value_error('userpassword2');
+ return;
+ }
+
+ this.set_busy(true, 'saving');
+ this.api_post('user.edit', data, 'user_edit_response');
+ };
+
+ this.user_edit_response = function(response)
+ {
+ if (!this.api_response(response))
+ return;
+
+ this.display_message('user.edit.success');
+ this.command('user.list', {page: this.env.list_page});
+ };
+
this.user_save = function(reload, section)
{
var data = this.serialize_form('#'+this.env.form_id);
@@ -1097,9 +1163,9 @@ function kolab_admin()
{
var data = this.serialize_form('#'+this.env.form_id);
- if (reload) {
+ if (reload || reload == '') {
data.section = section;
- this.http_post('group.add', {data: data});
+ this.http_post('group.add');
return;
}