summaryrefslogtreecommitdiff
path: root/plugins/acl/acl.js
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-08-02 07:55:15 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-08-02 07:55:15 +0000
commit9420400b501e0c57faf2bb9f0f394ccb2390488b (patch)
tree06455cf4938082626c4149aa50ff1d67c8102c27 /plugins/acl/acl.js
parent16fa4681bce4ad71236ca29a706600767ffc0a07 (diff)
- Improved partial ACL (in simple mode) handling/presentation
git-svn-id: https://svn.roundcube.net/trunk@5000 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/acl/acl.js')
-rw-r--r--plugins/acl/acl.js26
1 files changed, 23 insertions, 3 deletions
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 <alec@alec.pl>
*/
@@ -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<len; i++)
+ if (acl1.indexOf(acl2[i]) > -1)
+ found++;
+
+ if (found == len)
+ return 'enabled';
+ else if (found)
+ return 'partial';
+
+ return 'disabled';
+}