= 0) {
users.push(selection[n]);
}
else if ((row = list.rows[selection[n]]) && (id = $(row.obj).data('userid'))) {
users.push(id);
}
}
return users;
}
// Removes ACL table row
rcube_webmail.prototype.acl_remove_row = function(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.get_selection().length > 0);
this.enable_command('acl-edit', list.get_selection().length == 1);
}
// Adds ACL table row
rcube_webmail.prototype.acl_add_row = function(o, sel)
{
var n, len, ids = [], spec = [], id = o.id, list = this.acl_list,
items = this.env.acl_advanced ? [] : this.env.acl_items,
table = this.gui_objects.acltable,
row = $('thead > tr', table).clone();
// Update new row
$('th', row).map(function() {
var td = $(''),
title = $(this).attr('title'),
cl = this.className.replace(/^acl/, '');
if (title)
td.attr('title', title);
if (items && items[cl])
cl = items[cl];
if (cl == 'user')
td.addClass(cl).attr('title', o.title).append($('').text(o.display));
else
td.addClass(this.className + ' ' + rcmail.acl_class(o.acl, cl)).html('');
$(this).replaceWith(td);
});
row = row.attr({id: 'rcmrow' + id, 'data-userid': o.username}).get(0);
this.env.acl[id] = o.acl;
// sorting... (create an array of user identifiers, then sort it)
for (n in this.env.acl) {
if (this.env.acl[n]) {
if (this.env.acl_specials.length && $.inArray(n, this.env.acl_specials) >= 0)
spec.push(n);
else
ids.push(n);
}
}
ids.sort();
// specials on the top
ids = spec.concat(ids);
// find current id
for (n=0, len=ids.length; n -1)
found++;
if (found == len)
return 'enabled';
else if (found)
return 'partial';
return 'disabled';
}
|