summaryrefslogtreecommitdiff
path: root/plugins/acl/acl.js
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-01-10 09:55:35 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-01-10 09:55:35 +0000
commit2a9d6c75005951b3e979e33e0ecf34d9c8b1e51f (patch)
tree90701c7907e2c4d02fdcd4a42c7eea46789b08b4 /plugins/acl/acl.js
parent2259a94f6440e54bc632009fc1063844ec8252c7 (diff)
- Fixed edit/delete actions state after deleting table row
- Chandle adding ACL user-entries with comma - split the value and create many entries git-svn-id: https://svn.roundcube.net/trunk@5748 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/acl/acl.js')
-rw-r--r--plugins/acl/acl.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js
index 9eb7faae2..aa9e06d3d 100644
--- a/plugins/acl/acl.js
+++ b/plugins/acl/acl.js
@@ -179,9 +179,8 @@ rcube_webmail.prototype.acl_get_usernames = function()
if (this.env.acl_specials.length && $.inArray(selection[n], this.env.acl_specials) >= 0) {
users.push(selection[n]);
}
- else {
- row = list.rows[selection[n]].obj;
- cell = $('td.user', row);
+ else if (row = list.rows[selection[n]]) {
+ cell = $('td.user', row.obj);
if (cell.length == 1)
users.push(cell.text());
}
@@ -193,10 +192,17 @@ rcube_webmail.prototype.acl_get_usernames = function()
// Removes ACL table row
rcube_webmail.prototype.acl_remove_row = function(id)
{
- this.acl_list.remove_row(id);
+ var list = this.acl_list;
+
+ list.remove_row(id);
+ list.clear_selection();
+
// we don't need it anymore (remove id conflict)
$('#rcmrow'+id).remove();
this.env.acl[id] = null;
+
+ this.enable_command('acl-delete', list.selection.length > 0);
+ this.enable_command('acl-edit', list.selection.length == 1);
}
// Adds ACL table row
@@ -259,7 +265,7 @@ rcube_webmail.prototype.acl_add_row = function(o, sel)
// Initializes and shows ACL create/edit form
rcube_webmail.prototype.acl_init_form = function(id)
{
- var ul, row, val = '', type = 'user', li_elements, body = $('body'),
+ var ul, row, td, val = '', type = 'user', li_elements, body = $('body'),
adv_ul = $('#advancedrights'), sim_ul = $('#simplerights'),
name_input = $('#acluser');
@@ -286,10 +292,11 @@ rcube_webmail.prototype.acl_init_form = function(id)
li_elements = $(':checkbox', ul);
li_elements.attr('checked', false);
- if (id) {
- row = this.acl_list.rows[id].obj;
+ if (id && (row = this.acl_list.rows[id])) {
+ row = row.obj;
li_elements.map(function() {
- var val = this.value, td = $('td.'+this.id, row);
+ val = this.value;
+ td = $('td.'+this.id, row);
if (td && td.hasClass('enabled'))
this.checked = true;
});