From 9420400b501e0c57faf2bb9f0f394ccb2390488b Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 2 Aug 2011 07:55:15 +0000 Subject: - Improved partial ACL (in simple mode) handling/presentation git-svn-id: https://svn.roundcube.net/trunk@5000 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/acl/acl.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'plugins/acl/acl.js') diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js index ce1797fd0..3cca7bf1e 100644 --- a/plugins/acl/acl.js +++ b/plugins/acl/acl.js @@ -1,7 +1,7 @@ /** * ACL plugin script * - * @version 0.4 + * @version 0.5 * @author Aleksander Machniak */ @@ -209,7 +209,7 @@ rcube_webmail.prototype.acl_add_row = function(o, sel) // Update new row $('td', row).map(function() { - var cl = this.className.replace(/^acl/, ''); + var r, cl = this.className.replace(/^acl/, ''); if (items && items[cl]) cl = items[cl]; @@ -217,7 +217,7 @@ rcube_webmail.prototype.acl_add_row = function(o, sel) if (cl == 'user') $(this).text(o.username); else - $(this).addClass(String(o.acl).match(RegExp(cl)) ? 'enabled' : 'disabled').text(''); + $(this).addClass(rcmail.acl_class(o.acl, cl)).text(''); }); row.attr('id', 'rcmrow'+id); @@ -316,3 +316,23 @@ rcube_webmail.prototype.acl_init_form = function(id) if (type == 'user') name_input.focus(); } + +// Returns class name according to ACL comparision result +rcube_webmail.prototype.acl_class = function(acl1, acl2) +{ + var i, len, found = 0; + + acl1 = String(acl1); + acl2 = String(acl2); + + for (i=0, len=acl2.length; i -1) + found++; + + if (found == len) + return 'enabled'; + else if (found) + return 'partial'; + + return 'disabled'; +} -- cgit v1.2.3