X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=plugins%2Facl%2Facl.js;fp=plugins%2Facl%2Facl.js;h=aa9e06d3da3685b764ebbcf4a1ab800b7c06f30b;hb=7033aedb93d429abdeccf3bceb7152b5f91dc104;hp=c4011a81c5af16faf1dc8d0c0013ce9940ccafc6;hpb=a6cc1ac49674e1902dbb9a2c34f22408471bc4d3;p=roundcube.git diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js index c4011a8..aa9e06d 100644 --- a/plugins/acl/acl.js +++ b/plugins/acl/acl.js @@ -1,7 +1,7 @@ /** * ACL plugin script * - * @version 0.6.3 + * @version @package_version@ * @author Aleksander Machniak */ @@ -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; }); @@ -299,6 +306,9 @@ rcube_webmail.prototype.acl_init_form = function(id) else type = id; } + // mark read (lrs) rights by default + else + li_elements.filter(function() { return this.id.match(/^acl([lrs]|read)$/); }).prop('checked', true); name_input.val(val); $('input[value='+type+']').prop('checked', true);