summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-02-21 19:37:11 +0100
committerAleksander Machniak <alec@alec.pl>2012-02-21 19:37:11 +0100
commit53bcfa4b7d47d67d5ed260703fbd115340a83b92 (patch)
tree19d6131b686cd473eeee7f09614e7c7f39b78f52
parent894e231599cc80a38f767ed24e31d09dbdef3782 (diff)
downloadwebadmin-53bcfa4b7d47d67d5ed260703fbd115340a83b92.tar.gz
Implemented user.delete action, some improvements in user.add
-rw-r--r--lib/client/kolab_client_task_main.php2
-rw-r--r--lib/client/kolab_client_task_user.php7
-rw-r--r--lib/locale/en_US.php6
-rw-r--r--public_html/js/kolab_admin.js20
4 files changed, 29 insertions, 6 deletions
diff --git a/lib/client/kolab_client_task_main.php b/lib/client/kolab_client_task_main.php
index 63735c2..c89f881 100644
--- a/lib/client/kolab_client_task_main.php
+++ b/lib/client/kolab_client_task_main.php
@@ -18,7 +18,7 @@ class kolab_client_task_main extends kolab_client_task
$this->output->set_env('watermark', $this->output->get_template('watermark'));
// assign default set of translations
- $this->output->add_translation('loading', 'servererror', 'search');
+ $this->output->add_translation('loading', 'saving', 'deleting', 'servererror', 'search');
// Create list of tasks for dashboard
// @TODO: check capabilities
diff --git a/lib/client/kolab_client_task_user.php b/lib/client/kolab_client_task_user.php
index 71450d9..c7497a0 100644
--- a/lib/client/kolab_client_task_user.php
+++ b/lib/client/kolab_client_task_user.php
@@ -133,6 +133,7 @@ class kolab_client_task_user extends kolab_client_task
$id = $this->get_input('id', 'POST');
$result = $this->api->get('user.info', array('user' => $id));
$user = $result->get($id);
+ $user['user'] = $id;
$output = $this->user_form(null, $user);
$this->output->set_object('taskcontent', $output);
@@ -415,7 +416,8 @@ class kolab_client_task_user extends kolab_client_task
$this->output->set_env('auto_fields', $auto_fields);
$this->output->set_env('form_id', $form_id);
- $this->output->add_translation('user.password.mismatch');
+ $this->output->add_translation('user.password.mismatch',
+ 'user.add.success', 'user.delete.success');
// Hide account type selector if there's only one type
if (count($accttypes) < 2) {
@@ -500,9 +502,10 @@ class kolab_client_task_user extends kolab_client_task
));
if (!$new) {
+ $user = $data['user'];
$form->add_button(array(
'value' => kolab_html::escape($this->translate('delete.button')),
- 'onclick' => "kadm.user_delete()",
+ 'onclick' => "kadm.user_delete('$user')",
));
}
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index e06184f..4b44c91 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -1,6 +1,8 @@
<?php
$LANG['loading'] = 'Loading...';
+$LANG['saving'] = 'Saving data...';
+$LANG['deleting'] = 'Deleting data...';
$LANG['error'] = 'Error';
$LANG['servererror'] = 'Server Error!';
$LANG['loginerror'] = 'Incorrect username or password!';
@@ -67,12 +69,14 @@ $LANG['user.invitation-policy'] = 'Invitation policy';
$LANG['user.delegate'] = 'Email delegates';
$LANG['user.delegate.desc'] = 'Others allowed to send emails with a "From" address of this account';
$LANG['user.smtp-recipients'] = 'Allowed recipients';
-$LANG['user.smtp-recipients.desc'] = 'Restrict allowed recipients of SMTP messages';
+$LANG['user.smtp-recipients.desc'] = 'Restricts allowed recipients of SMTP messages';
$LANG['user.uid'] = 'Unique identity (UID)';
$LANG['user.password'] = 'Password';
$LANG['user.password-confirm'] = 'Confirm password';
$LANG['user.password.mismatch'] = 'Passwords do not match!';
$LANG['user.homeserver'] = 'Mailbox home server';
+$LANG['user.add.success'] = 'User created successfully.';
+$LANG['user.delete.success'] = 'User deleted successfully.';
$LANG['group.add'] = 'Add Group';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 761fdab..24009b5 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -486,9 +486,20 @@ function kolab_admin()
this.http_post('user.list', props);
};
- this.user_delete = function(props)
+ this.user_delete = function(userid)
{
-
+ this.set_busy(true, 'deleting');
+ this.api_post('user.delete', {user: userid}, 'user_delete_response');
+ };
+
+ this.user_delete_response = function(response)
+ {
+ if (!this.api_response(response))
+ return;
+
+ this.display_message('user.delete.success');
+ this.set_watermark('taskcontent');
+ // @TODO: refresh the list
};
this.user_save = function()
@@ -504,6 +515,7 @@ function kolab_admin()
return;
}
+ this.set_busy(true, 'saving');
this.api_post('user.add', data, 'user_save_response');
};
@@ -511,6 +523,10 @@ function kolab_admin()
{
if (!this.api_response(response))
return;
+
+ this.display_message('user.add.success');
+ this.set_watermark('taskcontent');
+ // @TODO: refresh the list
};
};